Buttons get 12 px of side padding. The top bar buttons, the quiz toolbar and Show answer/Next are laid out in rows with 12 px gaps and are all 36 px tall, and the ±1 buttons use a compact StepButton style. "Randomize new track" is now "Next song". Player rows show the name and the score apart, alternate like the other lists and highlight the character under the mouse. The name field is a LineEdit with a 10-letter limit; blank and duplicate names are refused, and a full list says "Up to 7 players". Remove buttons update when editing is switched instead of every frame, and the spacer panels are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.2 KiB
GDScript
69 lines
2.2 KiB
GDScript
extends MainWindowTestSuite
|
|
## The statistics settings in the application Settings popup.
|
|
|
|
var _popup: SettingsPopup
|
|
|
|
|
|
func before_test() -> void:
|
|
await super()
|
|
_popup = _window.get_node("SettingsPopup")
|
|
|
|
|
|
func test_less_played_toggle_changes_the_setting() -> void:
|
|
Settings.use_low_played_mode = false
|
|
_popup.open()
|
|
await _runner.simulate_frames(1)
|
|
assert_bool(_popup.low_played_button.button_pressed).is_false()
|
|
|
|
await _click_at(_popup.low_played_button.get_global_rect().get_center())
|
|
|
|
assert_bool(Settings.use_low_played_mode).is_true()
|
|
|
|
|
|
func test_statistics_toggle_changes_the_setting() -> void:
|
|
Settings.add_to_stats = true
|
|
_popup.open()
|
|
await _runner.simulate_frames(1)
|
|
assert_bool(_popup.add_to_database_button.button_pressed).is_true()
|
|
|
|
await _click_at(_popup.add_to_database_button.get_global_rect().get_center())
|
|
|
|
assert_bool(Settings.add_to_stats).is_false()
|
|
|
|
|
|
func test_statistics_settings_are_not_saved_with_the_quiz_settings() -> void:
|
|
Settings.add_to_stats = false
|
|
Settings.use_low_played_mode = true
|
|
|
|
Settings.save_settings()
|
|
|
|
var saved: ConfigFile = ConfigFile.new()
|
|
assert_int(saved.load(Settings.saved_settings_path())).is_equal(OK)
|
|
assert_bool(saved.has_section_key("quiz", "add_to_stats")).is_false()
|
|
assert_bool(saved.has_section_key("quiz", "use_low_played_mode")).is_false()
|
|
|
|
|
|
func test_popup_fits_its_rows_and_is_centred() -> void:
|
|
_popup.open()
|
|
await _runner.simulate_frames(1)
|
|
|
|
var panel: Rect2 = _popup.settings_panel.get_global_rect()
|
|
var rows: Control = _popup.settings_panel.get_node("VBoxContainer")
|
|
assert_bool(panel.encloses(rows.get_global_rect())).is_true()
|
|
# The rows' own height fits, so the last toggle is not squeezed or cut off
|
|
assert_float(rows.get_combined_minimum_size().y).is_less_equal(rows.size.y)
|
|
assert_vector(panel.get_center()).is_equal_approx(Vector2(960, 540), Vector2(1, 1))
|
|
|
|
|
|
func test_open_folder_button_shows_the_config_folder() -> void:
|
|
var shown: Array[String] = []
|
|
_popup.show_folder = func(dir: String) -> void: shown.append(dir)
|
|
_popup.open()
|
|
await _runner.simulate_frames(1)
|
|
|
|
await _click_at(_popup.open_config_folder_button.get_global_rect().get_center())
|
|
|
|
assert_array(shown).contains_exactly([Settings.config_dir()])
|
|
assert_bool(DirAccess.dir_exists_absolute(Settings.config_dir())).is_true()
|
|
|