# test_intro_empire_parity.gd —— 40250 三国地貌 3D 运镜与阵营选择回归测试 extends SceneTree const SystemClass = preload("res://intro_empire_phase.gd") var _passed: int = 0 var _failed: int = 0 func _assert(cond: bool, msg: String) -> void: if cond: _passed += 1 print(" [PASS] %s" % msg) else: _failed += 1 printerr(" [FAIL] %s" % msg) func _init() -> void: print("\n=== Running test_intro_empire_parity (Batch 29 Direction 2) ===") _test_initial_empire_state() _test_camera_target_positions_and_switching() _test_camera_smooth_interpolation() _test_empire_description_and_confirmation() print("\n=== Result: %d Passed, %d Failed ===" % [_passed, _failed]) if _failed == 0: print("ALL TESTS PASSED!\n") else: printerr("SOME TESTS FAILED!\n") quit(0 if _failed == 0 else 1) func _test_initial_empire_state() -> void: print("\n--- Test 1: Initial Empire & Camera Initialization ---") var emp = SystemClass.new(SystemClass.EMPIRE_SHINSOO) _assert(emp.selected_empire == SystemClass.EMPIRE_SHINSOO, "Initial empire is Shinsoo") var info = emp.get_selected_empire_info() _assert(info["capital"] == "Yongan", "Shinsoo capital is Yongan") _assert(emp.current_cam_pos == Vector3(100.0, 50.0, -200.0), "Initial camera pos matches preset") func _test_camera_target_positions_and_switching() -> void: print("\n--- Test 2: Switching Empires & Camera Target Updates ---") var emp = SystemClass.new(SystemClass.EMPIRE_SHINSOO) # Switch to Chunjo (Yellow) var sw1 = emp.select_empire(SystemClass.EMPIRE_CHUNJO) _assert(sw1 == true, "Switched to Chunjo") _assert(emp.target_cam_pos == Vector3(-150.0, 60.0, -180.0), "Chunjo camera target pos set") _assert(emp.is_transitioning == true, "Camera transition activated") # Switch to Jinno (Blue) var sw2 = emp.select_empire(SystemClass.EMPIRE_JINNO) _assert(sw2 == true, "Switched to Jinno") _assert(emp.target_cam_pos == Vector3(0.0, 80.0, -250.0), "Jinno camera target pos set") # Reject invalid empire var sw_inv = emp.select_empire(99) _assert(sw_inv == false, "Reject invalid empire id 99") func _test_camera_smooth_interpolation() -> void: print("\n--- Test 3: Smooth Camera Interpolation Flow ---") var emp = SystemClass.new(SystemClass.EMPIRE_SHINSOO) emp.select_empire(SystemClass.EMPIRE_JINNO) _assert(emp.is_transitioning == true, "Transitioning flag is true") # Halfway step (0.5) emp.update_camera_transition(0.5) _assert(emp.is_transitioning == true, "Still transitioning at 50%") _assert(emp.transition_t == 0.5, "transition_t is 0.5") # Complete transition (another 0.5) emp.update_camera_transition(0.5) _assert(emp.is_transitioning == false, "Transition completed") _assert(emp.current_cam_pos == Vector3(0.0, 80.0, -250.0), "Camera arrived exactly at Jinno preset") func _test_empire_description_and_confirmation() -> void: print("\n--- Test 4: Empire Metadata & Confirmation Phase Transition ---") var emp = SystemClass.new(SystemClass.EMPIRE_JINNO) var info = emp.get_selected_empire_info() _assert(info["desc"].contains("崇尚武道强权"), "Contains Jinno lore description") _assert(info["trait"].contains("物理基础攻击力 +5%"), "Contains Jinno trait bonus") var conf = emp.confirm_empire_selection() _assert(conf["success"] == true, "Confirmed empire selection") _assert(conf["empire_id"] == SystemClass.EMPIRE_JINNO, "Confirmed Jinno (3)") _assert(conf["next_phase"] == "CHARACTER_SELECT", "Routes to CHARACTER_SELECT phase")