3#if defined(YAZE_ENABLE_IMGUI_TEST_ENGINE) && YAZE_ENABLE_IMGUI_TEST_ENGINE
6#if __has_include("imgui_test_engine/imgui_te_context.h")
7#include "imgui_test_engine/imgui_te_context.h"
8#elif __has_include("imgui_te_context.h")
9#include "imgui_te_context.h"
11#error "ImGui Test Engine context header not found"
14#if __has_include("imgui_test_engine/imgui_te_engine.h")
15#include "imgui_test_engine/imgui_te_engine.h"
16#elif __has_include("imgui_te_engine.h")
17#include "imgui_te_engine.h"
19#error "ImGui Test Engine engine header not found"
37static void RegisterKeyboardShortcutTests(ImGuiTestEngine* engine) {
41 IM_REGISTER_TEST(engine,
"overworld_keys",
"mouse_mode_key_1");
42 test->TestFunc = [](ImGuiTestContext* ctx) {
43 ctx->KeyPress(ImGuiKey_1);
51 IM_REGISTER_TEST(engine,
"overworld_keys",
"draw_mode_key_2");
52 test->TestFunc = [](ImGuiTestContext* ctx) {
53 ctx->KeyPress(ImGuiKey_2);
56 ctx->KeyPress(ImGuiKey_1);
64 IM_REGISTER_TEST(engine,
"overworld_keys",
"brush_toggle_key_b");
65 test->TestFunc = [](ImGuiTestContext* ctx) {
66 ctx->KeyPress(ImGuiKey_B);
69 ctx->KeyPress(ImGuiKey_B);
77 IM_REGISTER_TEST(engine,
"overworld_keys",
"fill_tool_key_f");
78 test->TestFunc = [](ImGuiTestContext* ctx) {
79 ctx->KeyPress(ImGuiKey_F);
82 ctx->KeyPress(ImGuiKey_F);
90 IM_REGISTER_TEST(engine,
"overworld_keys",
"eyedropper_key_i");
91 test->TestFunc = [](ImGuiTestContext* ctx) {
92 ctx->KeyPress(ImGuiKey_I);
100 IM_REGISTER_TEST(engine,
"overworld_keys",
"lock_toggle_ctrl_l");
101 test->TestFunc = [](ImGuiTestContext* ctx) {
102 ctx->KeyPress(ImGuiMod_Ctrl | ImGuiKey_L);
105 ctx->KeyPress(ImGuiMod_Ctrl | ImGuiKey_L);
113 IM_REGISTER_TEST(engine,
"overworld_keys",
"fullscreen_toggle_f11");
114 test->TestFunc = [](ImGuiTestContext* ctx) {
115 ctx->KeyPress(ImGuiKey_F11);
118 ctx->KeyPress(ImGuiKey_F11);
126 IM_REGISTER_TEST(engine,
"overworld_keys",
"undo_no_crash");
127 test->TestFunc = [](ImGuiTestContext* ctx) {
128 ctx->KeyPress(ImGuiMod_Ctrl | ImGuiKey_Z);
136 IM_REGISTER_TEST(engine,
"overworld_keys",
"redo_no_crash");
137 test->TestFunc = [](ImGuiTestContext* ctx) {
138 ctx->KeyPress(ImGuiMod_Ctrl | ImGuiKey_Y);
146 IM_REGISTER_TEST(engine,
"overworld_keys",
"tile16_editor_ctrl_t");
147 test->TestFunc = [](ImGuiTestContext* ctx) {
148 ctx->KeyPress(ImGuiMod_Ctrl | ImGuiKey_T);
151 ctx->KeyPress(ImGuiMod_Ctrl | ImGuiKey_T);
165static void RegisterEntityModeTests(ImGuiTestEngine* engine) {
169 IM_REGISTER_TEST(engine,
"overworld_entity",
"mode_keys_3_to_8");
170 test->TestFunc = [](ImGuiTestContext* ctx) {
172 ctx->KeyPress(ImGuiKey_3);
174 ctx->KeyPress(ImGuiKey_4);
176 ctx->KeyPress(ImGuiKey_5);
178 ctx->KeyPress(ImGuiKey_6);
180 ctx->KeyPress(ImGuiKey_7);
182 ctx->KeyPress(ImGuiKey_8);
185 ctx->KeyPress(ImGuiKey_1);
198static void RegisterModeRoundTripTests(ImGuiTestEngine* engine) {
202 IM_REGISTER_TEST(engine,
"overworld_modes",
"full_mode_cycle");
203 test->TestFunc = [](ImGuiTestContext* ctx) {
205 ctx->KeyPress(ImGuiKey_1);
209 ctx->KeyPress(ImGuiKey_2);
213 ctx->KeyPress(ImGuiKey_F);
217 ctx->KeyPress(ImGuiKey_B);
221 ctx->KeyPress(ImGuiKey_B);
225 ctx->KeyPress(ImGuiKey_1);
233 IM_REGISTER_TEST(engine,
"overworld_modes",
"rapid_mode_switch");
234 test->TestFunc = [](ImGuiTestContext* ctx) {
235 for (
int i = 0; i < 10; ++i) {
236 ctx->KeyPress(ImGuiKey_B);
240 ctx->KeyPress(ImGuiKey_1);
259static void RegisterCanvasNavigationTests(ImGuiTestEngine* engine) {
263 IM_REGISTER_TEST(engine,
"overworld_canvas",
"idle_frames_stable");
264 test->TestFunc = [](ImGuiTestContext* ctx) {
280static void RegisterWorldSelectorTests(ImGuiTestEngine* engine) {
284 IM_REGISTER_TEST(engine,
"overworld_toolbar",
"toolbar_renders_stable");
285 test->TestFunc = [](ImGuiTestContext* ctx) {
299 if (engine ==
nullptr)
301 RegisterKeyboardShortcutTests(engine);
302 RegisterEntityModeTests(engine);
303 RegisterModeRoundTripTests(engine);
304 RegisterCanvasNavigationTests(engine);
305 RegisterWorldSelectorTests(engine);
void RegisterOverworldUITests(ImGuiTestEngine *)