Skip to content

Commit 4d6bce6

Browse files
committed
TestSuite: amend "inputs_io_inputqueue" for change in core lib.
Broken by ocornut/imgui#8584
1 parent f483e33 commit 4d6bce6

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

imgui_test_suite/imgui_tests_inputs.cpp

+25-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,21 @@ void RegisterTests_Inputs(ImGuiTestEngine* e)
7878
ImGui::SetNextWindowPos(ImVec2(80, 80));
7979
ImGui::SetNextWindowSize(ImVec2(500, 500));
8080
ImGui::Begin("Test Window", NULL, ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoResize);
81-
ctx->UiContext->WantTextInputNextFrame = vars.Bool1; // Simulate InputText() without eating inputs
82-
//ImGui::InputText("InputText", vars.Str1, IM_ARRAYSIZE(vars.Str1));
81+
82+
// Simulate InputText() without eating inputs
83+
#if IMGUI_VERSION_NUM >= 19194
84+
if (vars.Bool1)
85+
{
86+
ctx->UiContext->PlatformImeData.WantTextInput = true;
87+
ctx->UiContext->PlatformImeData.ViewportId = ImGui::GetMainViewport()->ID;
88+
}
89+
#else
90+
if (vars.Bool1)
91+
{
92+
ctx->UiContext->WantTextInputNextFrame = true;
93+
}
94+
#endif
95+
//ImGui::InputText("InputText", vars.Str1, IM_ARRAYSIZE(vars.Str1)); // See 2025/04/24 comment below.
8396
//if (vars.Bool1)
8497
// ImGui::SetKeyboardFocusHere(-1);
8598
ImGui::End();
@@ -372,6 +385,16 @@ void RegisterTests_Inputs(ImGuiTestEngine* e)
372385
for (int step = 0; step < INPUT_TEXT_STEPS; step++)
373386
{
374387
const bool is_input_text_active = (step == 1);
388+
/*
389+
// 2025/04/24: Doing this would be nice, but InputText() actually running means InputQueueCharacters is emptied each run, and its convenient to test for its size.
390+
if (is_input_text_active)
391+
{
392+
ctx->Yield(3);
393+
ctx->RunFlags &= ~ImGuiTestRunFlags_EnableRawInputs;
394+
ctx->ItemClick("//Test Window/InputText");
395+
ctx->RunFlags |= ImGuiTestRunFlags_EnableRawInputs;
396+
ctx->Yield(3);
397+
}*/
375398
vars.Bool1 = is_input_text_active; // Simulate activated InputText()
376399
ctx->Yield();
377400

0 commit comments

Comments
 (0)