diff --git a/crates/ui-egui/src/dev_mode_tests.rs b/crates/ui-egui/src/dev_mode_tests.rs index 7f7cec85..63f2f3af 100644 --- a/crates/ui-egui/src/dev_mode_tests.rs +++ b/crates/ui-egui/src/dev_mode_tests.rs @@ -106,6 +106,17 @@ fn the_assets_list_shows_a_slice_with_a_preview_name_and_export_format() { let fmt = find(egui::accesskit::Role::ComboBox, "Format"); assert_eq!(fmt.value(), Some("WebP")); assert_eq!(fmt.is_expanded(), Some(false)); + // A format picked there stays after the document changes. + let at = centre(fmt); + click(&mut u, at); + let svg = tree(&mut u).into_iter().find(|n| n.label() == Some("SVG")).expect("SVG in the format menu"); + click(&mut u, centre(&svg)); + let revision = u.app.session.ds().unwrap().revision; + u.app.session.execute("node.set", &json!({"ids": [slice], "props": {"name": "Avatar"}})).unwrap(); + u.app.session.execute("node.set", &json!({"ids": [f], "props": {"name": "Sign in"}})).unwrap(); + assert_ne!(u.app.session.ds().unwrap().revision, revision); + let fmt = tree(&mut u).into_iter().find(|n| n.role() == Role::ComboBox && n.label() == Some("Format")).unwrap(); + assert_eq!(fmt.value(), Some("SVG")); } /// A "Button" component whose nested "Heart" instance is its instance-swap property "Icon", a diff --git a/crates/ui-egui/src/right.rs b/crates/ui-egui/src/right.rs index 295cd658..ba9d8f26 100644 --- a/crates/ui-egui/src/right.rs +++ b/crates/ui-egui/src/right.rs @@ -2241,8 +2241,8 @@ pub(crate) fn prop_row(app: &mut FigApp, ui: &mut Ui, p: &figcraft_engine::devin } } -/// The thumbnails and chosen export formats of the Inspect tab's assets, kept between frames and -/// dropped when the document changes. +/// The thumbnails and chosen export formats of the Inspect tab's assets, kept between frames: the +/// thumbnails until the document changes, the formats for the session. #[derive(Clone, Default)] struct AssetUi { revision: u64, @@ -2274,7 +2274,6 @@ fn inspect_assets(app: &mut FigApp, ui: &mut Ui, doc: &Document, assets: &[figcr if state.revision != revision { state.revision = revision; state.thumbs.clear(); - state.formats.clear(); } let px = ASSET_THUMB * ui.ctx().pixels_per_point(); for a in assets {