text, ui: borrow the app at the test call sites, and drop a redundant lifetime
Two things are one level deeper than the first pass at this review: - Nine of the call sites that pass the resolved language are inside test functions, where `app` is owned, so `crate::i18n::language(app)` needs `&app`. `cargo check --all-targets` (which compiles the test modules as well) is what reported them; a check without it does not, which is how they survived the first round. - `clippy -D warnings` rejects the explicit `'static` on `const KANA` / `const HAN`: a const already has one. On this branch `cargo fmt --all --check`, `cargo check -p effectcraft-ui-egui --all-targets`, `cargo clippy -p effectcraft-ui-egui --all-targets -- -D warnings` and `cargo test -p effectcraft-ui-egui` (40 targets, 113 lib tests) are clean.
This commit is contained in:
@@ -194,7 +194,7 @@ mod tests {
|
||||
fn gallery_lists_renders_and_opens_templates() {
|
||||
let mut app = app_with_store();
|
||||
let ctx = egui::Context::default();
|
||||
crate::theme::install(&ctx, &app.tokens, crate::i18n::language(app));
|
||||
crate::theme::install(&ctx, &app.tokens, crate::i18n::language(&app));
|
||||
// File ▸ New ▸ New Project from Template… opens the Templates tab.
|
||||
let ev = app.session.execute("file.newFromTemplate", json!({})).unwrap();
|
||||
assert_eq!(ev["frontend"], "file.newFromTemplate");
|
||||
@@ -250,7 +250,7 @@ mod tests {
|
||||
fn my_custom_rgb_dialog() {
|
||||
let mut app = app_with_store();
|
||||
let ctx = egui::Context::default();
|
||||
crate::theme::install(&ctx, &app.tokens, crate::i18n::language(app));
|
||||
crate::theme::install(&ctx, &app.tokens, crate::i18n::language(&app));
|
||||
// Menu check marks follow the active comp's viewer.
|
||||
app.session.execute("comp.new", json!({"name": "C", "width": 64, "height": 48})).unwrap();
|
||||
let item = crate::menus::menu_items(&app).into_iter().find(|m| m.id == "view.customRgb").expect("menu item");
|
||||
|
||||
Reference in New Issue
Block a user