Files
MusicPlayer/tests/integration/test_theme_picker.gd
T
SansanandClaude Opus 5.5 de94691073
Build / test (push) Successful in 1m31s
Build / build (push) Successful in 1m14s
Add a Nord theme and give the player bar room around it (#43)
Nord (themes/nord_theme.tres) uses the app icon's blues, darkened, with Nord's
Snow Storm text, Frost and Aurora accents and the playing song in Aurora
yellow. Its shapes are round: pill buttons and tabs, 14-16 px corners, soft
shadows on popups, cards and the player bar, rounded scroll bars, sliders and
text fields, and seven Aurora/Frost colours for the score graph. Classic stays
the default.

The player bar now has 16 px to the song buttons, the player list, Quiz
settings and the window's bottom edge, and the right edges line up at 1856.

The volume icon is a flat button with a PlayerIcon style, so each theme colours
it; it was nearly invisible on Original web's light grey bar.

Closes #43

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 21:06:39 +02:00

75 lines
2.5 KiB
GDScript

extends MainWindowTestSuite
## Picking a theme in Settings switches the whole game's look at once and is saved.
var _settings: SettingsPopup
func before_test() -> void:
await super()
_settings = _window.get_node("SettingsPopup")
func after_test() -> void:
Settings.apply_theme(Settings.THEMES[0].id)
await super()
func _pick(theme_name: String) -> void:
var index: int = Settings.THEMES.map(
func(entry: Dictionary) -> String: return entry.name).find(theme_name)
_settings.theme_button.select(index)
_settings.theme_button.item_selected.emit(index)
await _runner.simulate_frames(1)
func test_picker_lists_every_theme_and_shows_the_one_in_use() -> void:
var names: Array[String] = []
for index: int in _settings.theme_button.item_count:
names.append(_settings.theme_button.get_item_text(index))
assert_array(names).contains_exactly(["Classic", "Original web", "Nord"])
assert_str(_settings.theme_button.get_item_text(_settings.theme_button.selected)) \
.is_equal("Classic")
func test_picking_a_theme_switches_the_look_at_once() -> void:
var button: Button = _window.get_node("TopBar/%SyncButton")
var classic_text: Color = button.get_theme_color(&"font_color")
var panel: Panel = _window.get_node("SettingsPopup/SettingsPanel")
var popup_style: StyleBox = panel.get_theme_stylebox(&"panel")
await _pick("Original web")
assert_str(Settings.theme_id).is_equal("original_web")
assert_str(_window.get_tree().root.theme.resource_path) \
.is_equal("res://themes/original_web_theme.tres")
assert_object(panel.get_theme_stylebox(&"panel")).is_not_same(popup_style)
# The web version's buttons have orange text
assert_bool(button.get_theme_color(&"font_color") != classic_text).is_true()
func test_chosen_theme_is_saved() -> void:
await _pick("Original web")
var saved: ConfigFile = ConfigFile.new()
assert_int(saved.load(Settings.saved_settings_path())).is_equal(OK)
assert_str(saved.get_value("app", "theme_id")).is_equal("original_web")
func test_backdrop_and_graph_follow_the_theme() -> void:
var backdrop: PopupBackdrop = _window.get_node("PopupBackdrop")
var classic: Color = backdrop.color
await _pick("Original web")
assert_object(backdrop.color).is_equal(backdrop.get_theme_color(&"backdrop", &"Palette"))
assert_bool(backdrop.color != classic).is_true()
func test_unknown_theme_falls_back_to_the_default() -> void:
Settings.apply_theme("no_such_theme")
assert_str(Settings.theme_id).is_equal("classic")
assert_str(_window.get_tree().root.theme.resource_path) \
.is_equal("res://themes/main_theme.tres")