mirror of
https://github.com/storytold/texturecraft.git
synced 2026-11-23 08:02:39 +00:00
96b179ccfc
The app opens on the sample project, which left no obvious place to pick a project. A start window now offers New project, Open, the recent projects and Continue with the sample project, with Show at startup (also Settings > Interface > Start window). It opens at launch in the desktop and web apps, but not when a file is given on the command line or the app runs with --control. Labels translated into the other nine UI languages; a UI test covers New project, Continue and the startup setting.
31 lines
1.2 KiB
Rust
31 lines
1.2 KiB
Rust
//! The start window: New project opens its dialog, Continue keeps the open project, and the
|
|
//! startup choice is a setting.
|
|
|
|
use egui_kittest::Harness;
|
|
use egui_kittest::kittest::Queryable;
|
|
use texturecraft_ui_egui::TextureCraftApp;
|
|
|
|
fn harness() -> Harness<'static, TextureCraftApp> {
|
|
let session = texturecraft_engine::sample_session(256, 64).unwrap();
|
|
let mut h = Harness::builder().with_size(egui::vec2(1600.0, 960.0)).build_eframe(|cc| TextureCraftApp::new(cc, session));
|
|
h.state_mut().ui.windows.start = true;
|
|
h.run_steps(3);
|
|
h
|
|
}
|
|
|
|
#[test]
|
|
fn start_window_choices() {
|
|
let mut h = harness();
|
|
h.get_by_label("New project...").click();
|
|
h.run_steps(3);
|
|
assert!(!h.state().ui.windows.start && h.state().ui.windows.new_project, "New project opens its dialog");
|
|
|
|
let mut h = harness();
|
|
h.get_by_label("Show at startup").click();
|
|
h.get_by_label("Continue with the sample project").click();
|
|
h.run_steps(3);
|
|
assert!(!h.state().ui.windows.start && !h.state().ui.windows.new_project);
|
|
assert!(!h.state().ui.prefs.start_window, "unticked: not shown next time");
|
|
assert_eq!(h.state().session.doc.project.texture_sets.len(), 2, "the sample stays open");
|
|
}
|