Save the quiz settings to the config folder
The quiz card's settings are saved to quiz_settings.cfg in OS.get_config_dir() on every change and loaded at start. Debug builds use their own file, and MUSICPLAYER_CONFIG_DIR moves the file elsewhere so tests never touch it. Count plays in statistics and Prefer less played soundtracks are not saved and move from the quiz card to the Settings popup.
This commit is contained in:
1 parent
b510aa47f2
commit
92e3a66075
15 files changed
+835
-591
No files matched your search
@@ -69,8 +69,6 @@ func test_each_toggle_changes_its_setting() -> void:
|
||||
"hide_beginning_button": "hide_beginning",
|
||||
"hide_length_button": "hide_length",
|
||||
"hide_ticks_button": "hide_ticks",
|
||||
"low_played_button": "use_low_played_mode",
|
||||
"add_to_database_button": "add_to_stats",
|
||||
}
|
||||
await _open()
|
||||
for button_name: String in toggles:
|
||||
@@ -89,12 +87,12 @@ func test_each_toggle_changes_its_setting() -> void:
|
||||
func test_card_shows_settings_changed_elsewhere() -> void:
|
||||
await _open()
|
||||
_card.close()
|
||||
Settings.add_to_stats = false
|
||||
Settings.hide_next_track = false
|
||||
Settings.auto_repeat_song = false
|
||||
|
||||
await _open()
|
||||
|
||||
assert_bool(_card.add_to_database_button.button_pressed).is_false()
|
||||
assert_bool(_card.hide_next_track_button.button_pressed).is_false()
|
||||
assert_bool(_card.auto_repeat_button.button_pressed).is_false()
|
||||
|
||||
|
||||
@@ -158,3 +156,24 @@ func test_card_grows_upward_for_the_seconds_row() -> void:
|
||||
assert_float(open_row.size.y).is_greater(closed_row.size.y)
|
||||
# Every row stays inside the card
|
||||
assert_bool(open_row.encloses(_card.rows.get_global_rect())).is_true()
|
||||
|
||||
|
||||
func test_statistics_settings_are_in_the_settings_popup_instead() -> void:
|
||||
await _open()
|
||||
|
||||
assert_object(_card.find_child("LowPlayedCheckButton")).is_null()
|
||||
assert_object(_card.find_child("AddToDatabaseCheckButton")).is_null()
|
||||
|
||||
|
||||
func test_changes_are_saved_at_once() -> void:
|
||||
Settings.hide_next_track = true
|
||||
Settings.winning_score = 20
|
||||
await _open()
|
||||
|
||||
await _click_at(_card.hide_next_track_button.get_global_rect().get_center())
|
||||
_card.lower_winning_score_button.pressed.emit()
|
||||
|
||||
var saved: ConfigFile = ConfigFile.new()
|
||||
assert_int(saved.load(Settings.quiz_settings_path())).is_equal(OK)
|
||||
assert_bool(saved.get_value("quiz", "hide_next_track")).is_false()
|
||||
assert_int(saved.get_value("quiz", "winning_score")).is_equal(19)
|
||||
Reference in new issue
Block a user