Files
MusicPlayer/tests/integration/test_stats_after_win.gd
T
Sansan b510aa47f2
Build / test (push) Successful in 44s
Build / build (push) Successful in 1m13s
Split settings into a quiz card and an application Settings popup
- A Quiz settings button under the player bar opens a small card above
  it with the quiz settings, including Auto repeat, which moves there
  from under the player bar. The card does not dim the quiz, so it can
  be changed during a song, and grows to fit its rows.
- A Settings button in the top bar opens the application settings:
  server, fullscreen and songs to download ahead. Quick sync is gone,
  as the server no longer has it, and the server list is in Settings.
- Labels use sentence case, and seconds to hide show as whole numbers.
- Debug builds switch to the local server and a low winning score in
  the Settings autoload, before any scene asks the server for anything.
  The DEBUG label moves to the top bar, so it shows on every tab.
- Search moves from the top bar back to the quiz toolbar, as the
  Statistics tab has its own search.
2026-10-07 16:05:13 +02:00

66 lines
1.6 KiB
GDScript

extends MainWindowTestSuite
## Winning turns statistics off until a new game starts.
var _crono: PlayerObject
func before_test() -> void:
super()
_crono = _add_player("Crono")
await _play_first_song()
Settings.winning_score = 1
func _stats_checkbox() -> CheckButton:
return _quiz.get_node("QuizSettingsCard").get_node("%AddToDatabaseCheckButton")
func test_winning_turns_statistics_off() -> void:
await _give_point_with_keybind(1)
assert_bool(Settings.add_to_stats).is_false()
func test_resetting_points_turns_statistics_back_on() -> void:
await _give_point_with_keybind(1)
_press("QuizToolbar/ResetPointsButton")
assert_bool(Settings.add_to_stats).is_true()
func test_statistics_turned_off_by_hand_stay_off_after_reset() -> void:
Settings.add_to_stats = false
await _give_point_with_keybind(1)
_press("QuizToolbar/ResetPointsButton")
assert_bool(Settings.add_to_stats).is_false()
func test_settings_checkbox_shows_statistics_off_after_win() -> void:
await _give_point_with_keybind(1)
_press("QuizSettingsButton")
assert_bool(_stats_checkbox().button_pressed).is_false()
func test_songs_after_a_win_are_not_counted() -> void:
await _give_point_with_keybind(1)
var played_before: int = _server.count("/music/played?song=0")
_press("SongControls/ShowAnswerButton")
assert_int(_server.count("/music/played?song=0")).is_equal(played_before)
func test_winning_score_cannot_go_below_one() -> void:
_press("QuizSettingsButton")
var lower_button: Button = _quiz.get_node("QuizSettingsCard").get_node("%LowerButton")
for i: int in 3:
lower_button.pressed.emit()
assert_int(Settings.winning_score).is_equal(1)