mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-14 06:42:20 +00:00
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.
This commit is contained in:
1 parent
1d2af9907b
commit
ae279a27f4
1 file changed
+2
-1
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user