M7: the lock question keeps the changed-on-disk question, skips signed documents and undone marks (#2149)

Review follow-ups on #2348 (benandez): a dialog an answer opened this frame
isn't closed with it; documents with digital signatures aren't asked, since
locking changes them after signing; a placement that was undone asks nothing;
the mark is forgotten when the tab closes; the other catalogues carry the
AI-assisted header; parity evidence lists the new tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mtlcl410andClaude Opus 5.5 committed 2026-11-02 08:30:44 +08:00
1 parent c2b1de2b8b
commit 30aa8793f6
27 files changed
+101 -6

No files matched your search

+1
View File
@@ -746,6 +746,7 @@ impl PdfCraftApp {
}
self.remember_view(index);
let id = self.views.remove(index).id;
self.placed_signatures.remove(&id);
#[cfg(not(target_arch = "wasm32"))]
if let Some(path) = self.session.get(id).and_then(|d| d.path.clone()) {
if self.closed_tabs.len() == 10 {
+5 -1
View File
@@ -1983,7 +1983,11 @@ fn finish_close(app: &mut PdfCraftApp, dialog: Dialog, modal_closed: bool, req:
if modal_closed || req.close || replaces {
// Only now: the number in Preferences can pass through 0 on its way to the one wanted.
app.recent.truncate(app.recent_limit);
app.dialog = None;
// An answer may have opened another dialog this frame (saving a file that changed on
// disk asks about that): it stays.
if app.dialog == Some(dialog) {
app.dialog = None;
}
app.props_draft = None;
app.view_draft = None;
app.custom_draft = None;
+6 -2
View File
@@ -55,8 +55,12 @@ impl PdfCraftApp {
}
let Some(id) = self.views.get(index).map(|v| v.id) else { return false };
// A signature just placed with Fill & Sign is a removable comment unless it is flattened:
// ask once whether to lock it into the page (#2149).
if self.ask_to_lock_signatures && !self.flatten_fill_sign_on_save && self.placed_signatures.contains(&id) {
// ask once whether to lock it into the page (#2149). Only while a Fill & Sign mark is still
// there (undo may have taken it away), and never on a digitally signed document: locking
// changes page content in an update, which validators report as a change after signing.
let still_marked = self.session.get(id).is_some_and(|d| d.info.annotations.iter().any(|a| a.fill_sign));
let signed = self.session.get(id).is_some_and(|d| d.is_signed());
if self.ask_to_lock_signatures && !self.flatten_fill_sign_on_save && self.placed_signatures.contains(&id) && still_marked && !signed {
self.pending_lock = Some(PendingLock { id, target, after: Box::new(after) });
self.dialog = Some(crate::Dialog::LockSignatures);
return false;
+1
View File
@@ -2278,6 +2278,7 @@ calendar date December ديسمبر
Smaller pages صفحات أصغر
Reset page size إعادة ضبط حجم الصفحة
Flatten Fill & Sign when saving تسطيح التعبئة والتوقيع عند الحفظ
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? هل تريد تثبيت توقيعك في الصفحة؟
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. التوقيع الموضوع تعليق إلى أن يُثبَّت: يستطيع أي شخص لديه محرر PDF نقله أو إزالته. التثبيت يجعل نصوص التعبئة والتوقيع وعلاماتها وتواقيعها جزءًا من الصفحة.
Don't ask again عدم السؤال مرة أخرى
Can't render this file because it contains an unexpected character in line 6 and column 47.
+1
View File
@@ -138,6 +138,7 @@
Side panels Странични панели
Enable Acrobat JavaScript Включи Acrobat JavaScript
Flatten Fill & Sign when saving Сплескай „Попълни и подпиши“ при запазване
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? Да се заключи ли подписът ви в страницата?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Поставеният подпис е коментар, докато не бъде заключен: всеки с PDF редактор може да го премести или премахне. Заключването прави текста, отметките и подписите от „Попълване и подписване“ част от страницата.
Don't ask again Не питай отново
Can't render this file because it contains an unexpected character in line 8 and column 16.
+1
View File
@@ -2299,6 +2299,7 @@ calendar date December prosince
Smaller pages Menší stránky
Reset page size Obnovit velikost stránek
Flatten Fill & Sign when saving Při ukládání sloučit obsah Vyplnit a podepsat se stránkou
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? Zamknout podpis do stránky?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Umístěný podpis je komentář, dokud není zamčen: kdokoli s editorem PDF ho může přesunout nebo odstranit. Zamčení udělá z textu, značek a podpisů Vyplnit a podepsat součást stránky.
Don't ask again Už se neptat
Can't render this file because it contains an unexpected character in line 6 and column 47.
+1
View File
@@ -71,6 +71,7 @@
Side panels Seitenleisten
Enable Acrobat JavaScript Acrobat-JavaScript aktivieren
Flatten Fill & Sign when saving Ausfüllen und unterschreiben beim Speichern reduzieren
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? Unterschrift fest in die Seite übernehmen?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Eine platzierte Unterschrift ist ein Kommentar, bis sie fest übernommen wird: Jeder mit einem PDF-Editor kann sie verschieben oder entfernen. Beim Übernehmen werden Text, Markierungen und Unterschriften aus „Ausfüllen und unterschreiben“ Teil der Seite.
Don't ask again Nicht mehr fragen
Can't render this file because it contains an unexpected character in line 6 and column 51.
+1
View File
@@ -286,6 +286,7 @@
Failed Αποτυχία
Page {p} of {n} Σελίδα {p} από {n}
Flatten Fill & Sign when saving Ενσωμάτωση συμπληρώσεων και υπογραφών κατά την αποθήκευση
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? Κλείδωμα της υπογραφής σας στη σελίδα;
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Μια τοποθετημένη υπογραφή είναι σχόλιο μέχρι να κλειδωθεί: οποιοσδήποτε με επεξεργαστή PDF μπορεί να τη μετακινήσει ή να την αφαιρέσει. Το κλείδωμα κάνει το κείμενο, τα σημάδια και τις υπογραφές της Συμπλήρωσης και υπογραφής μέρος της σελίδας.
Don't ask again Να μην ερωτηθώ ξανά
1 # Greek (el) interface catalog. Columns: context <TAB> English source <TAB> Greek translation.
286
287 # AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
288
289
290
291
292
+1
View File
@@ -94,6 +94,7 @@
Side panels Paneles laterales
Enable Acrobat JavaScript Activar Acrobat JavaScript
Flatten Fill & Sign when saving Acoplar Rellenar y firmar al guardar
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? ¿Fijar su firma en la página?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Una firma colocada es un comentario hasta que se fija: cualquiera con un editor de PDF puede moverla o quitarla. Al fijarla, el texto, las marcas y las firmas de Rellenar y firmar pasan a formar parte de la página.
Don't ask again No volver a preguntar
Can't render this file because it contains an unexpected character in line 6 and column 60.
+1
View File
@@ -71,6 +71,7 @@
Side panels Panneaux latéraux
Enable Acrobat JavaScript Activer Acrobat JavaScript
Flatten Fill & Sign when saving Aplatir Remplir et signer à l'enregistrement
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? Intégrer votre signature à la page ?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Une signature placée reste un commentaire tant qu’elle n’est pas intégrée : n’importe qui avec un éditeur PDF peut la déplacer ou la supprimer. L’intégration rend le texte, les marques et les signatures de Remplir et signer partie de la page.
Don't ask again Ne plus demander
Can't render this file because it contains an unexpected character in line 6 and column 39.
+1
View File
@@ -2255,6 +2255,7 @@ action wizard Start Indítás
Smaller pages Kisebb oldalak
Reset page size Oldalméret visszaállítása
Flatten Fill & Sign when saving Kitöltés és aláírás beégetése mentéskor
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? Rögzíti az aláírását az oldalba?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Az elhelyezett aláírás megjegyzés, amíg nincs rögzítve: bárki egy PDF-szerkesztővel áthelyezheti vagy eltávolíthatja. A rögzítés a Kitöltés és aláírás szövegét, jeleit és aláírásait az oldal részévé teszi.
Don't ask again Ne kérdezzen többet
Can't render this file because it contains an unexpected character in line 7 and column 44.
+1
View File
@@ -2215,6 +2215,7 @@
Files are combined in this order. Leave Pages empty to take every page. I file vengono combinati in quest'ordine. Lascia vuoto Pagine per prendere tutte le pagine.
Fill & Sign dates Date di Compila e firma
Flatten Fill & Sign when saving Appiattisci Compila e firma al salvataggio
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? Bloccare la firma nella pagina?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Una firma inserita è un commento finché non viene bloccata: chiunque abbia un editor PDF può spostarla o rimuoverla. Il blocco rende testo, segni e firme di Compila e firma parte della pagina.
Don't ask again Non chiedere più
Can't render this file because it contains an unexpected character in line 6 and column 47.
+1
View File
@@ -2270,6 +2270,7 @@
@plural {n} page|{n} pages {n} ページ
signature pad Type 入力
Flatten Fill & Sign when saving 保存時に入力と署名を統合する
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? 署名をページに固定しますか?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. 配置した署名は固定するまで注釈です。PDF エディターを持つ人なら誰でも移動や削除ができます。固定すると、入力と署名のテキスト、マーク、署名がページの一部になります。
Don't ask again 今後は確認しない
Can't render this file because it contains an unexpected character in line 6 and column 47.
+1
View File
@@ -2187,6 +2187,7 @@ calendar date December Желтоқсан
Smaller pages Кішірек беттер
Reset page size Бет өлшемін қалпына келтіру
Flatten Fill & Sign when saving Сақтау кезінде «Толтыру және қол қою» мазмұнын жазықтау
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? Қолтаңбаңызды бетке бекіту керек пе?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Қойылған қолтаңба бекітілгенге дейін түсініктеме болып қалады: PDF өңдегіші бар кез келген адам оны жылжытып не жоя алады. Бекіту «Толтыру және қол қою» мәтінін, белгілерін және қолтаңбаларын беттің бөлігіне айналдырады.
Don't ask again Қайта сұрамау
Can't render this file because it contains an unexpected character in line 885 and column 9.
+1
View File
@@ -590,6 +590,7 @@
Fixed what could be fixed; 1 problem remains Ištaisyta tai, ką buvo galima; liko 1 problema
Fixed what could be fixed; {n} problems remain Ištaisyta tai, ką buvo galima; liko problemų: {n}
Flatten Fill & Sign when saving Įrašant suplokštinti pildymo ir pasirašymo turinį
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? Įtvirtinti parašą puslapyje?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Padėtas parašas yra komentaras, kol neįtvirtintas: bet kas su PDF redaktoriumi gali jį perkelti ar pašalinti. Įtvirtinus užpildymo ir pasirašymo tekstas, žymės ir parašai tampa puslapio dalimi.
Don't ask again Daugiau neklausti
Can't render this file because it contains an unexpected character in line 408 and column 9.
+1
View File
@@ -2249,6 +2249,7 @@
@plural {n} page|{n} pages {n} strona|{n} strony|{n} stron
signature pad Type Wpisz
Flatten Fill & Sign when saving Spłaszczaj elementy Wypełnij i podpisz przy zapisie
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? Utrwalić podpis na stronie?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Umieszczony podpis jest komentarzem, dopóki nie zostanie utrwalony: każdy z edytorem PDF może go przenieść lub usunąć. Utrwalenie sprawia, że tekst, znaki i podpisy z Wypełnij i podpisz stają się częścią strony.
Don't ask again Nie pytaj ponownie
Can't render this file because it contains an unexpected character in line 6 and column 47.
+1
View File
@@ -2208,6 +2208,7 @@ action wizard Start Iniciar
First Primeiro
First commit Primeiro commit
Flatten Fill & Sign when saving Nivelar Preencher e assinar ao salvar
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? Fixar sua assinatura na página?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Uma assinatura colocada é um comentário até ser fixada: qualquer pessoa com um editor de PDF pode movê-la ou removê-la. Fixar torna o texto, as marcas e as assinaturas de Preencher e assinar parte da página.
Don't ask again Não perguntar novamente
Can't render this file because it contains an unexpected character in line 9 and column 16.
+1
View File
@@ -91,6 +91,7 @@
Side panels Боковые панели
Enable Acrobat JavaScript Включить Acrobat JavaScript
Flatten Fill & Sign when saving Расплющить «Заполнить и подписать» при сохранении
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? Закрепить подпись на странице?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Размещённая подпись остаётся комментарием, пока не закреплена: любой с редактором PDF может её переместить или удалить. Закрепление делает текст, отметки и подписи из «Заполнить и подписать» частью страницы.
Don't ask again Больше не спрашивать
Can't render this file because it contains an unexpected character in line 9 and column 16.
+1
View File
@@ -2203,6 +2203,7 @@ signature pad Type Vtipkaj
Document properties ({key}) Lastnosti dokumenta ({key})
Fill & Sign dates Datumi pri Izpolni in podpiši
Flatten Fill & Sign when saving Splošči Izpolni in podpiši ob shranjevanju
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? Zakleniti podpis v stran?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Postavljen podpis je komentar, dokler ni zaklenjen: vsak z urejevalnikom PDF ga lahko premakne ali odstrani. Zaklepanje naredi besedilo, oznake in podpise iz Izpolni in podpiši del strani.
Don't ask again Ne sprašuj več
Can't render this file because it contains an unexpected character in line 9 and column 16.
+1
View File
@@ -2503,6 +2503,7 @@ animation effects Off ఆఫ్
Send backward వెనుకకు పంపు
Send to back అందరికంటే వెనుకకు పంపు
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? మీ సంతకాన్ని పేజీలో లాక్ చేయాలా?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. ఉంచిన సంతకం లాక్ చేసే వరకు ఒక వ్యాఖ్య మాత్రమే: PDF ఎడిటర్ ఉన్న ఎవరైనా దాన్ని తరలించవచ్చు లేదా తొలగించవచ్చు. లాక్ చేయడం వల్ల నింపి సంతకం చేయి వచనం, గుర్తులు, సంతకాలు పేజీలో భాగమవుతాయి.
Don't ask again మళ్లీ అడగవద్దు
Can't render this file because it contains an unexpected character in line 13 and column 16.
+1
View File
@@ -62,6 +62,7 @@
Side panels Yan paneller
Enable Acrobat JavaScript Acrobat JavaScript'i etkinleştir
Flatten Fill & Sign when saving Kaydederken Doldur ve İmzala'yı düzleştir
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? İmzanız sayfaya sabitlensin mi?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Yerleştirilen imza, sabitlenene kadar bir yorumdur: PDF düzenleyicisi olan herkes onu taşıyabilir veya kaldırabilir. Sabitlemek, Doldur ve İmzala metnini, işaretlerini ve imzalarını sayfanın parçası yapar.
Don't ask again Bir daha sorma
1 # Turkish (tr) catalog. Format: see the header of ja.tsv
62
63 # AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
64
65
66
67
68
+1
View File
@@ -2278,6 +2278,7 @@ calendar date December грудня
Smaller pages Менші сторінки
Reset page size Скинути розмір сторінок
Flatten Fill & Sign when saving Звести «Заповнення й підпис» під час збереження
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? Закріпити підпис на сторінці?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. Розміщений підпис є коментарем, доки його не закріплено: будь-хто з редактором PDF може його перемістити або видалити. Закріплення робить текст, позначки й підписи з «Заповнити й підписати» частиною сторінки.
Don't ask again Більше не питати
Can't render this file because it contains an unexpected character in line 6 and column 47.
+1
View File
@@ -144,6 +144,7 @@
Side panels 侧边面板
Enable Acrobat JavaScript 启用 Acrobat JavaScript
Flatten Fill & Sign when saving 保存时拼合填写与签名
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? 将签名锁定到页面中?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. 放置的签名在锁定前只是注释:任何有 PDF 编辑器的人都能移动或删除它。锁定后,“填写和签名”的文字、标记和签名会成为页面的一部分。
Don't ask again 不再询问
Can't render this file because it contains an unexpected character in line 9 and column 16.
+1
View File
@@ -2544,6 +2544,7 @@ animation effects Off 關
Send backward 下移一層
Send to back 移到最下層
# AI-assisted additions for the lock-signatures prompt (#2149) (2026-10-16); not reviewed by a native speaker.
Lock your signature into the page? 將簽名鎖定到頁面中?
A placed signature is a comment until it is locked: anyone with a PDF editor can move or remove it. Locking makes your Fill & Sign text, marks and signatures part of the page. 放置的簽名在鎖定前只是註解:任何有 PDF 編輯器的人都能移動或移除它。鎖定後,「填寫與簽署」的文字、標記與簽名會成為頁面的一部分。
Don't ask again 不再詢問
Can't render this file because it contains an unexpected character in line 9 and column 16.
+2 -2
View File
@@ -329,8 +329,8 @@ pub struct PdfCraftApp {
/// Ask on the first save after Fill & Sign places a signature or initials whether to lock
/// them into the page (#2149). Off once the user says not to ask again.
pub ask_to_lock_signatures: bool,
/// Documents with a signature or initials placed by Fill & Sign since they were last saved
/// (or asked about).
/// Documents with a Fill & Sign signature placed since their last save, asked about on
/// saving (#2149). Not part of the recovery data: a recovered document isn't asked.
pub(crate) placed_signatures: std::collections::HashSet<pdfcraft_engine::DocId>,
/// A save waiting behind [`Dialog::LockSignatures`], and its Don't ask again box.
pub(crate) pending_lock: Option<editing::PendingLock>,
+65
View File
@@ -1843,6 +1843,71 @@ fn a_lock_that_fails_keeps_the_question() {
let _ = std::fs::remove_file(&out);
}
/// #2348 review: the lock question stays out of the way where it must. Answering it on a file
/// that changed on disk leaves the changed-on-disk question showing (it was closed with the lock
/// question, so the save silently didn't happen); a signature placed and then undone asks
/// nothing; and a digitally signed document isn't asked, since locking would change it after
/// signing.
#[test]
fn the_lock_question_is_skipped_or_kept_where_it_must_be() {
let place = |h: &mut Harness<'static, PdfCraftApp>| {
h.state_mut().signature = Some(SavedSig::Typed("Ada Lovelace".into()));
h.state_mut().execute("sign.fill.signature");
h.run_steps(2);
click(h, 40.0, 300.0);
};
// A file that changed on disk.
let path = std::env::temp_dir().join(format!("pdfcraft-lock-changed-{}.pdf", std::process::id()));
std::fs::write(&path, FIXTURE).unwrap();
let mut h = harness_bytes(FIXTURE);
h.state_mut().close_tab(0);
h.state_mut().open_path(&path.to_string_lossy());
for _ in 0..100 {
if !h.state().views.is_empty() {
break;
}
h.run_steps(1);
std::thread::sleep(std::time::Duration::from_millis(5));
}
h.run_steps(3);
place(&mut h);
std::fs::write(&path, [FIXTURE, b"\n% rewritten elsewhere\n".as_slice()].concat()).unwrap();
assert!(!h.state_mut().save_active(SaveTarget::InPlace), "asks first");
h.run_steps(2);
h.get_by_label("Keep editable").click();
h.run_steps(3);
assert_eq!(h.state().dialog, Some(Dialog::OverwriteChanged), "the changed-on-disk question shows");
let _ = std::fs::remove_file(&path);
// Placed, then undone: nothing to lock, so the save just saves.
let out = std::env::temp_dir().join(format!("pdfcraft-lock-undone-{}.pdf", std::process::id()));
let mut h = harness();
h.state_mut().save_override = Some(out.to_string_lossy().into_owned());
place(&mut h);
assert!(h.state_mut().execute("edit.undo"));
h.run_steps(2);
assert!(h.state_mut().save_active(SaveTarget::InPlace), "no question after the signature was undone");
let _ = std::fs::remove_file(&out);
// Digitally signed: never asked.
let mut doc = {
let mut h = harness();
let app = h.state_mut();
let id = app.views[0].id;
let p12 = std::fs::read(concat!(env!("CARGO_MANIFEST_DIR"), "/../sign/tests/data/ec-p256.p12")).unwrap();
let digital_id = pdfcraft_engine::sign::pkcs12::open(&p12, "test").unwrap();
let opts = pdfcraft_engine::SignOptions { page: 0, rect: Some([20.0, 20.0, 160.0, 50.0]), ..Default::default() };
app.session.sign(id, &digital_id, opts).expect("signs")
};
let mut h = harness_bytes(&std::mem::take(&mut doc));
h.state_mut().save_override = Some(out.to_string_lossy().into_owned());
place(&mut h);
let id = h.state().views[0].id;
assert!(h.state().session.get(id).unwrap().is_signed());
assert!(h.state_mut().save_active(SaveTarget::InPlace), "a signed document isn't asked");
let _ = std::fs::remove_file(&out);
}
/// #2149: Cancel saves nothing, and Keep editable with Don't ask again turns the question off.
#[test]
fn cancelling_the_lock_question_saves_nothing() {
+1 -1
View File
@@ -5441,7 +5441,7 @@ milestone = "M5"
status = "shipped"
commands = ["comment.flatten"]
tools = ["doc_save", "doc_flatten"]
evidence = ["crates/edit/src/tests.rs::fill_sign_flatten_bakes_marks_keeps_other_comments_and_does_not_reuse_pcfl0", "crates/engine/src/tests.rs::flattening_fill_and_sign_keeps_other_comments_fields_and_undoes", "crates/engine/src/tests.rs::flattening_fill_and_sign_is_refused_without_permission_to_change", "crates/automation/tests/it/automation.rs::saving_with_flatten_fill_sign_bakes_marks_and_leaves_other_comments", "crates/ui-egui/tests/it/fill_sign.rs::saving_flattens_fill_and_sign_only_when_the_preference_is_on", "crates/ui-egui/tests/it/fill_sign.rs::the_first_save_after_placing_a_signature_asks_to_lock_it", "crates/ui-egui/tests/it/fill_sign.rs::cancelling_the_lock_question_saves_nothing"]
evidence = ["crates/edit/src/tests.rs::fill_sign_flatten_bakes_marks_keeps_other_comments_and_does_not_reuse_pcfl0", "crates/engine/src/tests.rs::flattening_fill_and_sign_keeps_other_comments_fields_and_undoes", "crates/engine/src/tests.rs::flattening_fill_and_sign_is_refused_without_permission_to_change", "crates/automation/tests/it/automation.rs::saving_with_flatten_fill_sign_bakes_marks_and_leaves_other_comments", "crates/ui-egui/tests/it/fill_sign.rs::saving_flattens_fill_and_sign_only_when_the_preference_is_on", "crates/ui-egui/tests/it/fill_sign.rs::the_first_save_after_placing_a_signature_asks_to_lock_it", "crates/ui-egui/tests/it/fill_sign.rs::cancelling_the_lock_question_saves_nothing", "crates/ui-egui/tests/it/fill_sign.rs::a_lock_that_fails_keeps_the_question", "crates/ui-egui/tests/it/fill_sign.rs::the_lock_question_is_skipped_or_kept_where_it_must_be"]
notes = "Preferences ▸ Fill & Sign, and doc_save flatten_fill_sign, bake text, marks and signatures into the page. The option defaults off, so a normal save leaves them editable; the first save after a signature or initials is placed asks whether to lock it into the page (Lock and save / Keep editable, with Don't ask again), and the Sign menu carries the same switch (#2149). Other comments and form fields stay. Flatten comments still flattens every comment."
[[feature]]