mirror of
https://github.com/storytold/deckcraft.git
synced 2026-12-01 10:13:09 -06:00
Merge look-fix4-canvas app work
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1322,6 +1322,23 @@ fn a_cancelled_drag_inserts_nothing_and_puts_a_resize_back() {
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), undo, "and adds no undo step");
|
||||
}
|
||||
|
||||
/// A cancelled move takes its smart guides with it: none is left on the slide for the next tool's gesture.
|
||||
#[test]
|
||||
fn a_cancelled_move_leaves_no_smart_guide() {
|
||||
let mut s = session();
|
||||
let ev = |kind, x, y| PointerEvent { kind, x, y, mods: Mods::default(), tol: 3.0, pressure: None };
|
||||
s.execute("shape.insert", &json!({"preset": "rect", "rect": [100.0, 100.0, 100.0, 80.0]})).unwrap();
|
||||
let id = s.execute("shape.insert", &json!({"preset": "rect", "rect": [400.0, 300.0, 100.0, 80.0]})).unwrap()["id"].as_u64().unwrap();
|
||||
s.set_tool(ToolKind::Select);
|
||||
s.execute("edit.select", &json!({"ids": [id]})).unwrap();
|
||||
s.pointer(ev(PointerKind::Down, 450.0, 340.0)).unwrap();
|
||||
// Level with the first rectangle's top.
|
||||
s.pointer(ev(PointerKind::Drag, 450.0, 142.0)).unwrap();
|
||||
assert!(!s.tool.guides.is_empty(), "the moved shape shows a smart guide");
|
||||
s.cancel_drag();
|
||||
assert!(s.tool.guides.is_empty(), "the cancelled move leaves no guide");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn click_into_placeholder_starts_editing() {
|
||||
let mut s = session();
|
||||
|
||||
@@ -228,6 +228,7 @@ impl Session {
|
||||
}
|
||||
self.tool.preview = None;
|
||||
self.tool.marquee = None;
|
||||
self.tool.guides.clear();
|
||||
self.tool.path_preview.clear();
|
||||
self.tool.path_closing = false;
|
||||
self.tool.ink_preview.clear();
|
||||
|
||||
@@ -93,7 +93,9 @@ impl SlideApp {
|
||||
let name = o.name();
|
||||
let secs = ((monotonic_ms() - o.started_ms) / 1000.0).max(0.0);
|
||||
let mut open = true;
|
||||
// The window behind dims, as production's, so it reads as blocked while the file opens.
|
||||
let shown = BlockingOverlay::new("Opening presentation")
|
||||
.scrim(true)
|
||||
.opened(Bind::bound(&mut open))
|
||||
.message(format!("Opening {name}…"))
|
||||
.cancel("Cancel")
|
||||
|
||||
@@ -129,7 +129,9 @@ pub fn show(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let _ = app.run(&fired.command.id, fired.command.params);
|
||||
}
|
||||
}
|
||||
if Button::new(words.add_section.clone()).show(ui).clicked() {
|
||||
// The button stands off the window's edge, as production's 24 pt inset row.
|
||||
let add = Stack::new().pad(Pad::Roomy).show(ui, |ui, _| Button::new(words.add_section.clone()).show(ui).clicked());
|
||||
if add.inner == Some(true) {
|
||||
let _ = app.run("section.add", json!({"at": cur}));
|
||||
}
|
||||
let make_grid = || {
|
||||
|
||||
@@ -277,6 +277,28 @@ fn change_picture_replaces_the_selected_picture() {
|
||||
}
|
||||
}
|
||||
|
||||
/// The title bar's Home button shows on while Home (the File view) is open over a presentation, and off once it is
|
||||
/// left.
|
||||
#[test]
|
||||
fn the_title_bars_home_button_is_on_while_home_is_open() {
|
||||
use egui::accesskit::Toggled;
|
||||
use egui_kittest::kittest::{NodeT, Queryable};
|
||||
let mut h = crate::test_harness::harness(Session::with_new(), Services::default());
|
||||
h.run_steps(2);
|
||||
// The title bar's item, not the File view's Home page in its side menu.
|
||||
let in_title_bar = |node: &egui_kittest::Node<'_>| node.accesskit_node().bounding_box().is_some_and(|bounds| bounds.y1 <= 44.0);
|
||||
let home_on = |h: &egui_kittest::Harness<'_, SlideApp>| {
|
||||
let homes: Vec<_> = h.query_all_by(|node| node.label().is_some_and(|label| label.starts_with("Home"))).filter(in_title_bar).collect();
|
||||
assert!(!homes.is_empty(), "the title bar has a Home item");
|
||||
homes.iter().any(|node| node.accesskit_node().toggled() == Some(Toggled::True))
|
||||
};
|
||||
assert!(!home_on(&h), "Home is off over the slides");
|
||||
h.state_mut().run("app.home", json!({})).unwrap();
|
||||
h.run_steps(2);
|
||||
assert!(h.state().backstage_open());
|
||||
assert!(home_on(&h), "Home is on while the File view is open");
|
||||
}
|
||||
|
||||
/// #17: Home created a new blank presentation instead of going to the start screen.
|
||||
#[test]
|
||||
fn home_shows_the_start_screen_over_the_open_presentation() {
|
||||
|
||||
Reference in New Issue
Block a user