forge
Explore
Log in

Don't you dare go Hollow

Scroll equalizer card from hint

Browse files at this commit

dd96126513013ceda325115d9b19809e3f84af25Ahmet Kaan GümüşParent: e78c741
  • fix
    • scroll equalizer card from hint
Show full message
fix(ui): scroll equalizer card from hint
crates/app/src/tests/cards.rsmodified+33 -0
@@ -1770,6 +1770,39 @@ fn a_cards_own_help_paints_while_the_card_is_open_but_the_ui_under_it_stays_quie
17701770 );
17711771 }
17721772
1773+/// Structural guard only: this binary has no `TestAppContext`, so it cannot
1774+/// mount the card, aim at its hint, wheel it, or read painted movement. A
1775+/// driving pass must still prove a wheel over the hint changes card pixels.
1776+/// This pins the declaration-level invariant that the EQ card's outer
1777+/// container, which also owns the hint sibling, owns `eq_scroll`; putting the
1778+/// handle back on `eq-card-rows` recreates that hint's dead zone.
1779+#[test]
1780+fn eq_cards_scroll_handle_belongs_to_the_container_that_also_holds_its_hint() {
1781+ let card = fn_body("eq_card");
1782+ let card_at = card.find(".id(\"eq-card\")").expect("EQ card container");
1783+ let rows_at = card.find(".id(\"eq-card-rows\")").expect("EQ card rows");
1784+ let container = &card[card_at..rows_at];
1785+
1786+ assert!(
1787+ container.contains(".overflow_y_scroll()")
1788+ && container.contains(".track_scroll(&self.eq_scroll)"),
1789+ "eq_scroll must belong to eq-card, the container that also holds the \
1790+ below-fold hint, rather than a body-only child"
1791+ );
1792+
1793+ let rows = &card[rows_at..];
1794+ assert!(
1795+ !rows.contains(".track_scroll(&self.eq_scroll)"),
1796+ "eq-card-rows owns eq_scroll again -- its sibling hint becomes a \
1797+ wheel dead zone"
1798+ );
1799+ assert!(
1800+ rows.contains("more below — scroll the card"),
1801+ "the below-fold hint disappeared; this guard must cover the child it \
1802+ keeps in the card's wheel surface"
1803+ );
1804+}
1805+
17731806 /// "Maximize a card in place" changes size only, never the relative
17741807 /// semantics a value is drawn against: `eq_x`/`eq_y` map into `0..1` of
17751808 /// whatever box they are given, so a wider/taller EQ card is genuinely more
crates/app/src/ui/cards.rsmodified+11 -12
@@ -1560,14 +1560,19 @@ impl Player {
15601560 // outright hung the card's right-hand third off the edge
15611561 // of the window. The two cards beside it are built this
15621562 // way for the same reason.
1563+ .id("eq-card")
15631564 .w_full()
15641565 .max_w(px(eq_card_w(f32::from(viewport.width), self.card_maximized)))
15651566 // And a cap the other way, for the same reason the width
15661567 // has one: the card is docked in a column now, and at the
15671568 // 360 px floor it is taller than that column -- its title
15681569 // ran off the top and its buttons off the bottom, with
1569- // neither reachable. Capped here, scrolled below.
1570+ // neither reachable. The card itself owns that scroll:
1571+ // every child, including the below-fold line, is in its
1572+ // wheel surface rather than a fixed sibling dead zone.
15701573 .max_h(relative(1.))
1574+ .overflow_y_scroll()
1575+ .track_scroll(&self.eq_scroll)
15711576 // Maximized also *claims* the room the cap above
15721577 // only allows: `flex_1()`/`max_h` on the graph below
15731578 // has nothing to grow into if the card itself still
@@ -1584,18 +1589,12 @@ impl Player {
15841589 .child(
15851590 div()
15861591 .id("eq-card-rows")
1587- // Shrinkable below its content, which is what
1588- // makes the cap above a scroll rather than a
1589- // clip; the rows themselves keep their heights.
1590- .min_h(px(0.))
1591- // Maximized: stretch to the room the card
1592- // above now claims, so the graph's own
1593- // `flex_1` (above) has the leftover space to
1594- // grow into instead of the card just hugging
1595- // its content and leaving none.
1592+ // A non-maximized card exposes the body's full
1593+ // natural height to its parent scroll surface;
1594+ // maximized fills the claimed card room so the
1595+ // graph can consume only the leftover height.
1596+ .when(!graph_maximized, |d| d.flex_none())
15961597 .when(graph_maximized, |d| d.flex_1())
1597- .overflow_y_scroll()
1598- .track_scroll(&self.eq_scroll)
15991598 .flex()
16001599 .flex_col()
16011600 .gap(px(2.))