M3: the theme button test starts on System (#1248)

The click-cycle test assumed a fresh install starts Light; it starts on
System now, so the cycle is System, Light, Dark.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
mtlcl410
2026-10-22 23:41:18 +08:00
co-authored by Claude Fable 5.1
parent 62c595ceba
commit 7e94c24532
2 changed files with 9 additions and 8 deletions
+4 -3
View File
@@ -237,12 +237,13 @@ fn preferences_theme_cards_and_use_system_setting_stay_in_sync() {
combo.value().unwrap_or_default()
}
let mut h = harness();
h.get_by_label("Display theme: Light gray").click_secondary();
h.get_by_label("Display theme: Use system setting").click_secondary();
h.run_steps(4);
h.get_by_label("Appearance settings…").click();
h.run_steps(10);
assert_theme(&h, ThemePreference::Light, ThemeKind::Light);
assert_eq!(mode_shown(&h), "Light");
// A fresh install follows the OS (#1248), which is dark here.
assert_theme(&h, ThemePreference::System, ThemeKind::Dark);
assert_eq!(mode_shown(&h), "Use system setting");
// The OS is dark: the Dark card's radio row picks Dark, and the combo box says so.
// The cards sit below the fold of the Preferences scroll area at this window size.
+5 -5
View File
@@ -1,5 +1,5 @@
//! The title bar's theme button: a click cycles System, Light and Dark; a right-click opens the
//! menu with the appearance settings.
//! The title bar's theme button: a click cycles System, Light and Dark (a fresh install starts
//! on System, #1248); a right-click opens the menu with the appearance settings.
use egui_kittest::Harness;
use egui_kittest::kittest::Queryable;
@@ -22,9 +22,9 @@ fn preference(h: &Harness<'static, PdfCraftApp>) -> String {
#[test]
fn a_click_cycles_the_theme_and_a_right_click_opens_the_menu() {
let mut h = harness();
assert_eq!(preference(&h), "Light", "new installs start Light");
assert_eq!(preference(&h), "System", "a fresh install follows the desktop (#1248)");
for (label, next) in
[("Display theme: Light gray", "Dark"), ("Display theme: Dark gray", "System"), ("Display theme: Use system setting", "Light")]
[("Display theme: Use system setting", "Light"), ("Display theme: Light gray", "Dark"), ("Display theme: Dark gray", "System")]
{
h.get_by_label(label).click();
h.run_steps(4);
@@ -32,7 +32,7 @@ fn a_click_cycles_the_theme_and_a_right_click_opens_the_menu() {
}
assert!(h.query_by_label("Appearance settings…").is_none(), "a plain click opens no menu");
h.get_by_label("Display theme: Light gray").click_secondary();
h.get_by_label("Display theme: Use system setting").click_secondary();
h.run_steps(4);
h.get_by_label("Appearance settings…").click();
h.run_steps(4);