forge
Explore
Log in

Don't you dare go Hollow

The compiler has nothing left to say

Browse files at this commit

47519e81bac6a8518889c91cecabc7a39a10f801Ahmet Kaan GümüşParent: 3136aa6
  • chore
    • the compiler has nothing left to say
Show full message
🧹 chore(app): the compiler has nothing left to say

The uniform lanes_shown/rows_below pair went with their last caller
(the mixed math is the render's), their pins moved onto the mixed
variants, and the escape rule's re-export is the tests' alone.
crates/app/src/layout.rsmodified+0 -21
@@ -216,27 +216,6 @@ pub(crate) fn lanes_h(lanes: usize) -> f32 {
216 }216 }
217 }217 }
218 218
219-/// How many whole lane rows a box this tall shows. At least one: a box too
220-/// short for a single lane still shows part of one, and "0 shown" would count
221-/// every lane there is as hidden.
222-pub(crate) fn lanes_shown(box_h: f32) -> usize {
223- (((box_h + 8.) / (LANE_H + 8.)).floor() as usize).max(1)
224-}
225-
226-/// How many rows are still below the fold *now*: the count the affordance says
227-/// out loud, and the reason it is a function of the scroll rather than of the
228-/// lane count alone. A line that keeps saying "2 more tracks below" after the
229-/// user has scrolled to the last one is a line that has stopped being true, and
230-/// an affordance nobody can make go away is read as a bug rather than as an
231-/// instruction.
232-///
233-/// `scrolled` is how far down the column has been taken, in pixels. Rounded to
234-/// the nearest row: a half-scrolled row is showing, so it is not below.
235-pub(crate) fn rows_below(total: usize, box_h: f32, scrolled: f32) -> usize {
236- let past = ((scrolled / (LANE_H + 8.)).round().max(0.)) as usize;
237- total.saturating_sub(past + lanes_shown(box_h))
238-}
239-
240 /// How tall one lane row is: [`LANE_H`] for a media track, [`SUB_LANE_H`] for219 /// How tall one lane row is: [`LANE_H`] for a media track, [`SUB_LANE_H`] for
241 /// a caption one -- the one place that answer is decided, since220 /// a caption one -- the one place that answer is decided, since
242 /// [`lanes_h_mixed`], [`lanes_shown_mixed`] and [`rows_below_mixed`] all walk221 /// [`lanes_h_mixed`], [`lanes_shown_mixed`] and [`rows_below_mixed`] all walk
crates/app/src/main.rsmodified+2 -0
@@ -30,6 +30,8 @@ pub(crate) use interact::*;
30 pub(crate) use layout::*;30 pub(crate) use layout::*;
31 pub(crate) use library_meta::*;31 pub(crate) use library_meta::*;
32 pub(crate) use menus::*;32 pub(crate) use menus::*;
33+// The tests' door to the escape rule; render.rs calls it by its own name.
34+#[cfg(test)]
33 pub(crate) use render::escape_leaves_player_fullscreen;35 pub(crate) use render::escape_leaves_player_fullscreen;
34 pub(crate) use notices::*;36 pub(crate) use notices::*;
35 pub(crate) use oracle::*;37 pub(crate) use oracle::*;
crates/app/src/tests/layout.rsmodified+12 -22
@@ -74,31 +74,15 @@ fn the_line_about_what_is_below_the_fold_counts_what_is_still_below_it() {
74 "{} px of chrome and a lane will not fit {floor} px",74 "{} px of chrome and a lane will not fit {floor} px",
75 timeline_fixed_h(true)75 timeline_fixed_h(true)
76 );76 );
77- // What is left over is measured in whole lanes, at least one.77+ // The lane questions, asked of the mixed math the render actually walks
78- assert_eq!(lanes_shown(LANE_H), 1);78+ // (the uniform lanes_shown/rows_below pair went with their last caller;
79- assert_eq!(lanes_shown(LANE_H - 10.), 1);79+ // a lane in the stack may be a thinner
80- assert_eq!(lanes_shown(2. * LANE_H + 8.), 2);
81-
82- // Four tracks in a two-lane box: two are below, and each row scrolled
83- // past takes one off that count until none is left. This is the bug the
84- // graft fixes -- the count used to be `total - shown` forever, so the
85- // line still said "2 more below" with the last track on screen.
86- let box_h = 2. * LANE_H + 8.;
87- assert_eq!(rows_below(4, box_h, 0.), 2);
88- assert_eq!(rows_below(4, box_h, LANE_H + 8.), 1);
89- assert_eq!(rows_below(4, box_h, 2. * (LANE_H + 8.)), 0);
90- // Past the end (gpui clamps, but the arithmetic must not wrap).
91- assert_eq!(rows_below(4, box_h, 900.), 0);
92- // A project that fits says nothing at all.
93- assert_eq!(rows_below(2, box_h, 0.), 0);
94-
95- // The same three questions once a lane in the stack is a thinner
96 // caption one: a uniform stack answers exactly what the plain80 // caption one: a uniform stack answers exactly what the plain
97 // functions above do, and a mixed one answers off the real heights,81 // functions above do, and a mixed one answers off the real heights,
98 // never the media one alone.82 // never the media one alone.
99 let uniform = [LaneKind::Video, LaneKind::Audio];83 let uniform = [LaneKind::Video, LaneKind::Audio];
100 assert_eq!(lanes_h_mixed(&uniform), lanes_h(2));84 assert_eq!(lanes_h_mixed(&uniform), lanes_h(2));
101- assert_eq!(lanes_shown_mixed(&uniform, LANE_H), lanes_shown(LANE_H));85+ assert_eq!(lanes_shown_mixed(&uniform, LANE_H), 1);
102 let mixed = [LaneKind::Video, LaneKind::Audio, LaneKind::Subtitle];86 let mixed = [LaneKind::Video, LaneKind::Audio, LaneKind::Subtitle];
103 assert_eq!(87 assert_eq!(
104 lanes_h_mixed(&mixed),88 lanes_h_mixed(&mixed),
@@ -411,7 +395,10 @@ fn the_scroll_strip_row_comes_and_goes_with_the_zoom() {
411 // either face of the zoom boundary.395 // either face of the zoom boundary.
412 let floor = split_size(Split::Timeline, Some(0.), 2, window, scroll);396 let floor = split_size(Split::Timeline, Some(0.), 2, window, scroll);
413 let box_h = floor - timeline_fixed_h(scroll);397 let box_h = floor - timeline_fixed_h(scroll);
414- assert!(2 > lanes_shown(box_h), "no line to pay for at the floor");398+ assert!(
399+ 2 > lanes_shown_mixed(&[LaneKind::Video, LaneKind::Audio], box_h),
400+ "no line to pay for at the floor"
401+ );
415 assert!(402 assert!(
416 box_h - LABEL_H - 8. >= LANE_H,403 box_h - LABEL_H - 8. >= LANE_H,
417 "the floor leaves {} px for a {LANE_H} px lane",404 "the floor leaves {} px for a {LANE_H} px lane",
@@ -1637,7 +1624,10 @@ fn a_dragged_divider_stops_before_either_panel_disappears() {
1637 // ([`Player::timeline`]): what the affordance costs comes off the box, and1624 // ([`Player::timeline`]): what the affordance costs comes off the box, and
1638 // a whole lane is still standing under it.1625 // a whole lane is still standing under it.
1639 let lanes_box = floor - timeline_fixed_h(true);1626 let lanes_box = floor - timeline_fixed_h(true);
1640- assert!(2 > lanes_shown(lanes_box), "no line to pay for at the floor");1627+ assert!(
1628+ 2 > lanes_shown_mixed(&[LaneKind::Video, LaneKind::Audio], lanes_box),
1629+ "no line to pay for at the floor"
1630+ );
1641 assert!(1631 assert!(
1642 lanes_box - LABEL_H - 8. >= LANE_H,1632 lanes_box - LABEL_H - 8. >= LANE_H,
1643 "the floor leaves {} px for a {LANE_H} px lane",1633 "the floor leaves {} px for a {LANE_H} px lane",
crates/app/src/tests/mod.rsmodified+2 -2
@@ -34,8 +34,8 @@ use super::{
34 LATE_RESYNC, RESYNC_GAP, should_resync,34 LATE_RESYNC, RESYNC_GAP, should_resync,
35 retarget, row_enable, row_items, scrub_due, secs_label, show_label, silence_rate, size_label, snap_cue, snap_marks, snapped,35 retarget, row_enable, row_items, scrub_due, secs_label, show_label, silence_rate, size_label, snap_cue, snap_marks, snapped,
36 SUB_PLAN_CHARS, source_tint, span_partner, speed_at, sub_pick_after_removal, subtitle_plan, summary_head, summary_tail, timecode, transport,36 SUB_PLAN_CHARS, source_tint, span_partner, speed_at, sub_pick_after_removal, subtitle_plan, summary_head, summary_tail, timecode, transport,
37- EXPORT_DONE, NOTICES_MAX, STATUS_ERROR, TIMELINE_SHARE, lanes_shown, timeline_fixed_h,37+ EXPORT_DONE, NOTICES_MAX, STATUS_ERROR, TIMELINE_SHARE, timeline_fixed_h,
38- px_below, rows_below, STATUS_SUCCESS, STATUS_WARNING, notice_tone,38+ px_below, STATUS_SUCCESS, STATUS_WARNING, notice_tone,
39 proxies_to_start, push_notice, typed, unseen_paths, unseen_sources,39 proxies_to_start, push_notice, typed, unseen_paths, unseen_sources,
40 whole_take, window_title,40 whole_take, window_title,
41 };41 };