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

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:
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")