PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
tests: pin the interface language in the harnesses added since #502 (#593)
feraremag2680c3a717a09312
diff --git a/crates/ui-egui/tests/commands.rs b/crates/ui-egui/tests/commands.rsindex 7119821e2..310602d85 100644--- a/crates/ui-egui/tests/commands.rs+++ b/crates/ui-egui/tests/commands.rs@@ -251,6 +251,7 @@ fn recent_file(name: &str) -> pdfcraft_ui_egui::RecentFile {fn clear_recent_files_at_the_foot_of_open_recent_empties_the_list() {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {let mut app = PdfCraftApp::new();+ app.set_option("language", "en").unwrap();app.open_bytes("doc.pdf", None, fixture(3)).unwrap();app.recent.extend([recent_file("first.pdf"), recent_file("second.pdf")]);appdiff --git a/crates/ui-egui/tests/date_format.rs b/crates/ui-egui/tests/date_format.rsindex 161784c35..aa523d45e 100644--- a/crates/ui-egui/tests/date_format.rs+++ b/crates/ui-egui/tests/date_format.rs@@ -30,6 +30,7 @@ fn retype(h: &mut Harness<'static, PdfCraftApp>, text: &str) {fn fill_and_sign_dates_follow_the_date_format_preference_and_it_is_remembered() {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {let mut app = PdfCraftApp::new();+ app.set_option("language", "en").unwrap();app.open_bytes("form.pdf", None, PDF.to_vec()).expect("opens");app.set_option("left", "closed").unwrap();app.set_option("dialog", "preferences").unwrap();@@ -99,6 +100,7 @@ fn fill_and_sign_dates_follow_the_date_format_preference_and_it_is_remembered()fn month_names_follow_the_date_language_or_else_the_interface_language() {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {let mut app = PdfCraftApp::new();+ app.set_option("language", "en").unwrap();app.set_option("date-format", "d mmmm yyyy").unwrap();app.set_option("language", "cs").unwrap();app.set_option("dialog", "preferences").unwrap();@@ -130,6 +132,7 @@ fn month_names_follow_the_date_language_or_else_the_interface_language() {fn a_date_the_pdf_cannot_hold_is_refused_with_a_warning_first() {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {let mut app = PdfCraftApp::new();+ app.set_option("language", "en").unwrap();app.open_bytes("form.pdf", None, PDF.to_vec()).expect("opens");app.set_option("left", "closed").unwrap();// Japanese weekday names: Fill & Sign text can't hold them yet.diff --git a/crates/ui-egui/tests/editing.rs b/crates/ui-egui/tests/editing.rsindex 668852bb6..61410be2b 100644--- a/crates/ui-egui/tests/editing.rs+++ b/crates/ui-egui/tests/editing.rs@@ -416,6 +416,7 @@ impl Drop for TempPdfs {fn session_harness(setup: impl FnOnce(&mut PdfCraftApp) + 'static) -> Harness<'static, PdfCraftApp> {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {let mut app = PdfCraftApp::new();+ app.set_option("language", "en").unwrap();app.reopen_last_session = true;setup(&mut app);appdiff --git a/crates/ui-egui/tests/stamps.rs b/crates/ui-egui/tests/stamps.rsindex 66144da50..46798e8c0 100644--- a/crates/ui-egui/tests/stamps.rs+++ b/crates/ui-egui/tests/stamps.rs@@ -49,6 +49,7 @@ fn natural_image_stamps_keep_displayed_bounds_on_rotated_pages() {for degrees in [0, 90, 180, 270] {let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_cc| {let mut app = PdfCraftApp::new();+ app.set_option("language", "en").unwrap();app.open_bytes("form.pdf", None, include_bytes!("data/form.pdf").to_vec()).unwrap();let id = app.views[0].id;app.session.apply(id, pdfcraft_engine::Edit::RotatePages { pages: vec![0], degrees }).unwrap();diff --git a/crates/ui-egui/tests/ui.rs b/crates/ui-egui/tests/ui.rsindex 970c5173e..46a5e3dc2 100644--- a/crates/ui-egui/tests/ui.rs+++ b/crates/ui-egui/tests/ui.rs@@ -72,6 +72,7 @@ fn home_removes_one_recent_file_or_clears_them_all() {// Tall enough that the Recent list is on screen without scrolling.let mut h = Harness::builder().with_size(egui::vec2(1400.0, 1600.0)).build_eframe(|_cc| {let mut app = PdfCraftApp::new();+ app.set_option("language", "en").unwrap();for name in ["first.pdf", "second.pdf", "third.pdf"] {app.recent.push(pdfcraft_ui_egui::RecentFile { name: name.into(), path: format!("/nowhere/{name}"), pages: 1, size: 0 });}@@ -176,6 +177,7 @@ fn narrow_tab_strips_accept_vertical_wheel_scrolling() {for width in [600.0, 900.0] {let mut h = Harness::builder().with_size(egui::vec2(width, 700.0)).build_eframe(|_cc| {let mut app = PdfCraftApp::new();+ app.set_option("language", "en").unwrap();for i in 0..12 {app.open_bytes(&format!("narrow-{i:02}.pdf"), None, FIXTURE.to_vec()).unwrap();}diff --git a/crates/ui-egui/tests/viewer.rs b/crates/ui-egui/tests/viewer.rsindex ebac7540a..af89def4b 100644--- a/crates/ui-egui/tests/viewer.rs+++ b/crates/ui-egui/tests/viewer.rs@@ -682,6 +682,7 @@ fn pages_panel_harness(sizes: &[(u32, u32)]) -> Harness<'static, PdfCraftApp> {let bytes = sized_fixture(sizes);let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(move |_cc| {let mut app = PdfCraftApp::new();+ app.set_option("language", "en").unwrap();app.open_bytes("cheques.pdf", None, bytes).unwrap();app.right = Some(pdfcraft_ui_egui::RightPanel::Pages);app