forge
Explore
Log in

Don't you dare go Hollow

ff3520e7f7f90d14ebb39abcf981c079bcf2e844Ahmet Kaan GümüşParent: cba4c82dd96126
crates/app/src/tests/cards.rsmodified+33 -0
@@ -1836,6 +1836,39 @@ fn a_cards_own_help_paints_while_the_card_is_open_but_the_ui_under_it_stays_quie
18361836 );
18371837 }
18381838
1839+/// Structural guard only: this binary has no `TestAppContext`, so it cannot
1840+/// mount the card, aim at its hint, wheel it, or read painted movement. A
1841+/// driving pass must still prove a wheel over the hint changes card pixels.
1842+/// This pins the declaration-level invariant that the EQ card's outer
1843+/// container, which also owns the hint sibling, owns `eq_scroll`; putting the
1844+/// handle back on `eq-card-rows` recreates that hint's dead zone.
1845+#[test]
1846+fn eq_cards_scroll_handle_belongs_to_the_container_that_also_holds_its_hint() {
1847+ let card = fn_body("eq_card");
1848+ let card_at = card.find(".id(\"eq-card\")").expect("EQ card container");
1849+ let rows_at = card.find(".id(\"eq-card-rows\")").expect("EQ card rows");
1850+ let container = &card[card_at..rows_at];
1851+
1852+ assert!(
1853+ container.contains(".overflow_y_scroll()")
1854+ && container.contains(".track_scroll(&self.eq_scroll)"),
1855+ "eq_scroll must belong to eq-card, the container that also holds the \
1856+ below-fold hint, rather than a body-only child"
1857+ );
1858+
1859+ let rows = &card[rows_at..];
1860+ assert!(
1861+ !rows.contains(".track_scroll(&self.eq_scroll)"),
1862+ "eq-card-rows owns eq_scroll again -- its sibling hint becomes a \
1863+ wheel dead zone"
1864+ );
1865+ assert!(
1866+ rows.contains("more below — scroll the card"),
1867+ "the below-fold hint disappeared; this guard must cover the child it \
1868+ keeps in the card's wheel surface"
1869+ );
1870+}
1871+
18391872 /// "Maximize a card in place" changes size only, never the relative
18401873 /// semantics a value is drawn against: `eq_x`/`eq_y` map into `0..1` of
18411874 /// whatever box they are given, so a wider/taller EQ card is genuinely more
crates/app/src/ui/cards.rsmodified+11 -12
@@ -1656,14 +1656,19 @@ impl Player {
16561656 // outright hung the card's right-hand third off the edge
16571657 // of the window. The two cards beside it are built this
16581658 // way for the same reason.
1659+ .id("eq-card")
16591660 .w_full()
16601661 .max_w(px(eq_card_w(f32::from(viewport.width), self.card_maximized)))
16611662 // And a cap the other way, for the same reason the width
16621663 // has one: the card is docked in a column now, and at the
16631664 // 360 px floor it is taller than that column -- its title
16641665 // ran off the top and its buttons off the bottom, with
1665- // neither reachable. Capped here, scrolled below.
1666+ // neither reachable. The card itself owns that scroll:
1667+ // every child, including the below-fold line, is in its
1668+ // wheel surface rather than a fixed sibling dead zone.
16661669 .max_h(relative(1.))
1670+ .overflow_y_scroll()
1671+ .track_scroll(&self.eq_scroll)
16671672 // Maximized also *claims* the room the cap above
16681673 // only allows: `flex_1()`/`max_h` on the graph below
16691674 // has nothing to grow into if the card itself still
@@ -1680,18 +1685,12 @@ impl Player {
16801685 .child(
16811686 div()
16821687 .id("eq-card-rows")
1683- // Shrinkable below its content, which is what
1684- // makes the cap above a scroll rather than a
1685- // clip; the rows themselves keep their heights.
1686- .min_h(px(0.))
1687- // Maximized: stretch to the room the card
1688- // above now claims, so the graph's own
1689- // `flex_1` (above) has the leftover space to
1690- // grow into instead of the card just hugging
1691- // its content and leaving none.
1688+ // A non-maximized card exposes the body's full
1689+ // natural height to its parent scroll surface;
1690+ // maximized fills the claimed card room so the
1691+ // graph can consume only the leftover height.
1692+ .when(!graph_maximized, |d| d.flex_none())
16921693 .when(graph_maximized, |d| d.flex_1())
1693- .overflow_y_scroll()
1694- .track_scroll(&self.eq_scroll)
16951694 .flex()
16961695 .flex_col()
16971696 .gap(px(2.))