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
1836 );1836 );
1837 }1837 }
1838 1838
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+
1839 /// "Maximize a card in place" changes size only, never the relative1872 /// "Maximize a card in place" changes size only, never the relative
1840 /// semantics a value is drawn against: `eq_x`/`eq_y` map into `0..1` of1873 /// semantics a value is drawn against: `eq_x`/`eq_y` map into `0..1` of
1841 /// whatever box they are given, so a wider/taller EQ card is genuinely more1874 /// 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 {
1656 // outright hung the card's right-hand third off the edge1656 // outright hung the card's right-hand third off the edge
1657 // of the window. The two cards beside it are built this1657 // of the window. The two cards beside it are built this
1658 // way for the same reason.1658 // way for the same reason.
1659+ .id("eq-card")
1659 .w_full()1660 .w_full()
1660 .max_w(px(eq_card_w(f32::from(viewport.width), self.card_maximized)))1661 .max_w(px(eq_card_w(f32::from(viewport.width), self.card_maximized)))
1661 // And a cap the other way, for the same reason the width1662 // And a cap the other way, for the same reason the width
1662 // has one: the card is docked in a column now, and at the1663 // has one: the card is docked in a column now, and at the
1663 // 360 px floor it is taller than that column -- its title1664 // 360 px floor it is taller than that column -- its title
1664 // ran off the top and its buttons off the bottom, with1665 // 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.
1666 .max_h(relative(1.))1669 .max_h(relative(1.))
1670+ .overflow_y_scroll()
1671+ .track_scroll(&self.eq_scroll)
1667 // Maximized also *claims* the room the cap above1672 // Maximized also *claims* the room the cap above
1668 // only allows: `flex_1()`/`max_h` on the graph below1673 // only allows: `flex_1()`/`max_h` on the graph below
1669 // has nothing to grow into if the card itself still1674 // has nothing to grow into if the card itself still
@@ -1680,18 +1685,12 @@ impl Player {
1680 .child(1685 .child(
1681 div()1686 div()
1682 .id("eq-card-rows")1687 .id("eq-card-rows")
1683- // Shrinkable below its content, which is what1688+ // A non-maximized card exposes the body's full
1684- // makes the cap above a scroll rather than a1689+ // natural height to its parent scroll surface;
1685- // clip; the rows themselves keep their heights.1690+ // maximized fills the claimed card room so the
1686- .min_h(px(0.))1691+ // graph can consume only the leftover height.
1687- // Maximized: stretch to the room the card1692+ .when(!graph_maximized, |d| d.flex_none())
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.
1692 .when(graph_maximized, |d| d.flex_1())1693 .when(graph_maximized, |d| d.flex_1())
1693- .overflow_y_scroll()
1694- .track_scroll(&self.eq_scroll)
1695 .flex()1694 .flex()
1696 .flex_col()1695 .flex_col()
1697 .gap(px(2.))1696 .gap(px(2.))