mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-06 02:21:45 +00:00
Test that a batch deleting pages also saves in full
This commit is contained in:
1 parent
cb17f8490d
commit
12d89c551c
1 file changed
+14
@@ -538,6 +538,20 @@ fn saving_after_deleting_pages_from_a_signed_file_stays_incremental() {
|
||||
assert!(s.get(id).unwrap().is_signed());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn saving_after_a_batch_that_deletes_pages_rewrites_the_file() {
|
||||
let (mut s, id) = session_with(6);
|
||||
let original = s.save_bytes(id).unwrap();
|
||||
let batch = Edit::Batch {
|
||||
label: "Delete and rotate".into(),
|
||||
edits: vec![Edit::DeletePages { pages: vec![1, 2, 3, 4] }, Edit::RotatePages { pages: vec![0], degrees: 90 }],
|
||||
};
|
||||
s.apply(id, batch).unwrap();
|
||||
let saved = s.save_bytes(id).unwrap();
|
||||
assert!(!saved.starts_with(original.as_slice()), "a full rewrite, not an update appended to the old file");
|
||||
assert!(!contains(&saved, b"Page 3"), "a deleted page's text is not left in an earlier revision");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn saving_without_deleting_pages_stays_incremental() {
|
||||
let (mut s, id) = session_with(3);
|
||||
|
||||
Reference in new issue
Block a user