feat(shell): MainWindowShell assembles the frame and wires the DM loop
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
37
client/tests/unit/test_main_window_shell.gd
Normal file
37
client/tests/unit/test_main_window_shell.gd
Normal file
@@ -0,0 +1,37 @@
|
||||
extends "res://addons/gut/test.gd"
|
||||
|
||||
const SCENE := "res://scenes/shell/MainWindowShell.tscn"
|
||||
const FakeTransport = preload("res://tests/doubles/fake_transport.gd")
|
||||
const DmResponse = preload("res://scripts/net/dm_response.gd")
|
||||
|
||||
|
||||
func _shell() -> MainWindowShell:
|
||||
# Inject a fake service BEFORE _ready (add_child) so the initial narrate does
|
||||
# not touch the network — instantiate() does not run _ready(); add_child does.
|
||||
var node = load(SCENE).instantiate()
|
||||
var transport = FakeTransport.new()
|
||||
transport.set_response(DmResponse.ok(200, {"prose": "Rain on the cobbles."}))
|
||||
node.service = DmService.new(transport, FallbackLibrary.new())
|
||||
add_child_autofree(node)
|
||||
return node
|
||||
|
||||
|
||||
func test_shell_applies_theme_and_fits_viewport():
|
||||
var packed = load(SCENE)
|
||||
assert_true(packed is PackedScene)
|
||||
var node := _shell()
|
||||
assert_true(node is Control)
|
||||
assert_true(node.theme is Theme, "shell applies game_theme")
|
||||
assert_gt(node.size.x, 0.0, "viewport-fit sized the root (M3-a collapse guard)")
|
||||
|
||||
|
||||
func test_shell_mounts_both_panels():
|
||||
var node := _shell()
|
||||
assert_not_null(node.book, "narration book mounted")
|
||||
assert_not_null(node.dock, "system dock mounted")
|
||||
|
||||
|
||||
func test_shell_builds_a_code_owned_seed_log():
|
||||
var node := _shell()
|
||||
assert_not_null(node._log, "a canon log exists to post (§11)")
|
||||
assert_gt(node._log.established_facts.size(), 0, "seed scene facts are code-owned")
|
||||
1
client/tests/unit/test_main_window_shell.gd.uid
Normal file
1
client/tests/unit/test_main_window_shell.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dbd4cq1awo4su
|
||||
Reference in New Issue
Block a user