mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-31 05:28:09 -06:00
* tests: pin the interface language in the harnesses added since #502 #502 pinned it in every harness there was. These five arrived after its branch point, so the suite is red again on a machine whose display language has a catalog: - `commands.rs`, Clear Recent Files from the menu (#557). - `editing.rs`, `session_harness` (#462), which clicks "Don't save". - `stamps.rs`, the rotated-stamp test (#473), which clicks "OK". - `ui.rs`, removing one recent file from Home (#557), and the narrow tab strip (#416), which reads "Display theme:". The eight other `PdfCraftApp::new()` without the line never draw the shell, so `i18n::set_current` is never called and the thread-local stays on English. They compare saved state or a default, and are left alone — including the one that asserts on a `notify_tr` toast, which reads English for the same reason. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * tests: pin the interface language in the date-format and Pages-panel harnesses too --------- Co-authored-by: Fernando Areán <soporte@codebit.es> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>
This commit is contained in:
co-authored by
Claude Opus 5
Fernando Areán
Brandon Thomas
parent
e7a15783f3
commit
c3a717a093
@@ -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")]);
|
||||
app
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
app
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user