Settings has a Music folder row. A folder with subfolders is played as soundtracks: Next picks a random subfolder and a random song in it, the subfolder is the answer's soundtrack and the file name without its type the song. The inspiration list and Search show the subfolders. A folder with songs and no subfolders is a prepared quiz, played once in order (natural sort) or at random, showing only the song title. It has no winning score: after the last song Next becomes Show winner, and the players with the most points win, ties included. While a folder is used nothing but the characters is asked from the server: Sync, QR, Statistics, the update check and play counting are off. Characters fall back to the cached pictures when the server can't be reached. mp3, ogg and wav play; other files and broken ones are skipped. The old local playback code, the hidden Open button and the hidden Local toggle are removed. Next now waits for the song to start before preparing the next one.
56 lines
1.8 KiB
GDScript
56 lines
1.8 KiB
GDScript
extends MainWindowTestSuite
|
|
## The statistics settings in the application Settings popup.
|
|
|
|
var _popup: SettingsPopup
|
|
|
|
|
|
func before_test() -> void:
|
|
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))
|