2026-11-10 19:53:07 -06:00
|
|
|
|
extends TestBase
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
|
## The top bar's menus (View ▾, the zoom control, Board ▾ with Pack, Help ▾),
|
|
|
|
|
|
## striped result rows, the Build card's ⋯ menu and the row × that shows on
|
|
|
|
|
|
## hover or selection, and the Help window's topics and links.
|
|
|
|
|
|
## Run: godot --headless --path . -s res://tests/test_top_bar.gd -- --sample
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _init() -> void:
|
2026-11-10 19:53:07 -06:00
|
|
|
|
if not await start_main():
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
|
return
|
|
|
|
|
|
main.set_anchors_and_offsets_preset(Control.PRESET_TOP_LEFT)
|
|
|
|
|
|
main.size = Vector2(1440, 900)
|
|
|
|
|
|
_test_bar()
|
|
|
|
|
|
await _test_zoom()
|
|
|
|
|
|
await _test_view_menu()
|
|
|
|
|
|
await _test_stripes()
|
|
|
|
|
|
await _test_card_menu()
|
|
|
|
|
|
await _test_help()
|
2026-11-10 19:53:07 -06:00
|
|
|
|
finish()
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _test_bar() -> void:
|
|
|
|
|
|
var bar := main.top_bar
|
|
|
|
|
|
_check(bar.view_menu != null and bar.help_menu != null and bar.zoom != null, "View ▾, Help ▾ and the zoom control are on the bar")
|
|
|
|
|
|
var texts: Array[String] = []
|
|
|
|
|
|
for n in bar._build_tools.find_children("*", "Button", true, false):
|
|
|
|
|
|
texts.append((n as Button).text)
|
|
|
|
|
|
_check(not texts.has("Arrange ▾"), "Arrange ▾ is gone from the Build tools: %s" % str(texts))
|
|
|
|
|
|
var pm := bar._board_menu.get_popup()
|
2026-11-10 18:24:23 -06:00
|
|
|
|
_check(pm.get_item_index(IoMenu.ID_PACK) >= 0, "Spread ▾ has Pack collapsed groups")
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
|
_check(main.nav._search_button.text == "", "Search is an icon button")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _test_zoom() -> void:
|
|
|
|
|
|
var z := main.top_bar.zoom
|
|
|
|
|
|
z.activate(ZoomControl.ID_ACTUAL)
|
|
|
|
|
|
await _frames()
|
|
|
|
|
|
_eq(main.board.zoom, 1.0, "Zoom to 100% sets the zoom")
|
|
|
|
|
|
_eq(z.menu.text, "100% ▾", "the percentage follows")
|
|
|
|
|
|
main.board.set_zoom(0.5)
|
|
|
|
|
|
await _frames()
|
|
|
|
|
|
_eq(z.menu.text, "50% ▾", "and follows zoom changes from elsewhere")
|
|
|
|
|
|
z.activate(ZoomControl.ID_FIT)
|
2026-11-10 18:24:23 -06:00
|
|
|
|
_check(main.board.zoom != 0.5, "Fit spread changes the zoom")
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _test_view_menu() -> void:
|
|
|
|
|
|
var v := main.top_bar.view_menu
|
|
|
|
|
|
v.activate(ViewMenu.ID_TEXT)
|
|
|
|
|
|
_eq(main.rules_view(), "text", "Rule text")
|
|
|
|
|
|
v.activate(ViewMenu.ID_PLAIN)
|
|
|
|
|
|
_eq(main.rules_view(), "plain", "Plain words")
|
|
|
|
|
|
var was := main.board.minimap.visible
|
|
|
|
|
|
v.activate(ViewMenu.ID_MINIMAP)
|
|
|
|
|
|
_check(main.board.minimap.visible != was, "Minimap toggles")
|
|
|
|
|
|
v.activate(ViewMenu.ID_MINIMAP)
|
|
|
|
|
|
v.activate(ViewMenu.ID_COLLAPSE)
|
|
|
|
|
|
await _frames()
|
|
|
|
|
|
_eq(v.collapse_label(), "Expand all tables", "after Collapse all the menu offers Expand")
|
|
|
|
|
|
v.activate(ViewMenu.ID_COLLAPSE)
|
|
|
|
|
|
await _frames()
|
|
|
|
|
|
_eq(v.collapse_label(), "Collapse all tables", "and Expand all puts it back")
|
|
|
|
|
|
v.sync()
|
|
|
|
|
|
var pm := v.get_popup()
|
|
|
|
|
|
_check(pm.is_item_checked(pm.get_item_index(ViewMenu.ID_PLAIN)) and pm.is_item_checked(pm.get_item_index(ViewMenu.ID_STRIPES)),
|
|
|
|
|
|
"the menu checks Plain words and Striped rows")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _row_bg(card: TableCard, index: int) -> Color:
|
|
|
|
|
|
var e := card.table.entries[index]
|
|
|
|
|
|
return ((card.rows[e.id] as PanelContainer).get_theme_stylebox("panel") as StyleBoxFlat).bg_color
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _test_stripes() -> void:
|
|
|
|
|
|
var card := main.card_for("loot")
|
|
|
|
|
|
_check(main.local_state.striped_rows(), "stripes are on by default")
|
|
|
|
|
|
_eq(_row_bg(card, 0), Color(0, 0, 0, 0), "the first row is clear")
|
|
|
|
|
|
_eq(_row_bg(card, 1), Style.STRIPE, "the second row is striped")
|
|
|
|
|
|
_eq(_row_bg(card, 2), Color(0, 0, 0, 0), "the third row is clear")
|
|
|
|
|
|
card.rows_ui.set_row_state(card.table.entries[1].id, TableCardRows.RowState.LIT)
|
|
|
|
|
|
_eq(_row_bg(card, 1), Style.LIT, "a lit row shows lit, not striped")
|
|
|
|
|
|
card.rows_ui.restate(card.table.entries[1].id)
|
|
|
|
|
|
main.top_bar.view_menu.activate(ViewMenu.ID_STRIPES)
|
|
|
|
|
|
_eq(_row_bg(card, 1), Color(0, 0, 0, 0), "turning stripes off clears them")
|
|
|
|
|
|
main.top_bar.view_menu.activate(ViewMenu.ID_STRIPES)
|
|
|
|
|
|
_eq(_row_bg(card, 1), Style.STRIPE, "and back on")
|
|
|
|
|
|
await _frames()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _test_card_menu() -> void:
|
|
|
|
|
|
main.set_mode(Main.Mode.BUILD)
|
|
|
|
|
|
await _frames()
|
|
|
|
|
|
var card := main.card_for("loot")
|
|
|
|
|
|
var menus := card.find_children("*", "MenuButton", true, false)
|
|
|
|
|
|
_check(menus.size() == 1 and (menus[0] as MenuButton).tooltip_text == "Table actions", "the card has one ⋯ menu")
|
|
|
|
|
|
var texts: Array[String] = []
|
|
|
|
|
|
for n in card.find_children("*", "Button", true, false):
|
|
|
|
|
|
texts.append((n as Button).text)
|
|
|
|
|
|
_check(not texts.has("⚙") and not texts.has("Delete"), "no gear and no footer Delete: %s" % str(texts))
|
|
|
|
|
|
|
|
|
|
|
|
var eid := card.table.entries[2].id
|
|
|
|
|
|
var del: Button = card.rows_ui.parts[eid]["delete"]
|
|
|
|
|
|
_eq(del.modulate.a, 0.0, "a row's × is hidden until hovered")
|
|
|
|
|
|
card.select_entry(eid)
|
|
|
|
|
|
_eq(del.modulate.a, 1.0, "the selected row shows its ×")
|
|
|
|
|
|
card.select_entry("")
|
|
|
|
|
|
_eq(del.modulate.a, 0.0, "and hides it again when deselected")
|
|
|
|
|
|
|
|
|
|
|
|
var pm := (menus[0] as MenuButton).get_popup()
|
2026-11-10 18:35:24 -06:00
|
|
|
|
_check(Actions.press(pm, "Delete table"), "⋯ has Delete table")
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
|
await _frames()
|
|
|
|
|
|
_check(main.data.get_table("loot") == null, "⋯ → Delete table deletes it")
|
|
|
|
|
|
main.undo_redo.undo()
|
|
|
|
|
|
await _frames()
|
|
|
|
|
|
_check(main.data.get_table("loot") != null, "and undo brings it back")
|
|
|
|
|
|
main.set_mode(Main.Mode.PLAY)
|
|
|
|
|
|
await _frames()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _test_help() -> void:
|
|
|
|
|
|
var titles := HelpDialog.titles()
|
2026-11-10 18:24:23 -06:00
|
|
|
|
_check(titles.size() >= 10 and titles.has("Deck mode") and titles.has("Roll modifiers"), "help has its topics: %s" % str(titles))
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
|
var src := FileAccess.get_file_as_string(HelpDialog.PATH)
|
|
|
|
|
|
var re := RegEx.create_from_string("\\[topic\\](.+?)\\[/topic\\]")
|
|
|
|
|
|
for m in re.search_all(src):
|
|
|
|
|
|
_check(titles.has(m.get_string(1)), "the link to “%s” has a topic" % m.get_string(1))
|
|
|
|
|
|
for t: Dictionary in HelpDialog.topics():
|
|
|
|
|
|
_check(str(t["body"]).length() > 80, "“%s” has text" % t["title"])
|
|
|
|
|
|
_check(HelpDialog._inline("`[[Loot]]`").contains("[lb][lb]Loot[rb][rb]"), "code spans keep their brackets")
|
|
|
|
|
|
|
2026-11-10 18:24:23 -06:00
|
|
|
|
var d := main.top_bar.help_menu.open("deck MODE")
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
|
await _frames()
|
2026-11-10 18:24:23 -06:00
|
|
|
|
_eq(d.current, "Deck mode", "Help opens at the asked topic, any case")
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
|
d._on_meta("topic:Roll modifiers")
|
|
|
|
|
|
_eq(d.current, "Roll modifiers", "a topic link switches topics")
|
|
|
|
|
|
_check(d.text.get_parsed_text().contains("Luck"), "and shows its text")
|
|
|
|
|
|
d.close()
|
|
|
|
|
|
await _frames()
|