- ThemeAssets loads a theme's files; FrameSet + GradientMap (3-stop) generalise the card frame; ThreadStrip draws threads from a picture; BoardBackdrop draws scene and tile; MascotArt recolours Morgan by role (logo SVG now uses the Keep File importer); SoundBoard plays roll / card turn / thread / click / ambient with View > Sound levels. - Vaporwave, Synthwave, Cozy Autumn, Rustic, Woodsy, Sky Blue, Frutiger Aero, Gothic, Terminal: generated art (tools/theme_art), sounds (tools/theme_sounds), settings (tools/theme_defs). - Ten OFL fonts; --theme=<id> flag; docs/THEMES.md format spec; test_theme_assets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
70 lines
2.9 KiB
GDScript
70 lines
2.9 KiB
GDScript
extends TestBase
|
|
## The shared action menus (Actions): what the card, thread, group and spread
|
|
## menus offer in Play and Build, the ☰ menu, running an action, and placing
|
|
## a new card where the spread was right-clicked.
|
|
## Run: godot --headless --path . -s res://tests/test_actions.gd -- --sample
|
|
|
|
|
|
func _init() -> void:
|
|
if not await start_main():
|
|
return
|
|
await _test_lists()
|
|
await _test_popup_and_run()
|
|
finish()
|
|
|
|
|
|
func _texts(list: Array) -> Array[String]:
|
|
var out: Array[String] = []
|
|
for a: Dictionary in list:
|
|
if a.has("text"):
|
|
out.append(str(a["text"]))
|
|
return out
|
|
|
|
|
|
func _test_lists() -> void:
|
|
var t := main.data.get_table("loot")
|
|
var play := _texts(Actions.card(main, t))
|
|
_check(play.has("Roll") and not play.has("Delete table"), "Play: a card can be rolled, not deleted: %s" % str(play))
|
|
var bg := _texts(Actions.background(main, Vector2.ZERO))
|
|
_check(bg.has("Search… Ctrl+F") and bg.has("Shuffle all decks") and not bg.has("New card"), "Play spread menu: %s" % str(bg))
|
|
main.set_mode(Main.Mode.BUILD)
|
|
await _frames()
|
|
var build := _texts(Actions.card(main, t))
|
|
_check(build.has("Table settings…") and build.has("Colour") and build.has("Delete table"), "Build card menu: %s" % str(build))
|
|
bg = _texts(Actions.background(main, Vector2.ZERO))
|
|
_check(bg.has("New card") and bg.has("Group the selection Ctrl+G"), "Build spread menu: %s" % str(bg))
|
|
var key := ""
|
|
for e in t.entries:
|
|
if not e.pipes.is_empty():
|
|
key = Roller.pipe_key(t.id, e.id, e.pipes[0])
|
|
break
|
|
var th := _texts(Actions.thread(main, key))
|
|
_check(th.has("Go to the end") and th.has("Delete thread") and th.has("Colour"), "thread menu: %s" % str(th))
|
|
_check(Actions.thread(main, "nope:x>y").is_empty(), "a missing thread has no menu")
|
|
|
|
|
|
func _test_popup_and_run() -> void:
|
|
var at := Vector2(-900, -700)
|
|
var pm := Actions.popup_at(main, Actions.background(main, at), Vector2(50, 50))
|
|
await _frames()
|
|
var sub: PopupMenu = null
|
|
# The first submenu is New card ▸ (Sound ▸ comes later).
|
|
for c in pm.get_children():
|
|
if c is PopupMenu and sub == null:
|
|
sub = c
|
|
_check(sub != null and sub.item_count == MainEditing.ADD_KINDS.size(), "New card ▸ lists every kind")
|
|
var before := main.data.tables.size()
|
|
_check(Actions.press(sub, "Roll table"), "pressing an item runs it")
|
|
await _frames()
|
|
var added: RollTable = main.data.tables[main.data.tables.size() - 1]
|
|
_check(main.data.tables.size() == before + 1 and added.position.distance_to(at) < 2.0, "the new card goes where the spread was clicked: %s" % str(added.position))
|
|
pm.hide()
|
|
var t := main.data.get_table("loot")
|
|
Actions.set_card_colour(main, t, "#2f8a4f")
|
|
_check(t.color == "#2f8a4f", "Colour ▸ sets the card's colour")
|
|
main.undo_redo.undo()
|
|
_check(main.data.get_table("loot").color == "", "and it's undoable")
|
|
var bar_pm := main.top_bar.actions_menu.get_popup()
|
|
bar_pm.about_to_popup.emit()
|
|
_check(bar_pm.item_count > 4, "the ☰ menu fills with the spread's actions")
|
|
|