diff --git a/crates/app/src/export_ui.rs b/crates/app/src/export_ui.rs index 0c04e7d..27d4f3a 100644 --- a/crates/app/src/export_ui.rs +++ b/crates/app/src/export_ui.rs @@ -903,17 +903,6 @@ pub(crate) const MBPS_MAX: u32 = 50; /// than being dropped keystroke by keystroke. pub(crate) const MBPS_DIGITS: usize = 3; -/// A typed bitrate as the card takes it, or the reason it is not one. The words -/// are the row's: they are what the field shows in place of its hint. -pub(crate) fn commit_mbps(text: &str) -> Result { - match text.parse::() { - Ok(mbps) if (MBPS_MIN..=MBPS_MAX).contains(&mbps) => Ok(mbps), - Ok(0) => Err(format!("0 is not a rate — {MBPS_MIN}–{MBPS_MAX} Mbps")), - Ok(mbps) => Err(format!("{mbps} is past the {MBPS_MAX} Mbps ceiling")), - Err(_) => Err(format!("type a number — {MBPS_MIN}–{MBPS_MAX} Mbps")), - } -} - /// A clip's share of the lane. A timeline with no length reads as one full-width /// box rather than as NaN, which gpui would carry into layout. /// Why this timeline cannot be written in `format`, if it cannot. diff --git a/crates/app/src/tests/cards.rs b/crates/app/src/tests/cards.rs index ac833c7..9202847 100644 --- a/crates/app/src/tests/cards.rs +++ b/crates/app/src/tests/cards.rs @@ -1022,12 +1022,20 @@ fn a_typed_bitrate_is_a_field_and_not_a_key_capture() { assert_eq!(edit.commit(), Some(5)); // Empty, zero, and past the digit cap: each its own reason, none of - // them silent. - assert!(commit_mbps("").is_err()); - assert!(commit_mbps("0").unwrap_err().contains("not a rate")); - assert_eq!(commit_mbps("1"), Ok(MBPS_MIN)); - assert_eq!(commit_mbps("50"), Ok(MBPS_MAX)); - assert!(commit_mbps("51").is_err()); + // them silent -- asserted on the widget itself, the door the card uses. + let mut edit = mbps_edit(0); + assert_eq!(edit.commit(), None, "empty is not a number"); + let mut edit = mbps_edit(0); + edit.digit(0); + assert_eq!(edit.commit(), None); + assert!(edit.refusal.clone().expect("zero says why").contains("0 is not a value")); + assert_eq!(mbps_edit(MBPS_MIN).commit(), Some(MBPS_MIN)); + assert_eq!(mbps_edit(MBPS_MAX).commit(), Some(MBPS_MAX)); + let mut edit = mbps_edit(0); + for digit in [5, 1] { + edit.digit(digit); + } + assert_eq!(edit.commit(), None, "51 is past the ceiling"); let mut edit = mbps_edit(0); for digit in [9, 9, 9, 9] { edit.digit(digit); diff --git a/crates/app/src/tests/mod.rs b/crates/app/src/tests/mod.rs index 869d483..eb30353 100644 --- a/crates/app/src/tests/mod.rs +++ b/crates/app/src/tests/mod.rs @@ -22,7 +22,7 @@ use super::{ SPEED_PRESETS, SPEED_STEP, STATUS_ERROR, STATUS_SUCCESS, STATUS_WARNING, SUB_PLAN_CHARS, Source, Speed, StreamInfo, TIMELINE_SHARE, Transport, VOLUME_W, Volume, WAVE_BPS, WAVE_COL, WAVE_COLS_MAX, Wave, ZOOM_MIN_FRAMES, active_lane, band_label, bitrate_detail, bitrate_refusal, - clipboard_after_remove, color_snap, commit_mbps, containers, enable, enable_lane, envelope, + clipboard_after_remove, color_snap, containers, enable, enable_lane, envelope, eq_card_w, eq_freq, eq_freq_label, eq_graph_h, eq_spectrum, eq_x, eq_y, estimated_bytes, export_path, export_settings, format_line, format_refusal, fps_choices, fps_label, frac_along, frac_down, frame_at, frame_rate_ladder, histogram, inserted_band, is_project, keymap,