Skip to content

Commit

Permalink
TestSuite: added "inputs_io_capture_on_release_not_owned"
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed Jul 1, 2024
1 parent 6fd26b5 commit 1780341
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions imgui_test_suite/imgui_tests_inputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,29 @@ void RegisterTests_Inputs(ImGuiTestEngine* e)
{
ImGuiTest* t = NULL;

// ## Test io.WantCaptureMouse button on frame where a button that's not owned by imgui is released (#1392)
t = IM_REGISTER_TEST(e, "inputs", "inputs_io_capture_on_release_not_owned");
t->TestFunc = [](ImGuiTestContext* ctx)
{
ImGuiContext& g = *GImGui;
ctx->MouseMoveToVoid();
ctx->MouseDown(0);
IM_CHECK_EQ(g.IO.WantCaptureMouse, false);
IM_CHECK_EQ(g.ActiveId, 0u);

ctx->MouseMove("Dear ImGui Demo", ImGuiTestOpFlags_NoCheckHoveredId);
IM_CHECK_EQ(g.IO.WantCaptureMouse, false);
IM_CHECK_EQ(g.ActiveId, 0u);

ctx->MouseUp(0); // Include a yield
#if IMGUI_BROKEN_TESTS // Test bug reported by #1392
IM_CHECK_EQ(g.IO.WantCaptureMouse, false);
#endif

ctx->Yield();
IM_CHECK_EQ(g.IO.WantCaptureMouse, true);
};

// ## Test input queue trickling
t = IM_REGISTER_TEST(e, "inputs", "inputs_io_inputqueue");
t->GuiFunc = [](ImGuiTestContext* ctx)
Expand Down

0 comments on commit 1780341

Please sign in to comment.