Vitrine der Stilproben

Das Startmenü führt zu einer Vitrine, die den gewählten Stil an einer
kleinen Szene zeigt: Fels, toter und lebendiger Boden, Lebensmoos, eine
Ranke, die Steine in eine erwachende Ruine trägt, eine wachsende
Faserpflanze, ein hüpfendes Weidetier und zwei Spielfiguren. Knöpfe,
die Tasten 1 bis 3 und F2 wechseln den Stil, Esc führt zurück ins Menü.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Steven Wroblewski
2026-10-02 12:27:26 +02:00
parent 69b642cc60
commit 9f65823f2d
11 changed files with 411 additions and 3 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ extends TestCase
func test_every_action_of_the_game_exists() -> void:
InputSetup.install()
for action in ["move_up", "move_down", "move_left", "move_right", "dig", "save_game", "load_game", "toggle_pause"]:
for action in ["move_up", "move_down", "move_left", "move_right", "dig", "save_game", "load_game", "toggle_pause", "next_style", "back", "style_1", "style_2", "style_3"]:
check(InputMap.has_action(action), "action %s" % action)
+15
View File
@@ -425,3 +425,18 @@ func test_own_hits_reported_late_show_no_second_burst() -> void:
main._apply(reports)
check_eq(main.map_view.burst_count(), 2, "two own hits, two bursts")
_clean_up([directory])
func test_the_style_samples_open_from_the_menu_and_lead_back_to_it() -> void:
var directory := TestFiles.temporary_dir("showcase")
var main := _start_main(directory)
main.menu.showcase_button.pressed.emit()
check(main.showcase.visible, "the samples show")
check(not main.menu.visible, "instead of the menu")
main.showcase.style_buttons[2].pressed.emit()
check_eq(main.art.style.key(), GlowStyle.KEY, "a button there chooses the style")
await tree.process_frame
main.showcase.back_button.pressed.emit()
check(main.menu.visible, "the menu is back")
check(not main.showcase.visible, "the samples are gone")
_clean_up([directory])
+10
View File
@@ -35,3 +35,13 @@ func test_the_name_and_the_status_line() -> void:
check_eq(menu.status(), "Verbinde …", "the status is shown")
check_eq(menu.solo_button.text, tr("MENU_SOLO"), "the labels come from the texts")
_free(menu)
func test_the_way_to_the_style_samples() -> void:
var menu := _menu()
var chosen := [0]
menu.showcase_chosen.connect(func() -> void: chosen[0] += 1)
check_eq(menu.showcase_button.text, tr("MENU_SHOWCASE"), "the button says where it leads")
menu.showcase_button.pressed.emit()
check_eq(chosen[0], 1, "it asks for the samples")
_free(menu)
+61
View File
@@ -0,0 +1,61 @@
extends TestCase
## The showcase of the style samples: how its things move, and that it shows
## every style.
func test_the_plant_grows_from_a_seed_and_starts_again() -> void:
check_eq(Showcase.growth_at(0.0), 0.0, "a seed at first")
check(is_equal_approx(Showcase.growth_at(Showcase.GROW_SECONDS / 2.0), 0.5), "half grown halfway")
check_eq(Showcase.growth_at(Showcase.GROW_SECONDS), 1.0, "grown")
check_eq(Showcase.growth_at(Showcase.GROW_SECONDS + Showcase.GROWN_SECONDS - 0.01), 1.0, "it stays grown for a while")
check_eq(Showcase.growth_at(Showcase.GROW_SECONDS + Showcase.GROWN_SECONDS), 0.0, "then a seed again")
func test_the_animal_hops_then_rests_near_its_home() -> void:
check_eq(Showcase.hop_at(0.0), 0.0, "taking off")
check(is_equal_approx(Showcase.hop_at(Showcase.HOP_SECONDS / 2.0), 0.5), "in the air")
check_eq(Showcase.hop_at(Showcase.HOP_SECONDS), 1.0, "landed")
check_eq(Showcase.hop_at(Showcase.HOP_EVERY - 0.01), 1.0, "resting until the next hop")
for tenth in 100:
var at := Showcase.grazer_at(tenth * 0.1)
check(at.distance_to(Showcase.GRAZER_HOME) <= 1.01, "near home at %.1f s: %s" % [tenth * 0.1, at])
func test_stones_travel_along_the_vine_one_after_another() -> void:
var start := Showcase.stones_at(0.0)
check_eq(start.size(), Showcase.STONES, "every stone")
check_eq(start[0], 0.0, "the first one starts")
for stone in start:
check(stone >= 0.0 and stone < 1.0, "on the vine: %f" % stone)
var later := Showcase.stones_at(1.0)
check(is_equal_approx(later[0], Showcase.STONE_SPEED), "it moves on")
var round_trip := Showcase.stones_at(1.0 / Showcase.STONE_SPEED)
check(is_equal_approx(round_trip[0], 0.0) or is_equal_approx(round_trip[0], 1.0), "and comes round again")
func test_the_ruin_wakes_and_dozes() -> void:
for tenth in 100:
var awake := Showcase.awake_at(tenth * 0.1)
check(awake >= 0.29 and awake <= 1.0, "between dozing and awake: %f" % awake)
func test_the_showcase_shows_every_style_and_names_its_things() -> void:
I18n.install()
InputSetup.install()
var art := Art.new()
var showcase := Showcase.new()
showcase.art = art
tree.root.add_child(showcase)
for index in art.styles.size():
showcase.style_buttons[index].pressed.emit()
check_eq(art.style, art.styles[index], "button %d chooses its style" % (index + 1))
check(showcase.style_buttons[index].disabled, "the chosen one cannot be pressed again")
await tree.process_frame
for key in showcase.caption_keys():
check(tr(key) != key, "a text for %s" % key)
var closed := [0]
showcase.closed.connect(func() -> void: closed[0] += 1)
showcase.back_button.pressed.emit()
check_eq(closed[0], 1, "back leads away")
tree.root.remove_child(showcase)
showcase.free()
+1
View File
@@ -0,0 +1 @@
uid://bx2nja50aj8ju