audit switch
This commit is contained in:
@@ -83,6 +83,30 @@ fn disabled_switch_does_not_report_changes() {
|
||||
assert!(changes.borrow().is_empty());
|
||||
}
|
||||
|
||||
/// The track renders at the platform's stated switch dims, not the generic
|
||||
/// control height — the stated metric is the whole chrome.
|
||||
#[test]
|
||||
fn track_renders_at_the_stated_switch_dims() {
|
||||
let (mut cx, _window, _changes) = switch_window(false, false);
|
||||
let (width, height) = cx.update(|_window, cx| {
|
||||
let metrics = Theme::global(cx).sizes.medium;
|
||||
(metrics.switch_width, metrics.switch_height)
|
||||
});
|
||||
let track = cx
|
||||
.debug_bounds("test-switch-track")
|
||||
.expect("the switch track should have been laid out");
|
||||
assert!(
|
||||
(track.size.width - width).abs() <= px(0.5),
|
||||
"track is {:?} wide, stated switch width is {width:?}",
|
||||
track.size.width
|
||||
);
|
||||
assert!(
|
||||
(track.size.height - height).abs() <= px(0.5),
|
||||
"track is {:?} tall, stated switch height is {height:?}",
|
||||
track.size.height
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enter_and_space_report_the_next_value_while_focused() {
|
||||
let (mut cx, window, changes) = switch_window(false, false);
|
||||
|
||||
Reference in New Issue
Block a user