Merge branch 'fix/f4': community issue fixes

This commit is contained in:
Claude
2026-10-10 20:00:37 +00:00
16 changed files with 368 additions and 19 deletions
+47
View File
@@ -298,3 +298,50 @@ fn project_empty_area_double_click_and_dropped_files_import() {
h.run_steps(2);
assert_eq!(imports(&h), 2, "the dropped file was imported");
}
/// Issue #306: dragging the viewer/Timeline divider far up made a nested split shorter than its
/// two 20 pt minimums, and `f32::clamp` panicked with crossed bounds, closing the app.
#[test]
fn dragging_the_viewer_timeline_divider_far_up_does_not_crash() {
let (mut h, _, _) = harness();
// The horizontal gutter right above the Timeline.
let tl = rect(&h, "panel.Timeline");
let gutter = |h: &Harness<'_, EffectcraftApp>| {
h.state()
.auto
.previous
.iter()
.filter(|e| e.id.starts_with("dock.gutter.") && e.rect[2] > e.rect[3])
.map(|e| (e.id.clone(), egui::Rect::from_min_size(pos2(e.rect[0], e.rect[1]), egui::vec2(e.rect[2], e.rect[3]))))
.filter(|(_, g)| g.x_range().contains(tl.center().x) && g.max.y <= tl.min.y + 1.0)
.min_by(|a, b| (tl.min.y - a.1.max.y).total_cmp(&(tl.min.y - b.1.max.y)))
.expect("the gutter above the Timeline")
};
let (id, g) = gutter(&h);
drag(&mut h, g.center(), g.center() - egui::vec2(0.0, 2000.0));
let g2 = rect(&h, &id);
assert!(g2.center().y < g.center().y - 100.0, "the divider moved up: {g:?} → {g2:?}");
// And back down past the bottom.
drag(&mut h, g2.center(), g2.center() + egui::vec2(0.0, 3000.0));
h.run_steps(2);
}
/// Issue #301: clicking anywhere on a stacked panel's header bar expands/collapses it, not only
/// its name; the panel menu button keeps its own click.
#[test]
fn a_stacked_panels_whole_header_bar_toggles_it() {
let (mut h, _, _) = harness();
let open = |h: &Harness<'_, EffectcraftApp>| h.state().ui.dock.is_visible(PanelKind::Preview);
assert!(open(&h));
let bar = rect(&h, "panel.header.Preview");
let tab = rect(&h, "panel.tab.Preview");
assert!(bar.min.x >= tab.max.x - 1.0 && bar.width() > 40.0, "{bar:?} {tab:?}");
click_n(&mut h, pos2(bar.max.x - 6.0, bar.center().y), 1);
assert!(!open(&h), "a click at the bar's right end collapses Preview");
let bar = rect(&h, "panel.header.Preview");
click_n(&mut h, bar.center(), 1);
assert!(open(&h), "and expands it again");
let menu = rect(&h, "panel.menu.Preview");
click_n(&mut h, menu.center(), 1);
assert!(open(&h), "the panel menu button doesn't toggle the panel");
}
+65
View File
@@ -339,3 +339,68 @@ fn dragging_out_of_the_marker_bin_adds_a_comp_marker() {
h.run_steps(2);
assert_eq!(markers(&h), vec![13.0, 20.0]);
}
/// #468: zoomed in, a CTI scrub held past the right end of the ruler scrolls the timeline (the
/// CTI rides the edge), past the left end scrolls it back; during playback the view pages to
/// keep the CTI in sight.
#[test]
fn the_timeline_follows_the_cti_past_its_edges() {
let (mut h, _) = harness();
// (Opening the comp showed all of it.)
h.state_mut().ui.timeline.pps = Some(200.0);
h.run_steps(2);
let ruler = rect(&h, "timeline.ruler");
let (s0, e0) = visible(&h);
assert_eq!(s0, 0.0);
let y = ruler.max.y - 4.0;
let from = pos2(ruler.center().x, y);
let past = pos2(ruler.max.x + 60.0, y);
h.event(Event::PointerMoved(from));
h.step();
h.event(Event::PointerButton { pos: from, button: egui::PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE });
h.step();
for k in 1..=4 {
h.event(Event::PointerMoved(from + (past - from) * (k as f32 / 4.0)));
h.step();
}
// Held still past the edge: it keeps scrolling (the view is read once the button is up).
h.run_steps(30);
let release = |h: &mut Harness<'_, EffectcraftApp>, at: Pos2| {
h.event(Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE });
h.run_steps(2);
};
release(&mut h, past);
let (s1, e1) = visible(&h);
let cti = h.state().session.time().seconds();
assert!(s1 > 0.5, "the view scrolled right: {s0}..{e0} → {s1}..{e1}");
assert!(cti > e0 && cti >= s1 && cti <= e1 + 0.05, "the CTI rides the right edge: {cti} in {s1}..{e1}");
// Pressed again and held past the left end: back to the left.
let left = pos2(ruler.min.x - 60.0, y);
h.event(Event::PointerMoved(from));
h.step();
h.event(Event::PointerButton { pos: from, button: egui::PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE });
h.step();
for k in 1..=4 {
h.event(Event::PointerMoved(from + (left - from) * (k as f32 / 4.0)));
h.step();
}
h.run_steps(5);
release(&mut h, left);
let (s2, _) = visible(&h);
let cti = h.state().session.time().seconds();
assert!(s2 < s1 && (cti - s2).abs() < 0.05, "the view scrolled back left: {s1} → {s2}, CTI {cti}");
// Playback past the visible span pages the view to the CTI.
let (s3, e3) = visible(&h);
let t = e3 + 20.0;
h.state_mut().session.set_time(effectcraft_engine::time::Tick::from_seconds_f64(t));
let now = h.ctx.input(|i| i.time);
h.state_mut().play(now);
assert!(h.state().playback.playing);
h.step();
h.state_mut().stop();
h.step();
let cti = h.state().session.time().seconds();
let (s4, e4) = visible(&h);
assert!(s4 > s3 && cti >= s4 && cti <= e4, "paged from {s3}..{e3} to {s4}..{e4} for the CTI at {cti}");
}