R5.7: Gitea #1, ElyShow's slide strip scrolls with the wheel; R1 PASS

The strip's list sat in a ContextMenu host with no size, so it grew
with its content and never overflowed. The host now fills its column,
as ElyPDF's do; a 24-slide test wheels to the last slide.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-14 14:36:00 -04:00
1 parent 35a7bbb904
commit 135002fda9
6 files changed
+54 -2

No files matched your search

+3 -1
View File
@@ -234,6 +234,7 @@ impl Render for Strip {
let label = format!("{} {}", part + 1, slide.name);
div()
.id(("show-slide", part))
.debug_selector(move || format!("show-slide-{part}"))
.tab_index(0)
.focus_ring(cx)
.flex()
@@ -301,6 +302,7 @@ impl Render for Strip {
.children(slides);
div()
.size_full()
.child(ContextMenu::new("show-strip-menu", popup(cx)).child(list))
// A sized host lets the list overflow and scroll.
.child(ContextMenu::new("show-strip-menu", popup(cx)).size_full().child(list))
}
}
+1
View File
@@ -18,6 +18,7 @@ mod play_more;
mod play_time;
mod review;
mod slides;
mod strip;
/// An unrendered Deck over a fresh worker, if LOK exists.
pub(super) fn deck(cx: &mut TestAppContext, dir: &Path) -> Option<Entity<Deck>> {
+47
View File
@@ -0,0 +1,47 @@
use gpui::{Entity, ScrollDelta, ScrollWheelEvent, TestAppContext, VisualTestContext, point, px};
use super::objects::blank;
use super::{counts, settle, update};
use crate::slides::Strip;
/// The slide strip alone in a window.
struct Host(Entity<Strip>);
impl gpui::Render for Host {
fn render(&mut self, _: &mut gpui::Window, _: &mut gpui::Context<Self>) -> impl gpui::IntoElement {
use gpui::{ParentElement as _, Styled as _};
gpui::div().size_full().child(self.0.clone())
}
}
#[test]
fn the_wheel_scrolls_the_strip_to_its_last_slide() {
let dir = tempfile::tempdir().expect("a temp dir");
let mut cx = TestAppContext::single();
let Some(deck) = blank(&mut cx, dir.path()) else {
return eprintln!("SKIP: no LOK build");
};
for n in 2..=24 {
update(&mut cx, &deck, |deck, cx| deck.object_command("slide.insert", &[], cx));
settle(&cx, |app| counts(app, &deck).0 == n);
}
let strip = cx.update(|app| deck.read(app).strip.clone());
let window = cx.add_window(|_, _| Host(strip));
let mut shown = VisualTestContext::from_window(window.into(), &cx);
shown.run_until_parked();
let height = shown.update(|window, _| window.viewport_size().height);
let last = |shown: &mut VisualTestContext| shown.debug_bounds("show-slide-23").expect("the last slide is laid out");
let before = last(&mut shown);
assert!(before.bottom() > height, "the strip is longer than the window");
let at = point(before.left() + px(20.0), height / 2.0);
for _ in 0..20 {
shown.simulate_event(ScrollWheelEvent {
position: at,
delta: ScrollDelta::Pixels(point(px(0.0), px(-1000.0))),
..Default::default()
});
shown.run_until_parked();
}
let after = last(&mut shown);
assert!(after.bottom() <= height, "the last slide is in view: {after:?}");
}