Files
MusicPlayer/tests/integration/test_log_and_qr_popups.gd
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

72 lines
2.2 KiB
GDScript

extends MainWindowTestSuite
## The Log popup (rows, empty state, scrolling to the newest row) and the QR popup.
var _log: LogPopup
var _qr: QRPopup
func before_test() -> void:
await super()
_log = _window.get_node("LogPopup")
_qr = _window.get_node("QRPopup")
func test_empty_log_says_so() -> void:
_log.open()
assert_bool(_log.empty_label.visible).is_true()
func test_log_rows_alternate_and_hide_the_empty_text() -> void:
_log.add_log_row("Crono got a point")
_log.add_log_row("Marle got a point")
_log.open()
var rows: Array[Node] = _log.log_box.get_children()
assert_str((rows[0] as ListRow).text).ends_with("Crono got a point")
assert_str(String((rows[0] as ListRow).theme_type_variation)).is_equal("ListRowEven")
assert_str(String((rows[1] as ListRow).theme_type_variation)).is_equal("ListRowOdd")
assert_bool(_log.empty_label.visible).is_false()
func test_log_shows_the_newest_row() -> void:
_log.open()
for i: int in 40:
_log.add_log_row("Event %d" % i)
await _runner.simulate_frames(4)
var scroll: ScrollContainer = _log.log_scroll
var newest: Rect2 = (_log.log_box.get_children().back() as Control).get_global_rect()
assert_bool(scroll.get_global_rect().encloses(newest)).is_true()
func test_log_scrolls_to_the_newest_row_when_opened() -> void:
for i: int in 40:
_log.add_log_row("Event %d" % i)
_log.open()
await _runner.simulate_frames(4)
var newest: Rect2 = (_log.log_box.get_children().back() as Control).get_global_rect()
assert_bool(_log.log_scroll.get_global_rect().encloses(newest)).is_true()
func test_qr_popup_has_a_title_and_the_search_address() -> void:
_qr.open()
assert_str((_qr.qr_panel.get_node("TitleLabel") as Label).text) \
.is_equal("Scan to search on your phone")
assert_str(_qr.url_label.text).is_equal(Settings.default_path + "/search")
assert_str(_qr.qr_code_rect.data).is_equal(_qr.url_label.text)
func test_qr_code_follows_the_server_picked_in_the_settings() -> void:
_qr.open()
_qr.close()
Settings.default_path = "http://another-server:8080"
_qr.open()
assert_str(_qr.url_label.text).is_equal("http://another-server:8080/search")
assert_str(_qr.qr_code_rect.data).is_equal("http://another-server:8080/search")