diff --git a/crates/ui-widgets/src/controls/disclosure.rs b/crates/ui-widgets/src/controls/disclosure.rs index 8f306a17f..df527c57e 100644 --- a/crates/ui-widgets/src/controls/disclosure.rs +++ b/crates/ui-widgets/src/controls/disclosure.rs @@ -52,8 +52,8 @@ pub struct DisclosureGlyph { pub stroke: StrokeWidth, } -/// The arrow of a field or picker. -static DROPDOWN: DisclosureGlyph = DisclosureGlyph::dropdown_form(); +/// The arrow of a field or picker: the small filled triangle pointing down. +static DROPDOWN: DisclosureGlyph = DisclosureGlyph::new(1.0); /// The arrow of a button that opens a menu. static MENU_BUTTON: DisclosureGlyph = DisclosureGlyph { open: 1.0, form: ArrowForm::Dropdown, stroke: StrokeWidth::Medium }; /// The submenu arrow. diff --git a/crates/ui-widgets/tests/it/pickers/mod.rs b/crates/ui-widgets/tests/it/pickers/mod.rs index 8b2fd8a6b..fea80fa22 100644 --- a/crates/ui-widgets/tests/it/pickers/mod.rs +++ b/crates/ui-widgets/tests/it/pickers/mod.rs @@ -2,6 +2,7 @@ mod combo_list; mod date; +mod select_arrow; mod select_list; mod select_steps; mod select_width; diff --git a/crates/ui-widgets/tests/it/pickers/select_arrow.rs b/crates/ui-widgets/tests/it/pickers/select_arrow.rs new file mode 100644 index 000000000..72f86bbe0 --- /dev/null +++ b/crates/ui-widgets/tests/it/pickers/select_arrow.rs @@ -0,0 +1,25 @@ +//! The arrow of a select. + +use craft_ui::contract::{Bind, Entry, Show as _}; +use craft_ui::pickers::Select; +use craft_ui::testing::{Fixture, trial}; +use egui::Shape; + +/// A select's arrow is a small filled triangle pointing down, as in a document app's choice boxes, not a stroked chevron. +#[trial] +fn a_select_ends_in_a_filled_down_triangle() { + let rect = std::rc::Rc::new(std::cell::Cell::new(egui::Rect::NOTHING)); + let seen = rect.clone(); + let mut fixture = Fixture::new(move |ui| { + let entries = [Entry::new(0u8, "One"), Entry::new(1u8, "Two")]; + seen.set(Select::new("Pick", Bind::given(1u8), &entries).show(ui).response.rect); + }); + fixture.settle(); + let select = rect.get(); + let shapes = fixture.frame_shapes(); + let triangle = shapes.iter().any(|shape| match shape { + Shape::Path(path) => path.points.len() == 3 && path.fill != egui::Color32::TRANSPARENT && select.contains_rect(path.visual_bounding_rect()), + _ => false, + }); + assert!(triangle, "the select paints a filled triangle for its arrow"); +}