From ae279a27f497700d2f6048a180f0bc2f5b4d9ca1 Mon Sep 17 00:00:00 2001 From: mtlcl410 <2368091+mtlcl410@users.noreply.github.com> Date: Thu, 12 Nov 2026 11:43:00 +0800 Subject: [PATCH] fix(tests): saves compared byte for byte don't fail when the clock crosses a second between them The three script-refusal tests built on reset_order_session save, run a refused edit or script, save again and compare the bytes. Each save stamps /ModDate from the system clock, so the comparison failed whenever the two saves fell in different seconds. The helper now pins the session clock with Session::with_clock, as session_with and the other byte-comparing tests do. --- crates/engine/src/tests.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 91b00df4cc..0acf377f26 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -14188,7 +14188,8 @@ fn reset_order_session(reset: &str) -> (Session, DocId) { }) .unwrap(); let bytes = Arc::new(pdfcraft_cos::write_full(&cos, &Default::default()).unwrap()); - let mut s = Session::new(); + // Callers compare two saves byte for byte, and each save stamps `/ModDate`: pin the clock. + let mut s = Session::new().with_clock(|| 1_700_000_000); s.set_javascript(false); let id = s.open("reset-order.pdf", None, bytes, None).unwrap(); s.apply(