mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-28 12:26:52 -06:00
#1202: an asset's chosen export format stays when the document changes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user