mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-06 05:53:08 -05:00
Test reopening Pastels in both saved thumbnail sizes
This commit is contained in:
1 parent
6d7aa31313
commit
c323ccd7d4
1 file changed
+13
-5
@@ -119,12 +119,20 @@ fn library_menu_views_survive_redraw_and_reopening() {
|
||||
draw_frame(&mut app, &ctx, &draw, vec![]);
|
||||
draw_frame(&mut app, &ctx, &draw, vec![]);
|
||||
assert_eq!(settings(&app.ui, "swatches", "pastels").unwrap().view, Some(view), "{label}");
|
||||
if matches!(view, View::SmallThumb | View::MediumThumb) {
|
||||
app.run("window.panel.close", json!({"panel": panel})).unwrap();
|
||||
assert!(!is_open(&app.ui, &panel));
|
||||
let reopened = panel_of(app.run("window.swatchLibrary", json!({"library": "pastels"})).unwrap());
|
||||
assert_eq!(reopened, panel);
|
||||
// A fresh context excludes browser state cached before the close.
|
||||
let reopened_ctx = context();
|
||||
draw_frame(&mut app, &reopened_ctx, &draw, vec![]);
|
||||
assert_eq!(settings(&app.ui, "swatches", "pastels").unwrap().view, Some(view), "{label} after reopening");
|
||||
let state_id = egui::Id::unique(("library-panel-state", &panel));
|
||||
let browser = reopened_ctx.data(|d| d.get_temp::<PresetState<LibraryKey>>(state_id)).expect("the reopened Pastels browser drew");
|
||||
assert_eq!(saved_view(browser.view, browser.zoom), view, "{label} in the reopened browser");
|
||||
}
|
||||
}
|
||||
|
||||
app.run("window.panel.close", json!({"panel": panel})).unwrap();
|
||||
app.run("window.swatchLibrary", json!({"library": "pastels"})).unwrap();
|
||||
draw_frame(&mut app, &ctx, &draw, vec![]);
|
||||
assert_eq!(settings(&app.ui, "swatches", "pastels").unwrap().view, Some(View::SmallThumb));
|
||||
}
|
||||
|
||||
fn undo_len(app: &VectorcraftApp) -> usize {
|
||||
|
||||
Reference in new issue
Block a user