Fix and tidy the Character select, Shortcuts, Log and QR popups
Build / test (push) Successful in 41s
Build / build (push) Successful in 1m13s

Character select
- A card only picks its character when it is clicked. Before, every card
  watched every click, so clicking below the panel could pick a card
  scrolled out of view there.
- Six columns of fixed-size cards that scroll for any number of
  characters, with a gap between the cards and the scrollbar.
- Pictures are read as PNG, JPG or WebP by their first bytes, so JPGs no
  longer print an error. Names are split into words ("Paper Mario") and
  the card under the mouse is highlighted.

Shortcuts
- Alt+Z restarts the song; it was listed as "Reset".
- Grouped by what the keys do, in sentence case, and the panel fits the
  list. A test checks that every button shortcut is listed.

Log
- Scrolls to the newest row, alternates row colours and says "Nothing
  has happened yet" when empty.

QR
- A title, and the code is set up in one place.
This commit is contained in:
Sansan committed 2026-10-07 15:24:43 +02:00
1 parent b2d547b650
commit 8d21b0617d
23 files changed
+4694 -5349

No files matched your search

@@ -0,0 +1,71 @@
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://localhost:8080"
_qr.open()
assert_str(_qr.url_label.text).is_equal("http://localhost:8080/search")
assert_str(_qr.qr_code_rect.data).is_equal("http://localhost:8080/search")