Type (#432): the language test keeps its frames in English

The drawing language is process-wide, so a Japanese frame translated the
tests running beside it (Appearance, Attributes, menus). The test now
checks that each frame hands the engine its language without leaving
English.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic 2026-10-09 00:28:49 +07:00
parent 7a270c8deb
commit 6efe9df3e8
1 changed files with 9 additions and 4 deletions

View File

@ -172,7 +172,8 @@ fn partial_catalogs_only_translate_strings_the_ui_shows() {
}
/// The engine learns the language the UI is drawn in each frame: new type takes the Japanese
/// defaults while it is Japanese (#432).
/// defaults while it is Japanese (#432). The frames stay in English: the drawing language is
/// process-wide, and a Japanese frame would translate the tests running beside this one.
#[test]
fn the_engine_follows_the_interface_language() {
let mut app = crate::VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
@ -183,10 +184,14 @@ fn the_engine_follows_the_interface_language() {
frame(&mut app);
assert_eq!(app.session.ui_language.as_deref(), Some("en"), "tests resolve `auto` to English");
assert!(!app.session.japanese_interface());
app.session.prefs.interface_language = "ja".into();
frame(&mut app);
assert_eq!(app.session.ui_language.as_deref(), Some("ja"));
// Each frame hands the engine the language it draws in, whatever the engine had.
app.session.ui_language = Some("ja".into());
assert!(app.session.japanese_interface());
frame(&mut app);
assert_eq!(app.session.ui_language.as_deref(), Some("en"));
// The language a frame would draw in follows the preference.
app.session.prefs.interface_language = "ja".into();
assert_eq!(app.ui_language().code(), "ja");
}
/// VectorCraft › Language (`app.language`) sets the `interfaceLanguage` preference, which is what