Files
MusicPlayer/tests/integration/test_update_notice.gd
T
SansanandClaude Opus 5.5 70e970b24c
Build / test (push) Successful in 1m30s
Build / build (push) Successful in 1m17s
Make the buttons consistent and rework the player list
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>
2026-10-11 21:35:24 +02:00

75 lines
2.4 KiB
GDScript

extends MainWindowTestSuite
## The top bar tells the user when the server has a newer MusicPlayer release.
var _top_bar: TopBar
func before_test() -> void:
await super()
_top_bar = _window.get_node("TopBar")
func test_no_message_when_this_is_the_newest_version() -> void:
assert_bool(_top_bar.update_label.visible).is_false()
assert_int(_server.count("/download")).is_equal(1)
func test_newer_release_shows_a_message() -> void:
_server.respond_json("/download", "99.0.0")
_top_bar.check_for_update()
assert_bool(_top_bar.update_label.is_visible_in_tree()).is_true()
assert_str(_top_bar.update_label.text).is_equal("Version 99.0.0 is available")
assert_str(_top_bar.update_label.tooltip_text).contains(Settings.version)
func test_message_fits_between_the_tabs_and_the_buttons() -> void:
_server.respond_json("/download", "99.10.10")
_top_bar.check_for_update()
await _runner.simulate_frames(1)
var label: Rect2 = _top_bar.update_label.get_global_rect()
var text_width: float = _top_bar.update_label.get_minimum_size().x
assert_float(text_width).is_less_equal(label.size.x)
assert_float(label.position.x).is_greater(
(_top_bar.get_node("%StatisticsTab") as Control).get_global_rect().end.x)
assert_float(label.end.x).is_less(
(_top_bar.get_node("%SyncButton") as Control).get_global_rect().position.x)
func test_message_stays_on_the_statistics_tab() -> void:
_server.respond_json("/download", "99.0.0")
_top_bar.check_for_update()
_window.show_tab(&"statistics")
assert_bool(_top_bar.update_label.is_visible_in_tree()).is_true()
func test_server_change_checks_again() -> void:
_server.respond_json("/download", "99.0.0")
_quiz.on_server_changed()
assert_bool(_top_bar.update_label.visible).is_true()
func test_failed_check_shows_nothing() -> void:
_server.respond_json("/download", "error", 502)
_top_bar.check_for_update()
assert_bool(_top_bar.update_label.visible).is_false()
func test_version_comparison() -> void:
assert_bool(TopBar.is_newer_version("2.0.1", "2.0.0")).is_true()
assert_bool(TopBar.is_newer_version("1.10.0", "1.9.0")).is_true()
assert_bool(TopBar.is_newer_version("v3.0", "2.9.9")).is_true()
assert_bool(TopBar.is_newer_version("2.1", "2.0.5")).is_true()
assert_bool(TopBar.is_newer_version("2.0.0", "2.0.0")).is_false()
assert_bool(TopBar.is_newer_version("2.0", "2.0.0")).is_false()
assert_bool(TopBar.is_newer_version("1.9.0", "2.0.0")).is_false()
assert_bool(TopBar.is_newer_version("1.9.9", "1.10.0")).is_false()