mirror of
https://github.com/storytold/gridcraft.git
synced 2026-11-09 20:09:57 -06:00
* E37: migrate GridCraft to egui 0.37 Pin the reviewed fork and shared dependencies, adapt input and rendering to the new frame lifecycle, and preserve bounded capture handling and font notices. Add representative accessibility checks and meaningful control labels. Validation: full repository CI passed all ten stages, with 2,249 tests passed, zero failed and one existing timing test ignored. Native workflows and paired performance qualification remain documented separately. * egui037: record final published pins and local qualification * M0.37: fix RTL clipping and preserve screenshot budgets * test: share migrated GridCraft UI harness setup * egui037: document migrated UI and regression contracts * egui-037: align popup test fonts and avoid redundant tooltip probes
43 lines
1.8 KiB
Rust
43 lines
1.8 KiB
Rust
//! Form dialogs draw their field labels and choices in the interface language, as their titles
|
|
//! and OK/Cancel buttons already were (Page Setup showed "Left margin (in):" in every language).
|
|
|
|
use egui_kittest::kittest::Queryable as _;
|
|
use gridcraft_ui_egui::SheetApp;
|
|
use gridcraft_ui_egui::i18n::Language;
|
|
use serde_json::json;
|
|
|
|
fn harness() -> egui_kittest::Harness<'static, SheetApp> {
|
|
crate::support::blank_harness(4)
|
|
}
|
|
|
|
#[test]
|
|
fn form_fields_are_translated() {
|
|
for (dialog, labels) in [("pageSetup", ["Left margin (in):", "Footer (in):"]), ("insertPaste", ["Shift cells right", "Shift cells down"])] {
|
|
let mut h = harness();
|
|
h.state_mut().run("app.language.set", json!({"language": "pt"})).unwrap();
|
|
h.state_mut().open_dialog(dialog, json!({}));
|
|
h.run_steps(3);
|
|
for english in labels {
|
|
let translated = Language::PtBr.tr(english);
|
|
assert!(h.query_by_label_contains(translated).is_some(), "{dialog}: no {translated}");
|
|
if translated != english {
|
|
assert!(h.query_by_label_contains(english).is_none(), "{dialog}: {english} is untranslated");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn notes_with_a_pipe_show_in_full() {
|
|
// `tr` reads `|` as a context separator; the Open Hyperlink note carries the URL, which must
|
|
// be shown whole so the user sees where the link really goes.
|
|
let url = "https://example.com/report|evil.example";
|
|
for language in ["en", "pt"] {
|
|
let mut h = harness();
|
|
h.state_mut().run("app.language.set", json!({"language": language})).unwrap();
|
|
h.state_mut().open_dialog("openLink", json!({"url": url}));
|
|
h.run_steps(3);
|
|
assert!(h.query_by_label_contains(url).is_some(), "{language}: the link note lost part of {url}");
|
|
}
|
|
}
|