mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-25 02:07:09 -06:00
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:
co-authored by
Claude Opus 5.5
parent
7a270c8deb
commit
6efe9df3e8
@@ -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
|
/// 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]
|
#[test]
|
||||||
fn the_engine_follows_the_interface_language() {
|
fn the_engine_follows_the_interface_language() {
|
||||||
let mut app = crate::VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
|
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);
|
frame(&mut app);
|
||||||
assert_eq!(app.session.ui_language.as_deref(), Some("en"), "tests resolve `auto` to English");
|
assert_eq!(app.session.ui_language.as_deref(), Some("en"), "tests resolve `auto` to English");
|
||||||
assert!(!app.session.japanese_interface());
|
assert!(!app.session.japanese_interface());
|
||||||
app.session.prefs.interface_language = "ja".into();
|
// Each frame hands the engine the language it draws in, whatever the engine had.
|
||||||
frame(&mut app);
|
app.session.ui_language = Some("ja".into());
|
||||||
assert_eq!(app.session.ui_language.as_deref(), Some("ja"));
|
|
||||||
assert!(app.session.japanese_interface());
|
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
|
/// VectorCraft › Language (`app.language`) sets the `interfaceLanguage` preference, which is what
|
||||||
|
|||||||
Reference in New Issue
Block a user