diff --git a/crates/layers/src/ui/filter/stories.rs b/crates/layers/src/ui/filter/stories.rs index ad4c66eb5..dd3658e33 100644 --- a/crates/layers/src/ui/filter/stories.rs +++ b/crates/layers/src/ui/filter/stories.rs @@ -1,9 +1,7 @@ -//! Stories of `LayerFilterBar`: each filter type in one card, with the count of a document's layers it lets through; -//! and `LayersPanel` filtered by Artboard and by Group, which keep each group open or closed. +//! Stories of `LayerFilterBar`: each filter type in one card, with the count of a document's layers it lets through. use super::{EffectKind, FilterBy, FilterKind, LayerAttribute, LayerFilter, LayerFilterBar, SmartKind}; use crate::ui::mock::FakeLayers; -use crate::ui::panel::LayersPanel; use crate::ui::tree::LayerTree as _; use craft_theme::LabelColor; use craft_ui::contract::Bind; @@ -87,19 +85,3 @@ fn by_group(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { let filter = data.value("filter", LayerFilter { by: FilterBy::Group, ..LayerFilter::default() }); show(ui, filter) } - -/// The artboard that holds the selected "Oak", with its contents. -#[story(LayersPanel<'static, FakeLayers>, covers = [], drive = Drive::Never)] -fn layers_panel_by_artboard(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { - let tree = FakeLayers::boards(); - let filter = data.value("filter", LayerFilter { by: FilterBy::Artboard, ..LayerFilter::default() }); - StoryOutput::from(LayersPanel::new(&tree).filter(Bind::bound(filter)).show(ui)) -} - -/// Every group with its contents; the closed groups stay closed. -#[story(LayersPanel<'static, FakeLayers>, covers = [], drive = Drive::Never)] -fn layers_panel_by_group(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { - let tree = FakeLayers::fifty(); - let filter = data.value("filter", LayerFilter { by: FilterBy::Group, ..LayerFilter::default() }); - StoryOutput::from(LayersPanel::new(&tree).filter(Bind::bound(filter)).show(ui)) -} diff --git a/crates/layers/src/ui/panel/stories.rs b/crates/layers/src/ui/panel/stories.rs index cc8617b2c..4ee0d6cd1 100644 --- a/crates/layers/src/ui/panel/stories.rs +++ b/crates/layers/src/ui/panel/stories.rs @@ -1,5 +1,6 @@ //! Stories of `LayersPanel`: a tree with groups, masks and effects; no active layer; a filtered -//! tree; extra columns; effects and Smart Filters open. +//! tree; extra columns; effects and Smart Filters open; filtered by Artboard and by Group, which keep each group open or +//! closed. use craft_ui::contract::Bind; use craft_ui::testing::{Drive, StoryData, StoryOutput, story}; @@ -99,3 +100,21 @@ fn layers_panel_effects_open(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { let shown = LayersPanel::new(&tree).show(ui); with_readout(data, shown) } + +/// The artboard that holds the selected "Oak", with its contents. +#[story(LayersPanel<'static, FakeLayers>, covers = [], drive = Drive::Never)] +fn layers_panel_by_artboard(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let tree = FakeLayers::boards(); + let filter = data.value("filter", LayerFilter { by: FilterBy::Artboard, ..LayerFilter::default() }); + let shown = LayersPanel::new(&tree).filter(Bind::bound(filter)).show(ui); + with_readout(data, shown) +} + +/// Every group with its contents; the closed groups stay closed. +#[story(LayersPanel<'static, FakeLayers>, covers = [], drive = Drive::Never)] +fn layers_panel_by_group(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { + let tree = FakeLayers::fifty(); + let filter = data.value("filter", LayerFilter { by: FilterBy::Group, ..LayerFilter::default() }); + let shown = LayersPanel::new(&tree).filter(Bind::bound(filter)).show(ui); + with_readout(data, shown) +} diff --git a/crates/ui-contract/src/runtime/layout_memory.rs b/crates/ui-contract/src/runtime/layout_memory.rs index d79de251a..c2415eb55 100644 --- a/crates/ui-contract/src/runtime/layout_memory.rs +++ b/crates/ui-contract/src/runtime/layout_memory.rs @@ -1160,6 +1160,7 @@ pub(crate) mod guard { ("contract::steps::id::IdPass", "id registration: a measuring run keeps the ids it uses out of the pass (keeping_ids)"), // Read in measuring runs; written by real runs, the frame hooks or the host. ("runtime::env::ViewportEnvs", "env per viewport: installs the run restores, and reads"), + ("runtime::env::system::Source", "OS appearance: read; written by install, the input hook and the host's reader"), ("runtime::frame::FrameState", "frame state: read"), ("runtime::frame::ViewportRecord", "viewport record: read"), ("runtime::windows::Shared", "window shells: read"), diff --git a/crates/ui-gallery/tests/it/overview.rs b/crates/ui-gallery/tests/it/overview.rs index a5f6ac84e..a7a3e70f9 100644 --- a/crates/ui-gallery/tests/it/overview.rs +++ b/crates/ui-gallery/tests/it/overview.rs @@ -146,11 +146,6 @@ fn a_settled_overview_card_runs_no_component() { } } -/// The registered type name of the component listed as `name`. -fn type_of(name: &str) -> &'static str { - Catalog::linked().components.iter().find(|component| component.name == name).unwrap_or_else(|| panic!("{name} is listed")).type_name -} - fn painted(fixture: &Fixture, text: &str) -> bool { fixture.texts().iter().any(|run| run.text == text) } @@ -179,32 +174,31 @@ fn level_of(name: &str) -> &'static str { fn a_storys_dialog_starts_closed_opens_over_the_view_and_closes_back_to_the_opener() { let (mut store, report) = SettingsStore::::open_with(OpenOptions::new(Location::Memory)); let mut settings = store.get().clone(); - settings.level = level_of("Dialog").to_owned(); - settings.filter = "Dialog".to_owned(); - settings.stories.insert(type_of("Dialog").to_owned(), "dialog".to_owned()); + settings.level = level_of("FindReplaceDialog").to_owned(); + settings.filter = "FindReplaceDialog".to_owned(); store.set(settings); let mut gallery = Gallery::new(Catalog::linked(), Persisted::new(store, &report)); let mut fixture = Fixture::new(move |ui| gallery.ui(ui)); fixture.room(Vec2::new(1400.0, 900.0)).settle(); - // Other cards of the filter show the same body in flow. - let (closed, inline) = (openers(&fixture), painted_times(&fixture, "Snap to grid")); + // The body shows only while the dialog is open. + let (closed, inline) = (openers(&fixture), painted_times(&fixture, "Find what:")); assert!(closed >= 1, "the picked story shows its opener"); - // The Dialog card's opener: the first under the card's title, in its column. - let title = fixture.texts().iter().find(|run| run.text == "Dialog").expect("the Dialog card's title").rect; + // The card's opener: the first under the card's title, in its column. + let title = fixture.texts().iter().find(|run| run.text == "FindReplaceDialog").expect("the card's title").rect; let opener = fixture .by_role(Role::BUTTON) .into_iter() .filter(|button| fixture.tree().name_of(button.node) == Some("Show dialog")) .filter(|button| button.rect.top() > title.top() && button.rect.left() < title.right() && button.rect.right() > title.left() - 40.0) .min_by(|a, b| a.rect.top().total_cmp(&b.rect.top())) - .expect("the Dialog card's opener"); + .expect("the card's opener"); fixture.click(&opener).settle(); - assert_eq!(painted_times(&fixture, "Snap to grid"), inline + 1, "the opener opens the dialog"); + assert_eq!(painted_times(&fixture, "Find what:"), inline + 1, "the opener opens the dialog"); assert_eq!(openers(&fixture), closed - 1, "the opener gives way to the story"); fixture.key(egui::Key::Escape, egui::Modifiers::NONE).settle(); // The exit fade runs on the fixture's clock. fixture.advance(1.0).settle(); - assert_eq!(painted_times(&fixture, "Snap to grid"), inline, "the dialog closed"); + assert_eq!(painted_times(&fixture, "Find what:"), inline, "the dialog closed"); assert_eq!(openers(&fixture), closed, "closing the story's dialog brings the opener back"); }