From 37c3eb0d018cfe431d686fa030e20e6a51925f9b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 14 Oct 2026 23:00:56 -0700 Subject: [PATCH] Tests: the Alt-drag tests no longer fail when their documents are made in different seconds file.new stamps metadata.created from the clock in whole seconds. Four Alt-drag tests in tests_xform.rs compare the document under test with one that a second session builds, and both sessions start from session()'s file.new. When the clock reached a new second between the two calls, the documents differed in created, and the test failed. With a temporary change that made each clock read on a thread at least one second later than the one before, all four failed. session() in tests_xform.rs and persp_session() in tests_persp_select.rs now pass "created": null to file.new, as #1894 did for doc_with_rect() in tests_ids_without_selection.rs. Two new tests in #2067 compare two documents built on persp_session(). --- crates/engine/src/tests_persp_select.rs | 3 ++- crates/engine/src/tests_xform.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/tests_persp_select.rs b/crates/engine/src/tests_persp_select.rs index 88031ba2c..3c0c3de5b 100644 --- a/crates/engine/src/tests_persp_select.rs +++ b/crates/engine/src/tests_persp_select.rs @@ -11,7 +11,8 @@ use super::*; /// An 800 × 600 document with a two-point grid and a rectangle attached to the right plane. pub(crate) fn persp_session() -> (Session, NodeId) { let mut s = Session::new(); - s.execute("file.new", &json!({"width": 800, "height": 600})).unwrap(); + // Separately created fixtures must compare equal across clock ticks. + s.execute("file.new", &json!({"width": 800, "height": 600, "created": null})).unwrap(); s.execute("perspective.grid.preset", &json!({"kind": 2})).unwrap(); // Snap to Grid (on by default) would land moved edges on gridlines: these tests measure exact moves. s.execute("perspective.grid.snap", &json!({"on": false})).unwrap(); diff --git a/crates/engine/src/tests_xform.rs b/crates/engine/src/tests_xform.rs index f25b104c1..11c162ba6 100644 --- a/crates/engine/src/tests_xform.rs +++ b/crates/engine/src/tests_xform.rs @@ -9,7 +9,8 @@ use super::*; fn session() -> Session { let mut s = Session::new(); - s.execute("file.new", &json!({"width": 800, "height": 600})).unwrap(); + // Separately created fixtures must compare equal across clock ticks. + s.execute("file.new", &json!({"width": 800, "height": 600, "created": null})).unwrap(); s }