feat: state platform metrics and chrome in theme
This commit is contained in:
@@ -36,10 +36,11 @@ impl Render for Harness {
|
||||
}
|
||||
}
|
||||
|
||||
/// A medium input is exactly `input_height`, and sits taller than the
|
||||
/// medium button: native text fields are a touch taller than push buttons.
|
||||
/// The medium input renders at the theme's stated field height and the
|
||||
/// medium button at the stated control height; the two match wherever the
|
||||
/// platform states equal values (macOS, Windows, GNOME).
|
||||
#[gpui::test]
|
||||
fn medium_input_is_taller_than_the_button(cx: &mut TestAppContext) {
|
||||
fn controls_render_at_the_stated_heights(cx: &mut TestAppContext) {
|
||||
cx.update(Theme::init);
|
||||
let state = cx.update(|cx| InputState::new_with_text("", cx));
|
||||
let state_for_window = state.clone();
|
||||
@@ -58,9 +59,9 @@ fn medium_input_is_taller_than_the_button(cx: &mut TestAppContext) {
|
||||
.debug_bounds("input-wrapper")
|
||||
.expect("input rendered");
|
||||
|
||||
// The input's height is the theme table's (platform-stated) field height;
|
||||
// both bounds are snapped to device pixels, so allow half a pixel.
|
||||
// Both bounds are snapped to device pixels, so allow half a pixel.
|
||||
let input_height = cx.update(|cx| cx.theme().sizes.medium.input_height);
|
||||
assert!(input.size.height > button.size.height);
|
||||
let button_height = cx.update(|cx| cx.theme().sizes.medium.control_height);
|
||||
assert!((input.size.height - input_height).abs() <= gpui::px(0.5));
|
||||
assert!((button.size.height - button_height).abs() <= gpui::px(0.5));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user