From c99beeed5b8016bfc96dd1d5ae4a89a7be7fecf3 Mon Sep 17 00:00:00 2001 From: Lewis Date: Mon, 11 May 2026 09:33:59 +0300 Subject: [PATCH] feat(ui): shaper thru framectx tests Lewis: May this revision serve well! --- clippy.toml | 4 +- .../bone-document/tests/folder_roundtrip.rs | 2 +- crates/bone-render/src/surface.rs | 2 +- crates/bone-ui/src/frame.rs | 47 +++++++++++++++++-- crates/bone-ui/src/gallery.rs | 12 ++++- crates/bone-ui/src/layout/tests.rs | 26 +++++----- crates/bone-ui/src/strings.rs | 26 +++++----- crates/bone-ui/src/text/raster/sdf.rs | 4 +- crates/bone-ui/src/widgets/button.rs | 14 ++++++ crates/bone-ui/src/widgets/checkbox.rs | 8 ++++ crates/bone-ui/src/widgets/dialog.rs | 10 ++++ .../bone-ui/src/widgets/dimensioned_input.rs | 4 ++ crates/bone-ui/src/widgets/dropdown.rs | 17 ++++++- crates/bone-ui/src/widgets/file_picker.rs | 4 ++ crates/bone-ui/src/widgets/hotkey_capture.rs | 4 ++ crates/bone-ui/src/widgets/menu.rs | 6 +++ crates/bone-ui/src/widgets/numeric_input.rs | 10 ++++ crates/bone-ui/src/widgets/panel.rs | 2 + crates/bone-ui/src/widgets/property_grid.rs | 12 ++++- crates/bone-ui/src/widgets/radio_group.rs | 12 +++++ crates/bone-ui/src/widgets/slider.rs | 6 +++ crates/bone-ui/src/widgets/status_bar.rs | 2 + crates/bone-ui/src/widgets/table.rs | 4 ++ crates/bone-ui/src/widgets/tabs.rs | 2 + crates/bone-ui/src/widgets/toast.rs | 2 + crates/bone-ui/src/widgets/toggle_button.rs | 10 ++++ crates/bone-ui/src/widgets/tooltip.rs | 14 +++--- crates/bone-ui/tests/dock_snapshot.rs | 6 +-- crates/bone-ui/tests/input_script_drive.rs | 2 + crates/bone-ui/tests/key_ordering.rs | 10 ++++ crates/bone-ui/tests/theme_snapshot.rs | 6 +-- 31 files changed, 240 insertions(+), 50 deletions(-) diff --git a/clippy.toml b/clippy.toml index 2171133..a2f89eb 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,4 +1,4 @@ disallowed-methods = [ - { path = "palette::rgb::Rgb::new", reason = "construct Color via theme tokens; raw palette colour bypasses the bone-ui::theme boundary" }, - { path = "palette::Oklch::new", reason = "construct Color via theme tokens; raw palette colour bypasses the bone-ui::theme boundary" }, + { path = "palette::rgb::Rgb::new", reason = "construct Color via theme tokens; raw palette color bypasses the bone-ui::theme boundary" }, + { path = "palette::Oklch::new", reason = "construct Color via theme tokens; raw palette color bypasses the bone-ui::theme boundary" }, ] diff --git a/crates/bone-document/tests/folder_roundtrip.rs b/crates/bone-document/tests/folder_roundtrip.rs index c41b81a..5553759 100644 --- a/crates/bone-document/tests/folder_roundtrip.rs +++ b/crates/bone-document/tests/folder_roundtrip.rs @@ -513,7 +513,7 @@ fn patch_header(path: &std::path::Path, f: impl FnOnce(&mut DocumentHeader)) { }; f(&mut header); let Ok(out) = to_string(&header) else { - panic!("serialise header"); + panic!("serialize header"); }; write_file(path, &out); } diff --git a/crates/bone-render/src/surface.rs b/crates/bone-render/src/surface.rs index 39dbfba..f7ccaf5 100644 --- a/crates/bone-render/src/surface.rs +++ b/crates/bone-render/src/surface.rs @@ -13,7 +13,7 @@ pub enum SurfaceError { #[error("wgpu device request failed: {0}")] Device(#[from] wgpu::RequestDeviceError), #[error( - "surface exposes no srgb colour format; baseline requires one. available: {available:?}" + "surface exposes no srgb color format; baseline requires one. available: {available:?}" )] NoSrgbFormat { available: Vec }, #[error("viewport dimension is zero")] diff --git a/crates/bone-ui/src/frame.rs b/crates/bone-ui/src/frame.rs index dcd7f96..8522d59 100644 --- a/crates/bone-ui/src/frame.rs +++ b/crates/bone-ui/src/frame.rs @@ -1,5 +1,7 @@ use std::sync::Arc; +use bone_text::Shaper; + use crate::a11y::{AccessNode, AccessTreeBuilder}; use crate::focus::FocusManager; use crate::hit_test::{HitFrame, HitItem, HitState, Interaction, Sense, ZLayer}; @@ -75,6 +77,7 @@ pub struct FrameCtx<'a> { pub hits: &'a mut HitFrame, pub previous: &'a HitState, pub a11y: &'a mut AccessTreeBuilder, + pub shaper: &'a mut Shaper, } impl<'a> FrameCtx<'a> { @@ -92,6 +95,7 @@ impl<'a> FrameCtx<'a> { hits: &'a mut HitFrame, previous: &'a HitState, a11y: &'a mut AccessTreeBuilder, + shaper: &'a mut Shaper, ) -> Self { focus.begin_frame(); focus.observe_input(input); @@ -105,6 +109,7 @@ impl<'a> FrameCtx<'a> { hits, previous, a11y, + shaper, } } @@ -128,6 +133,10 @@ impl<'a> FrameCtx<'a> { self.focus.focused() == Some(id) } + pub fn request_focus(&mut self, id: WidgetId) { + self.focus.request_focus(id); + } + pub fn interact(&mut self, declaration: InteractDeclaration) -> Interaction { if !declaration.disabled { self.focus.register_focusable(declaration.id); @@ -241,6 +250,7 @@ mod tests { let mut hits = HitFrame::new(); let prev = HitState::new(); let mut input = InputSnapshot::idle(FrameInstant::ZERO); + let mut shaper = bone_text::Shaper::new(); let mut a11y = AccessTreeBuilder::new(); { let mut frame = FrameCtx::new( @@ -252,6 +262,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let _ = frame.interact( InteractDeclaration::new(id("button"), rect(), Sense::INTERACTIVE).focusable(true), @@ -279,6 +290,7 @@ mod tests { let mut focus = FocusManager::new(); let mut hits = HitFrame::new(); let prev = HitState::new(); + let mut shaper = bone_text::Shaper::new(); let mut a11y = AccessTreeBuilder::new(); let actions = { let mut frame = FrameCtx::new( @@ -290,6 +302,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); frame.dispatch_hotkeys(&global_scope()) }; @@ -306,6 +319,7 @@ mod tests { let mut focus = FocusManager::new(); let mut hits = HitFrame::new(); let prev = HitState::new(); + let mut shaper = bone_text::Shaper::new(); let mut a11y = AccessTreeBuilder::new(); let actions = { let mut frame = FrameCtx::new( @@ -317,6 +331,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); frame.dispatch_hotkeys(&global_scope()) }; @@ -338,6 +353,7 @@ mod tests { ))); press.buttons_pressed = PointerButtonMask::just(PointerButton::Primary); + let mut shaper = bone_text::Shaper::new(); let mut a11y = AccessTreeBuilder::new(); { let mut frame = FrameCtx::new( @@ -349,6 +365,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); let _ = frame.interact( InteractDeclaration::new(id("btn"), rect(), Sense::INTERACTIVE).focusable(true), @@ -376,6 +393,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); let _ = frame.interact( InteractDeclaration::new(id("btn"), rect(), Sense::INTERACTIVE).focusable(true), @@ -396,6 +414,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); let _ = frame.interact( InteractDeclaration::new(id("btn"), rect(), Sense::INTERACTIVE).focusable(true), @@ -415,6 +434,7 @@ mod tests { let mut hits = HitFrame::new(); let prev = HitState::new(); let mut input = InputSnapshot::idle(FrameInstant::ZERO); + let mut shaper = bone_text::Shaper::new(); let mut a11y = AccessTreeBuilder::new(); let mut frame = FrameCtx::new( Arc::new(Theme::light()), @@ -425,6 +445,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); assert_eq!(frame.theme().mode, ThemeMode::Light); let inner_mode = frame.theme_scope(|_| Theme::dark(), |frame| frame.theme().mode); @@ -439,6 +460,7 @@ mod tests { let mut hits = HitFrame::new(); let prev = HitState::new(); let mut input = InputSnapshot::idle(FrameInstant::ZERO); + let mut shaper = bone_text::Shaper::new(); let mut a11y = AccessTreeBuilder::new(); let mut frame = FrameCtx::new( Arc::new(Theme::light()), @@ -449,6 +471,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let modes = frame.theme_scope( |_| Theme::dark(), @@ -470,6 +493,7 @@ mod tests { let mut hits = HitFrame::new(); let prev = HitState::new(); let mut input = InputSnapshot::idle(FrameInstant::ZERO); + let mut shaper = bone_text::Shaper::new(); let mut a11y = AccessTreeBuilder::new(); let mut frame = FrameCtx::new( Arc::new(Theme::light()), @@ -480,6 +504,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let outer_accent = frame.theme().colors.accent_solid(); let outer_ring = frame.theme().colors.focus_ring(); @@ -512,8 +537,11 @@ mod tests { focus: &mut FocusManager, hits: &mut HitFrame, input: &mut InputSnapshot, - a11y: &mut AccessTreeBuilder| { - let frame = FrameCtx::new(theme, input, focus, &hotkeys, strings, hits, &prev, a11y); + a11y: &mut AccessTreeBuilder, + shaper: &mut bone_text::Shaper| { + let frame = FrameCtx::new( + theme, input, focus, &hotkeys, strings, hits, &prev, a11y, shaper, + ); ( frame.theme().mode, frame.theme().colors.text_primary(), @@ -523,6 +551,7 @@ mod tests { let mut hits_a = HitFrame::new(); let mut input_a = InputSnapshot::idle(FrameInstant::ZERO); + let mut shaper_a = bone_text::Shaper::new(); let mut a11y_a = AccessTreeBuilder::new(); let (mode_a, text_a, surface_a) = read_tokens( Arc::new(Theme::light()), @@ -530,10 +559,12 @@ mod tests { &mut hits_a, &mut input_a, &mut a11y_a, + &mut shaper_a, ); let mut hits_b = HitFrame::new(); let mut input_b = InputSnapshot::idle(FrameInstant::ZERO); + let mut shaper_b = bone_text::Shaper::new(); let mut a11y_b = AccessTreeBuilder::new(); let (mode_b, text_b, surface_b) = read_tokens( Arc::new(Theme::dark()), @@ -541,6 +572,7 @@ mod tests { &mut hits_b, &mut input_b, &mut a11y_b, + &mut shaper_b, ); assert_eq!(mode_a, ThemeMode::Light); @@ -560,9 +592,18 @@ mod tests { let prev = HitState::new(); let mut input = InputSnapshot::idle(FrameInstant::ZERO); let strings = StringTable::for_locale(Locale::ArXb); + let mut shaper = bone_text::Shaper::new(); let mut a11y = AccessTreeBuilder::new(); let frame = FrameCtx::new( - theme, &mut input, &mut focus, &hotkeys, &strings, &mut hits, &prev, &mut a11y, + theme, + &mut input, + &mut focus, + &hotkeys, + &strings, + &mut hits, + &prev, + &mut a11y, + &mut shaper, ); assert_eq!(frame.locale(), Locale::ArXb); assert_eq!(frame.direction(), LayoutDirection::Rtl); diff --git a/crates/bone-ui/src/gallery.rs b/crates/bone-ui/src/gallery.rs index 60b514c..68dd2cf 100644 --- a/crates/bone-ui/src/gallery.rs +++ b/crates/bone-ui/src/gallery.rs @@ -369,9 +369,18 @@ pub fn render_with( let prev = prev_hit_state(); let mut input = InputSnapshot::idle(GALLERY_FRAME_NOW); let mut paint = Vec::new(); + let mut shaper = bone_text::Shaper::new(); let mut ctx = FrameCtx::new( - theme, &mut input, focus, &table, strings, &mut hits, &prev, a11y, + theme, + &mut input, + focus, + &table, + strings, + &mut hits, + &prev, + a11y, + &mut shaper, ); render_basics(&mut ctx, state, &mut paint); render_inputs(&mut ctx, state, &mut paint); @@ -726,6 +735,7 @@ fn render_chrome(ctx: &mut FrameCtx<'_>, state: &mut GalleryState, paint: &mut V label: GALLERY_LABEL, items: ribbon_toolbar_items.to_vec(), icon_size: RibbonIconSize::Large, + min_width: LayoutPx::new(80.0), width: LayoutPx::new(140.0), }], )]; diff --git a/crates/bone-ui/src/layout/tests.rs b/crates/bone-ui/src/layout/tests.rs index 2173197..9a4d50e 100644 --- a/crates/bone-ui/src/layout/tests.rs +++ b/crates/bone-ui/src/layout/tests.rs @@ -93,7 +93,7 @@ fn row_with_gap_distributes_children_along_main_axis() { } #[test] -fn row_justify_center_centres_content() { +fn row_justify_center_centers_content() { let layout = Layout::Row { gap: sp(0.0), justify: MainAxisJustify::Center, @@ -106,7 +106,7 @@ fn row_justify_center_centres_content() { let right = 100.0 - only.rect.max_x().value(); assert!( (left - right).abs() < 1.0, - "centred: left={left} right={right}" + "centered: left={left} right={right}" ); } @@ -969,17 +969,17 @@ fn retained_layout_round_trips_through_ron() { ScrollOffset::new(LayoutPx::new(4.0), LayoutPx::new(8.0)), ); original.set_split(wid(2), SplitFraction::clamped(0.42)); - let Ok(serialised) = ron::ser::to_string(&original) else { - panic!("retained layout serialise failed"); + let Ok(serialized) = ron::ser::to_string(&original) else { + panic!("retained layout serialize failed"); }; - let Ok(parsed) = ron::de::from_str::(&serialised) else { - panic!("retained layout deserialise failed"); + let Ok(parsed) = ron::de::from_str::(&serialized) else { + panic!("retained layout deserialize failed"); }; assert_eq!(original, parsed); } #[test] -fn retained_layout_serialises_deterministically_regardless_of_insertion_order() { +fn retained_layout_serializes_deterministically_regardless_of_insertion_order() { let entries = (1u8..=10) .map(|n| { ( @@ -998,10 +998,10 @@ fn retained_layout_serialises_deterministically_regardless_of_insertion_order() .rev() .fold((), |(), (id, off)| backward.set_scroll(*id, *off)); let Ok(forward_ron) = ron::ser::to_string(&forward) else { - panic!("forward serialise failed"); + panic!("forward serialize failed"); }; let Ok(reverse_ron) = ron::ser::to_string(&backward) else { - panic!("backward serialise failed"); + panic!("backward serialize failed"); }; assert_eq!(forward_ron, reverse_ron); } @@ -1156,11 +1156,11 @@ fn dock_state_round_trip_preserves_floating_surfaces() { size: LayoutSize::new(LayoutPx::new(640.0), LayoutPx::new(480.0)), }], }; - let Ok(serialised) = ron::ser::to_string(&original) else { - panic!("dock state serialise failed"); + let Ok(serialized) = ron::ser::to_string(&original) else { + panic!("dock state serialize failed"); }; - let Ok(parsed) = ron::de::from_str::(&serialised) else { - panic!("dock state deserialise failed"); + let Ok(parsed) = ron::de::from_str::(&serialized) else { + panic!("dock state deserialize failed"); }; assert_eq!(parsed, original); assert_eq!(parsed.floating.len(), 1); diff --git a/crates/bone-ui/src/strings.rs b/crates/bone-ui/src/strings.rs index d528e54..0d4bfc0 100644 --- a/crates/bone-ui/src/strings.rs +++ b/crates/bone-ui/src/strings.rs @@ -30,17 +30,17 @@ impl fmt::Display for StringKey { #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize)] pub enum Locale { - EnGb, + EnUs, ArXb, } impl Locale { - pub const DEFAULT: Self = Self::EnGb; + pub const DEFAULT: Self = Self::EnUs; #[must_use] pub const fn as_bcp47(self) -> &'static str { match self { - Self::EnGb => "en-GB", + Self::EnUs => "en-US", Self::ArXb => "ar-XB", } } @@ -48,7 +48,7 @@ impl Locale { #[must_use] pub const fn direction(self) -> LayoutDirection { match self { - Self::EnGb => LayoutDirection::Ltr, + Self::EnUs => LayoutDirection::Ltr, Self::ArXb => LayoutDirection::Rtl, } } @@ -56,7 +56,7 @@ impl Locale { #[must_use] pub const fn plural_category(self, n: u64) -> PluralCategory { match self { - Self::EnGb => english_plural(n), + Self::EnUs => english_plural(n), Self::ArXb => arabic_plural(n), } } @@ -222,7 +222,7 @@ impl StringTable { #[must_use] pub fn format_count(&self, n: u64) -> String { match self.locale { - Locale::EnGb => group_thousands(n, ','), + Locale::EnUs => group_thousands(n, ','), Locale::ArXb => group_thousands(n, '\u{066C}') .chars() .map(map_arabic_indic) @@ -341,9 +341,9 @@ mod tests { } #[test] - fn default_locale_is_en_gb_ltr() { + fn default_locale_is_en_us_ltr() { let table = StringTable::new(); - assert_eq!(table.locale(), Locale::EnGb); + assert_eq!(table.locale(), Locale::EnUs); assert_eq!(table.direction(), LayoutDirection::Ltr); } @@ -356,10 +356,10 @@ mod tests { #[test] fn english_plural_picks_one_or_other() { - assert_eq!(Locale::EnGb.plural_category(0), PluralCategory::Other); - assert_eq!(Locale::EnGb.plural_category(1), PluralCategory::One); - assert_eq!(Locale::EnGb.plural_category(2), PluralCategory::Other); - assert_eq!(Locale::EnGb.plural_category(42), PluralCategory::Other); + assert_eq!(Locale::EnUs.plural_category(0), PluralCategory::Other); + assert_eq!(Locale::EnUs.plural_category(1), PluralCategory::One); + assert_eq!(Locale::EnUs.plural_category(2), PluralCategory::Other); + assert_eq!(Locale::EnUs.plural_category(42), PluralCategory::Other); } #[test] @@ -419,7 +419,7 @@ mod tests { #[test] fn english_number_formatting_groups_with_comma() { - let table = StringTable::for_locale(Locale::EnGb); + let table = StringTable::for_locale(Locale::EnUs); assert_eq!(table.format_count(0), "0"); assert_eq!(table.format_count(42), "42"); assert_eq!(table.format_count(1234), "1,234"); diff --git a/crates/bone-ui/src/text/raster/sdf.rs b/crates/bone-ui/src/text/raster/sdf.rs index bcec6d0..a66152f 100644 --- a/crates/bone-ui/src/text/raster/sdf.rs +++ b/crates/bone-ui/src/text/raster/sdf.rs @@ -654,7 +654,7 @@ mod tests { } #[test] - fn donut_glyph_centre_stays_outside() { + fn donut_glyph_center_stays_outside() { let mut atlas = SdfAtlas::new(small_params()); let key = GlyphAtlasKey::new(FontFace::Sans, glyph_for(FontFace::Sans, 'O')); let entry = ensure_ok(&mut atlas, key); @@ -664,7 +664,7 @@ mod tests { let value = atlas.pixels()[(cy as usize) * (extent as usize) + cx as usize]; assert!( !SdfPixel(value).is_inside(), - "centre of O lies inside the donut hole, must be outside fill, raw={value}", + "center of O lies inside the donut hole, must be outside fill, raw={value}", ); } diff --git a/crates/bone-ui/src/widgets/button.rs b/crates/bone-ui/src/widgets/button.rs index 310c8f4..f938a15 100644 --- a/crates/bone-ui/src/widgets/button.rs +++ b/crates/bone-ui/src/widgets/button.rs @@ -318,6 +318,7 @@ mod tests { activations: &mut Vec| { hits.clear(); { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -328,6 +329,7 @@ mod tests { hits, state, &mut a11y, + &mut shaper, ); let response = show_button(&mut ctx, button); activations.push(response.activated); @@ -418,6 +420,7 @@ mod tests { )]); let button = Button::new(id("ok"), rect(), LABEL, ButtonVariant::Primary); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -428,6 +431,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_button(&mut ctx, button) }; @@ -447,6 +451,7 @@ mod tests { )]); let button = Button::new(id("ok"), rect(), LABEL, ButtonVariant::Primary); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -457,6 +462,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_button(&mut ctx, button) }; @@ -475,6 +481,7 @@ mod tests { input.keys_pressed.push(event); let button = Button::new(id("ok"), rect(), LABEL, ButtonVariant::Primary); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -485,6 +492,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_button(&mut ctx, button) }; @@ -511,6 +519,7 @@ mod tests { let (mut input, mut focus) = focused_input_with(vec![other]); let button = Button::new(id("ok"), rect(), LABEL, ButtonVariant::Primary); let _ = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -521,6 +530,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_button(&mut ctx, button) }; @@ -565,6 +575,7 @@ mod tests { let (mut input, mut focus) = focused_input_with(vec![tab]); let button = Button::new(id("ok"), rect(), LABEL, ButtonVariant::Primary); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -575,6 +586,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_button(&mut ctx, button) }; @@ -600,6 +612,7 @@ mod tests { focus.end_frame(); let button = Button::new(id("ok"), rect(), LABEL, ButtonVariant::Primary); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -610,6 +623,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_button(&mut ctx, button) }; diff --git a/crates/bone-ui/src/widgets/checkbox.rs b/crates/bone-ui/src/widgets/checkbox.rs index 5ba3738..79ecd0a 100644 --- a/crates/bone-ui/src/widgets/checkbox.rs +++ b/crates/bone-ui/src/widgets/checkbox.rs @@ -199,6 +199,7 @@ mod tests { )); let checkbox = Checkbox::new(id_widget(), rect(), LABEL, CheckboxState::Unchecked); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -209,6 +210,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_checkbox(&mut ctx, checkbox) }; @@ -230,6 +232,7 @@ mod tests { hits.clear(); let checkbox = Checkbox::new(id_widget(), rect(), LABEL, current); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -240,6 +243,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_checkbox(&mut ctx, checkbox) }; @@ -259,6 +263,7 @@ mod tests { let mut input = InputSnapshot::idle(FrameInstant::ZERO); let checkbox = Checkbox::new(id_widget(), rect(), LABEL, CheckboxState::Indeterminate); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -269,6 +274,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_checkbox(&mut ctx, checkbox) }; @@ -300,6 +306,7 @@ mod tests { let checkbox = Checkbox::new(id_widget(), rect(), LABEL, CheckboxState::Unchecked).disabled(true); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -310,6 +317,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_checkbox(&mut ctx, checkbox) }; diff --git a/crates/bone-ui/src/widgets/dialog.rs b/crates/bone-ui/src/widgets/dialog.rs index af53cbf..a3216ae 100644 --- a/crates/bone-ui/src/widgets/dialog.rs +++ b/crates/bone-ui/src/widgets/dialog.rs @@ -461,6 +461,7 @@ mod tests { let table = HotkeyTable::new(); let mut hits = HitFrame::new(); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -471,6 +472,7 @@ mod tests { &mut hits, prev, &mut a11y, + &mut shaper, ); let (response, ()) = show_dialog( &mut ctx, @@ -502,6 +504,7 @@ mod tests { ModifierMask::NONE, )); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -512,6 +515,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let (response, ()) = show_modal( &mut ctx, @@ -548,6 +552,7 @@ mod tests { let prev = HitState::new(); let mut snap = InputSnapshot::idle(FrameInstant::ZERO); { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -558,6 +563,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let (_response, ()) = show_modal( &mut ctx, @@ -611,6 +617,7 @@ mod tests { let table = HotkeyTable::new(); let mut hits = HitFrame::new(); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -621,6 +628,7 @@ mod tests { &mut hits, prev, &mut a11y, + &mut shaper, ); show_confirmation( &mut ctx, @@ -700,6 +708,7 @@ mod tests { .for_each(|mut snap| { let mut hits = HitFrame::new(); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -710,6 +719,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); show_confirmation( &mut ctx, diff --git a/crates/bone-ui/src/widgets/dimensioned_input.rs b/crates/bone-ui/src/widgets/dimensioned_input.rs index 9571a83..74a262b 100644 --- a/crates/bone-ui/src/widgets/dimensioned_input.rs +++ b/crates/bone-ui/src/widgets/dimensioned_input.rs @@ -157,6 +157,7 @@ mod tests { let mut input = InputSnapshot::idle(FrameInstant::ZERO); let mut clipboard = MemoryClipboard::default(); let widget = DimensionedInput::::new(id_widget(), rect(), PLACEHOLDER, &mut state); + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -167,6 +168,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); show_parsed_input(&mut ctx, widget, &mut clipboard) } @@ -184,6 +186,7 @@ mod tests { let mut input = InputSnapshot::idle(FrameInstant::ZERO); let mut clipboard = MemoryClipboard::default(); let widget = DimensionedInput::::new(id_widget(), rect(), PLACEHOLDER, &mut state); + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -194,6 +197,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); show_parsed_input(&mut ctx, widget, &mut clipboard) } diff --git a/crates/bone-ui/src/widgets/dropdown.rs b/crates/bone-ui/src/widgets/dropdown.rs index 3245e1e..cf137d3 100644 --- a/crates/bone-ui/src/widgets/dropdown.rs +++ b/crates/bone-ui/src/widgets/dropdown.rs @@ -676,6 +676,7 @@ mod tests { state, ); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -686,6 +687,7 @@ mod tests { &mut hits, prev, &mut a11y, + &mut shaper, ); show_dropdown(&mut ctx, widget) }; @@ -925,9 +927,18 @@ mod tests { PLACEHOLDER, state, ); + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( - theme, snap, focus, &table, strings, &mut hits, prev, &mut a11y, + theme, + snap, + focus, + &table, + strings, + &mut hits, + prev, + &mut a11y, + &mut shaper, ); show_dropdown(&mut ctx, widget) } @@ -1173,6 +1184,7 @@ mod tests { ) .disabled(true); let _ = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -1183,6 +1195,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); show_dropdown(&mut ctx, widget) }; @@ -1214,6 +1227,7 @@ mod tests { ); let sibling_id = WidgetId::ROOT.child(WidgetKey::new("sibling_under_popup")); { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -1224,6 +1238,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let _ = show_dropdown(&mut ctx, widget); let _ = ctx.interact(InteractDeclaration::new( diff --git a/crates/bone-ui/src/widgets/file_picker.rs b/crates/bone-ui/src/widgets/file_picker.rs index 035ec8f..0436b8b 100644 --- a/crates/bone-ui/src/widgets/file_picker.rs +++ b/crates/bone-ui/src/widgets/file_picker.rs @@ -285,6 +285,7 @@ mod tests { ModifierMask::NONE, )); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -295,6 +296,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); show_file_picker( &mut ctx, @@ -323,6 +325,7 @@ mod tests { let prev = HitState::new(); let mut snap = InputSnapshot::idle(FrameInstant::ZERO); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -333,6 +336,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); show_file_picker( &mut ctx, diff --git a/crates/bone-ui/src/widgets/hotkey_capture.rs b/crates/bone-ui/src/widgets/hotkey_capture.rs index c97b008..191736e 100644 --- a/crates/bone-ui/src/widgets/hotkey_capture.rs +++ b/crates/bone-ui/src/widgets/hotkey_capture.rs @@ -232,6 +232,7 @@ mod tests { let mut hits = HitFrame::new(); let prev = HitState::new(); let widget = HotkeyCapture::new(id_widget(), rect(), PLACEHOLDER, state); + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -242,6 +243,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); show_hotkey_capture(&mut ctx, widget) } @@ -470,6 +472,7 @@ mod tests { let mut hits = HitFrame::new(); let widget = HotkeyCapture::new(id_widget(), rect(), PLACEHOLDER, &mut state); { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -480,6 +483,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let _ = show_hotkey_capture(&mut ctx, widget); } diff --git a/crates/bone-ui/src/widgets/menu.rs b/crates/bone-ui/src/widgets/menu.rs index 051188c..7ced2a7 100644 --- a/crates/bone-ui/src/widgets/menu.rs +++ b/crates/bone-ui/src/widgets/menu.rs @@ -901,6 +901,7 @@ mod tests { let table = HotkeyTable::new(); let mut hits = HitFrame::new(); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -911,6 +912,7 @@ mod tests { &mut hits, prev, &mut a11y, + &mut shaper, ); show_menu( &mut ctx, @@ -1083,6 +1085,7 @@ mod tests { .for_each(|mut snap| { let mut hits = HitFrame::new(); { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -1093,6 +1096,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let _ = show_menu_bar( &mut ctx, @@ -1137,6 +1141,7 @@ mod tests { .into_iter() .for_each(|mut snap| { let mut hits = HitFrame::new(); + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -1147,6 +1152,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let _ = show_menu_bar( &mut ctx, diff --git a/crates/bone-ui/src/widgets/numeric_input.rs b/crates/bone-ui/src/widgets/numeric_input.rs index 8ac58ff..2f3f709 100644 --- a/crates/bone-ui/src/widgets/numeric_input.rs +++ b/crates/bone-ui/src/widgets/numeric_input.rs @@ -94,6 +94,7 @@ mod tests { input.text_committed = String::new(); let mut clipboard = MemoryClipboard::default(); let widget = NumericInput::::new(id_widget(), rect(), PLACEHOLDER, state); + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -104,6 +105,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); show_parsed_input(&mut ctx, widget, &mut clipboard) } @@ -215,6 +217,7 @@ mod tests { let mut clipboard = MemoryClipboard::default(); let widget = NumericInput::::new(id_widget(), rect(), PLACEHOLDER, &mut state); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -225,6 +228,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); show_parsed_input(&mut ctx, widget, &mut clipboard) }; @@ -244,6 +248,7 @@ mod tests { let mut input = InputSnapshot::idle(FrameInstant::ZERO); let mut clipboard = MemoryClipboard::default(); let widget = NumericInput::::new(id_widget(), rect(), PLACEHOLDER, &mut state); + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -254,6 +259,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let response = show_parsed_input(&mut ctx, widget, &mut clipboard); assert_eq!(response.committed, Some(42)); @@ -280,6 +286,7 @@ mod tests { let prev = HitState::new(); let mut input = InputSnapshot::idle(FrameInstant::ZERO); let widget = NumericInput::::new(id_widget(), rect(), PLACEHOLDER, &mut state); + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -290,6 +297,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let response = show_parsed_input(&mut ctx, widget, &mut clipboard); assert!( @@ -303,6 +311,7 @@ mod tests { let prev = HitState::new(); let mut input = InputSnapshot::idle(FrameInstant::ZERO); let widget = NumericInput::::new(id_widget(), rect(), PLACEHOLDER, &mut state); + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -313,6 +322,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let response = show_parsed_input(&mut ctx, widget, &mut clipboard); assert_eq!( diff --git a/crates/bone-ui/src/widgets/panel.rs b/crates/bone-ui/src/widgets/panel.rs index 5508656..8100c3f 100644 --- a/crates/bone-ui/src/widgets/panel.rs +++ b/crates/bone-ui/src/widgets/panel.rs @@ -292,6 +292,7 @@ mod tests { let table = HotkeyTable::new(); let mut hits = HitFrame::new(); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -302,6 +303,7 @@ mod tests { &mut hits, prev, &mut a11y, + &mut shaper, ); let mut p = Panel::new(panel_id(), panel_rect(), state).variant(PanelVariant::Card); if let Some(t) = bar { diff --git a/crates/bone-ui/src/widgets/property_grid.rs b/crates/bone-ui/src/widgets/property_grid.rs index aeaebe8..d7f5eee 100644 --- a/crates/bone-ui/src/widgets/property_grid.rs +++ b/crates/bone-ui/src/widgets/property_grid.rs @@ -224,7 +224,7 @@ impl PropertyEditor for BoolEditor { } } -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq)] pub struct TextEditor { pub value: String, pub buffer: TextInputState, @@ -507,6 +507,7 @@ mod tests { .for_each(|mut snap| { let mut hits = HitFrame::new(); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -517,6 +518,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let mut rows = [PropertyRow { id: row_id, @@ -557,6 +559,7 @@ mod tests { let table = HotkeyTable::new(); let mut hits = HitFrame::new(); { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -567,6 +570,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let mut rows = [PropertyRow { id: row_id, @@ -584,6 +588,7 @@ mod tests { let mut snap = InputSnapshot::idle(FrameInstant::ZERO); let mut hits = HitFrame::new(); { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -594,6 +599,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let mut rows = [PropertyRow { id: row_id, @@ -628,6 +634,7 @@ mod tests { bool_b: &mut BoolEditor, mut snap: InputSnapshot| { let mut hits = HitFrame::new(); + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -638,6 +645,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let mut rows = [ PropertyRow { @@ -705,6 +713,7 @@ mod tests { let table = HotkeyTable::new(); let mut hits = HitFrame::new(); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -715,6 +724,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); let mut rows = [ PropertyRow { diff --git a/crates/bone-ui/src/widgets/radio_group.rs b/crates/bone-ui/src/widgets/radio_group.rs index 18d123b..e52a34a 100644 --- a/crates/bone-ui/src/widgets/radio_group.rs +++ b/crates/bone-ui/src/widgets/radio_group.rs @@ -305,6 +305,7 @@ mod tests { hits.clear(); let group = RadioGroup::new(three_options(), selected); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -315,6 +316,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_radio_group(&mut ctx, group) }; @@ -349,6 +351,7 @@ mod tests { input.keys_pressed = events; let group = RadioGroup::new(options, selected).orientation(orientation); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -359,6 +362,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); show_radio_group(&mut ctx, group) }; @@ -522,6 +526,7 @@ mod tests { let first_id = two[0].id; let group = RadioGroup::new(two, Pick::C); { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -532,6 +537,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); let _ = show_radio_group(&mut ctx, group); } @@ -553,6 +559,7 @@ mod tests { let options = three_options(); let group = RadioGroup::new(options.clone(), Pick::B); { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -563,6 +570,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); let _ = show_radio_group(&mut ctx, group); } @@ -587,6 +595,7 @@ mod tests { input.keys_pressed = vec![arrow, space]; let group = RadioGroup::new(three_options(), Pick::A); { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -597,6 +606,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); let _ = show_radio_group(&mut ctx, group); } @@ -621,6 +631,7 @@ mod tests { hits.clear(); let group = RadioGroup::new(three_options(), selected).disabled(true); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -631,6 +642,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_radio_group(&mut ctx, group) }; diff --git a/crates/bone-ui/src/widgets/slider.rs b/crates/bone-ui/src/widgets/slider.rs index 156b72d..7ae04e2 100644 --- a/crates/bone-ui/src/widgets/slider.rs +++ b/crates/bone-ui/src/widgets/slider.rs @@ -541,6 +541,7 @@ mod tests { let mut input = InputSnapshot::idle(FrameInstant::ZERO); input.keys_pressed = events; let widget = Slider::new(slider_id(), rect(), LABEL, value, unit_range(), unit_step()); + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -551,6 +552,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); show_slider(&mut ctx, widget) } @@ -737,6 +739,7 @@ mod tests { let mut hits = HitFrame::new(); let response = { let widget = Slider::new(slider_id(), rect(), LABEL, value, unit_range(), step); + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -747,6 +750,7 @@ mod tests { &mut hits, &prev_state, &mut a11y, + &mut shaper, ); show_slider(&mut ctx, widget) }; @@ -865,6 +869,7 @@ mod tests { let mut input = InputSnapshot::idle(FrameInstant::ZERO); input.keys_pressed = events; let widget = Slider::new(slider_id(), rect(), LABEL, value, unit_range(), step); + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -875,6 +880,7 @@ mod tests { &mut hits, &prev, &mut a11y, + &mut shaper, ); show_slider(&mut ctx, widget) } diff --git a/crates/bone-ui/src/widgets/status_bar.rs b/crates/bone-ui/src/widgets/status_bar.rs index 4d12d69..60421c0 100644 --- a/crates/bone-ui/src/widgets/status_bar.rs +++ b/crates/bone-ui/src/widgets/status_bar.rs @@ -332,6 +332,7 @@ mod tests { let table = HotkeyTable::new(); let mut hits = HitFrame::new(); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -342,6 +343,7 @@ mod tests { &mut hits, prev, &mut a11y, + &mut shaper, ); show_status_bar( &mut ctx, diff --git a/crates/bone-ui/src/widgets/table.rs b/crates/bone-ui/src/widgets/table.rs index 26deba5..9053cb8 100644 --- a/crates/bone-ui/src/widgets/table.rs +++ b/crates/bone-ui/src/widgets/table.rs @@ -787,6 +787,7 @@ mod tests { LayoutSize::new(LayoutPx::new(200.0), LayoutPx::new(400.0)), ); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -797,6 +798,7 @@ mod tests { &mut hits, prev, &mut a11y, + &mut shaper, ); show_list_view( &mut ctx, @@ -934,6 +936,7 @@ mod tests { LayoutSize::new(LayoutPx::new(220.0), LayoutPx::new(200.0)), ); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -944,6 +947,7 @@ mod tests { &mut hits, prev, &mut a11y, + &mut shaper, ); show_table( &mut ctx, diff --git a/crates/bone-ui/src/widgets/tabs.rs b/crates/bone-ui/src/widgets/tabs.rs index e463efc..2b85255 100644 --- a/crates/bone-ui/src/widgets/tabs.rs +++ b/crates/bone-ui/src/widgets/tabs.rs @@ -407,6 +407,7 @@ mod tests { let table = HotkeyTable::new(); let mut hits = HitFrame::new(); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -417,6 +418,7 @@ mod tests { &mut hits, prev, &mut a11y, + &mut shaper, ); show_tabs( &mut ctx, diff --git a/crates/bone-ui/src/widgets/toast.rs b/crates/bone-ui/src/widgets/toast.rs index 3969b2c..3ca906f 100644 --- a/crates/bone-ui/src/widgets/toast.rs +++ b/crates/bone-ui/src/widgets/toast.rs @@ -328,6 +328,7 @@ mod tests { let table = HotkeyTable::new(); let mut hits = HitFrame::new(); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -338,6 +339,7 @@ mod tests { &mut hits, prev, &mut a11y, + &mut shaper, ); show_toast( &mut ctx, diff --git a/crates/bone-ui/src/widgets/toggle_button.rs b/crates/bone-ui/src/widgets/toggle_button.rs index 55e1671..f89faf2 100644 --- a/crates/bone-ui/src/widgets/toggle_button.rs +++ b/crates/bone-ui/src/widgets/toggle_button.rs @@ -141,6 +141,7 @@ mod tests { hits.clear(); let toggle = ToggleButton::new(id_widget(), rect(), LABEL, *on); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -151,6 +152,7 @@ mod tests { hits, state, &mut a11y, + &mut shaper, ); show_toggle_button(&mut ctx, toggle) }; @@ -234,6 +236,7 @@ mod tests { )); let toggle = ToggleButton::new(id_widget(), rect(), LABEL, false); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -244,6 +247,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_toggle_button(&mut ctx, toggle) }; @@ -269,6 +273,7 @@ mod tests { .map(|mut snap| { hits.clear(); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -279,6 +284,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_toggle_button(&mut ctx, toggle) }; @@ -335,6 +341,7 @@ mod tests { let mut input = InputSnapshot::idle(FrameInstant::ZERO); let toggle = ToggleButton::new(id_widget(), rect(), LABEL, true); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -345,6 +352,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_toggle_button(&mut ctx, toggle) }; @@ -361,6 +369,7 @@ mod tests { )); let toggle = ToggleButton::new(id_widget(), rect(), LABEL, false); let response = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme.clone(), @@ -371,6 +380,7 @@ mod tests { &mut hits, &state, &mut a11y, + &mut shaper, ); show_toggle_button(&mut ctx, toggle) }; diff --git a/crates/bone-ui/src/widgets/tooltip.rs b/crates/bone-ui/src/widgets/tooltip.rs index 6d0fd07..0116701 100644 --- a/crates/bone-ui/src/widgets/tooltip.rs +++ b/crates/bone-ui/src/widgets/tooltip.rs @@ -124,26 +124,26 @@ fn popup_rect( gap: LayoutPx, size: LayoutSize, ) -> LayoutRect { - let centred_x = + let centered_x = anchor.origin.x.value() + anchor.size.width.value() / 2.0 - size.width.value() / 2.0; - let centred_y = + let centered_y = anchor.origin.y.value() + anchor.size.height.value() / 2.0 - size.height.value() / 2.0; let origin = match placement { TooltipPlacement::Below => LayoutPos::new( - LayoutPx::new(centred_x), + LayoutPx::new(centered_x), LayoutPx::new(anchor.origin.y.value() + anchor.size.height.value() + gap.value()), ), TooltipPlacement::Above => LayoutPos::new( - LayoutPx::new(centred_x), + LayoutPx::new(centered_x), LayoutPx::new(anchor.origin.y.value() - size.height.value() - gap.value()), ), TooltipPlacement::Right => LayoutPos::new( LayoutPx::new(anchor.origin.x.value() + anchor.size.width.value() + gap.value()), - LayoutPx::new(centred_y), + LayoutPx::new(centered_y), ), TooltipPlacement::Left => LayoutPos::new( LayoutPx::new(anchor.origin.x.value() - size.width.value() - gap.value()), - LayoutPx::new(centred_y), + LayoutPx::new(centered_y), ), }; LayoutRect::new(origin, size) @@ -201,6 +201,7 @@ mod tests { let table = HotkeyTable::new(); let mut hits = HitFrame::new(); let mut input = InputSnapshot::idle(frame); + let mut shaper = bone_text::Shaper::new(); let mut a11y = crate::a11y::AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -211,6 +212,7 @@ mod tests { &mut hits, prev, &mut a11y, + &mut shaper, ); show_tooltip(&mut ctx, tooltip, state) } diff --git a/crates/bone-ui/tests/dock_snapshot.rs b/crates/bone-ui/tests/dock_snapshot.rs index 865b7d1..4256de4 100644 --- a/crates/bone-ui/tests/dock_snapshot.rs +++ b/crates/bone-ui/tests/dock_snapshot.rs @@ -23,13 +23,13 @@ fn solidworks_default_dock_layout_snapshot() { fn solidworks_default_dock_round_trip_is_stable() { let original = solidworks_default(); let Ok(first) = ron::ser::to_string(&original) else { - panic!("first serialise failed"); + panic!("first serialize failed"); }; let Ok(parsed) = ron::de::from_str::(&first) else { - panic!("deserialise failed"); + panic!("deserialize failed"); }; let Ok(second) = ron::ser::to_string(&parsed) else { - panic!("second serialise failed"); + panic!("second serialize failed"); }; assert_eq!(first, second); assert_eq!(original, parsed); diff --git a/crates/bone-ui/tests/input_script_drive.rs b/crates/bone-ui/tests/input_script_drive.rs index e812e4f..5d1221a 100644 --- a/crates/bone-ui/tests/input_script_drive.rs +++ b/crates/bone-ui/tests/input_script_drive.rs @@ -33,6 +33,7 @@ fn run( let theme = Arc::new(Theme::light()); let table = HotkeyTable::new(); let mut hits = HitFrame::new(); + let mut shaper = bone_text::Shaper::new(); let mut a11y = AccessTreeBuilder::new(); let response = { let mut ctx = FrameCtx::new( @@ -44,6 +45,7 @@ fn run( &mut hits, prev, &mut a11y, + &mut shaper, ); render(&mut ctx) }; diff --git a/crates/bone-ui/tests/key_ordering.rs b/crates/bone-ui/tests/key_ordering.rs index ebe0d60..adb333c 100644 --- a/crates/bone-ui/tests/key_ordering.rs +++ b/crates/bone-ui/tests/key_ordering.rs @@ -65,6 +65,7 @@ fn text_input_before_dispatch_eats_overlapping_editing_chord() { let scopes = HotkeyScopes::from_outer_to_inner([HotkeyScope::Global]); let actions = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -75,6 +76,7 @@ fn text_input_before_dispatch_eats_overlapping_editing_chord() { &mut hits, &prev, &mut a11y, + &mut shaper, ); let widget = TextInput { id: field_id(), @@ -117,6 +119,7 @@ fn dispatch_after_text_input_still_routes_unowned_chord() { let scopes = HotkeyScopes::from_outer_to_inner([HotkeyScope::Global]); let actions = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -127,6 +130,7 @@ fn dispatch_after_text_input_still_routes_unowned_chord() { &mut hits, &prev, &mut a11y, + &mut shaper, ); let widget = TextInput { id: field_id(), @@ -165,6 +169,7 @@ fn dispatch_first_breaks_text_editing_when_overlap_exists() { let scopes = HotkeyScopes::from_outer_to_inner([HotkeyScope::Global]); let (actions, selection_min, selection_max) = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -175,6 +180,7 @@ fn dispatch_first_breaks_text_editing_when_overlap_exists() { &mut hits, &prev, &mut a11y, + &mut shaper, ); let actions = ctx.dispatch_hotkeys(&scopes); let widget = TextInput { @@ -227,6 +233,7 @@ fn hotkey_capture_before_dispatch_claims_recordable_chord() { let scopes = HotkeyScopes::from_outer_to_inner([HotkeyScope::Global]); let (actions, captured) = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -237,6 +244,7 @@ fn hotkey_capture_before_dispatch_claims_recordable_chord() { &mut hits, &prev, &mut a11y, + &mut shaper, ); let widget = HotkeyCapture::new(field_id(), rect(), FIELD_LABEL, &mut state); let response = show_hotkey_capture(&mut ctx, widget); @@ -280,6 +288,7 @@ fn dispatch_before_hotkey_capture_steals_chord() { let scopes = HotkeyScopes::from_outer_to_inner([HotkeyScope::Global]); let (actions, captured) = { + let mut shaper = bone_text::Shaper::new(); let mut a11y = AccessTreeBuilder::new(); let mut ctx = FrameCtx::new( theme, @@ -290,6 +299,7 @@ fn dispatch_before_hotkey_capture_steals_chord() { &mut hits, &prev, &mut a11y, + &mut shaper, ); let actions = ctx.dispatch_hotkeys(&scopes); let widget = HotkeyCapture::new(field_id(), rect(), FIELD_LABEL, &mut state); diff --git a/crates/bone-ui/tests/theme_snapshot.rs b/crates/bone-ui/tests/theme_snapshot.rs index 2b87306..3b3677b 100644 --- a/crates/bone-ui/tests/theme_snapshot.rs +++ b/crates/bone-ui/tests/theme_snapshot.rs @@ -22,13 +22,13 @@ fn round_trip_dark_through_ron_is_stable() { fn assert_round_trip_stable(theme: &Theme) { let Ok(first) = ron::ser::to_string(theme) else { - panic!("first serialise failed"); + panic!("first serialize failed"); }; let Ok(parsed) = ron::de::from_str::(&first) else { - panic!("deserialise failed"); + panic!("deserialize failed"); }; let Ok(second) = ron::ser::to_string(&parsed) else { - panic!("second serialise failed"); + panic!("second serialize failed"); }; assert_eq!(first, second); } -- 2.51.2