yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dungeon_editor_smoke_test.cc
Go to the documentation of this file.
2#include "test_utils.h"
4#include "imgui_test_engine/imgui_te_context.h"
5
14void E2ETest_DungeonEditorV2SmokeTest(ImGuiTestContext* ctx)
15{
16 ctx->LogInfo("=== Starting DungeonEditorV2 Smoke Test ===");
17
18 // Load ROM first
19 ctx->LogInfo("Loading ROM...");
20 yaze::test::gui::LoadRomInTest(ctx, "zelda3.sfc");
21 ctx->LogInfo("ROM loaded successfully");
22
23 // Open the Dungeon Editor
24 ctx->LogInfo("Opening Dungeon Editor...");
26 ctx->LogInfo("Dungeon Editor opened");
27
28 // Test 1: Control Panel Access
29 ctx->LogInfo("--- Test 1: Control Panel ---");
30 if (ctx->WindowInfo("Dungeon Controls").Window != nullptr) {
31 ctx->WindowFocus("Dungeon Controls");
32 ctx->LogInfo("Dungeon Controls panel is visible");
33 } else {
34 ctx->LogWarning("Dungeon Controls panel not visible - may be minimized");
35 }
36
37 // Test 2: Open Room Selector Card
38 ctx->LogInfo("--- Test 2: Room Selector Card ---");
39 if (ctx->WindowInfo("Dungeon Controls").Window != nullptr) {
40 ctx->SetRef("Dungeon Controls");
41 ctx->ItemClick("Rooms"); // Toggle checkbox
42 ctx->Yield();
43 ctx->LogInfo("Toggled Room Selector visibility");
44 }
45
46 // Test 3: Open Room Matrix Card
47 ctx->LogInfo("--- Test 3: Room Matrix Card ---");
48 if (ctx->WindowInfo("Dungeon Controls").Window != nullptr) {
49 ctx->SetRef("Dungeon Controls");
50 ctx->ItemClick("Matrix"); // Toggle checkbox
51 ctx->Yield();
52 ctx->LogInfo("Toggled Room Matrix visibility");
53 }
54
55 // Test 4: Open a Room Card
56 ctx->LogInfo("--- Test 4: Room Card ---");
57 // Try to open room 0 by clicking in room selector
58 if (ctx->WindowInfo("Room Selector").Window != nullptr) {
59 ctx->SetRef("Room Selector");
60 // Look for selectable room items
61 if (ctx->ItemExists("Room 0x00")) {
62 ctx->ItemDoubleClick("Room 0x00");
63 ctx->Yield(2);
64 ctx->LogInfo("Opened Room 0x00 card");
65
66 // Verify room card exists
67 if (ctx->WindowInfo("Room 0x00").Window != nullptr) {
68 ctx->LogInfo("Room 0x00 card successfully opened");
69 ctx->SetRef("Room 0x00");
70
71 // Test 5: Per-Room Layer Controls
72 ctx->LogInfo("--- Test 5: Per-Room Layer Controls ---");
73 if (ctx->ItemExists("Show BG1")) {
74 ctx->LogInfo("Found per-room BG1 control");
75 // Toggle it
76 ctx->ItemClick("Show BG1");
77 ctx->Yield();
78 ctx->ItemClick("Show BG1"); // Toggle back
79 ctx->Yield();
80 ctx->LogInfo("Per-room layer controls functional");
81 }
82 } else {
83 ctx->LogWarning("Room card did not open");
84 }
85 } else {
86 ctx->LogWarning("Room 0x00 not found in selector");
87 }
88 } else {
89 ctx->LogWarning("Room Selector card not visible");
90 }
91
92 // Test 6: Object Editor Card
93 ctx->LogInfo("--- Test 6: Object Editor Card ---");
94 if (ctx->WindowInfo("Dungeon Controls").Window != nullptr) {
95 ctx->SetRef("Dungeon Controls");
96 ctx->ItemClick("Objects"); // Toggle checkbox
97 ctx->Yield();
98 ctx->LogInfo("Toggled Object Editor visibility");
99 }
100
101 // Test 7: Palette Editor Card
102 ctx->LogInfo("--- Test 7: Palette Editor Card ---");
103 if (ctx->WindowInfo("Dungeon Controls").Window != nullptr) {
104 ctx->SetRef("Dungeon Controls");
105 ctx->ItemClick("Palette"); // Toggle checkbox
106 ctx->Yield();
107 ctx->LogInfo("Toggled Palette Editor visibility");
108 }
109
110 // Test 8: Independent Cards can be closed
111 ctx->LogInfo("--- Test 8: Close Independent Cards ---");
112 // Close room card if it's open
113 if (ctx->WindowInfo("Room 0x00").Window != nullptr) {
114 ctx->WindowClose("Room 0x00");
115 ctx->Yield();
116 ctx->LogInfo("Closed Room 0x00 card");
117 }
118
119 // Final verification
120 ctx->LogInfo("=== DungeonEditorV2 Smoke Test Completed Successfully ===");
121 ctx->LogInfo("Card-based architecture is functional");
122 ctx->LogInfo("Independent windows can be opened and closed");
123 ctx->LogInfo("Per-room settings are accessible");
124}
void E2ETest_DungeonEditorV2SmokeTest(ImGuiTestContext *ctx)
Quick smoke test for DungeonEditorV2.
void LoadRomInTest(ImGuiTestContext *ctx, const std::string &rom_path)
Definition test_utils.cc:8
void OpenEditorInTest(ImGuiTestContext *ctx, const std::string &editor_name)
Definition test_utils.cc:13