From 21d00458e18fa89715a2b3dfbb6235f9ec988998 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 17 Oct 2024 11:39:55 +0200 Subject: [PATCH] TestSuite: amend "widgets_disabled" further (test other types) for https://github.com/ocornut/imgui/issues/8064 --- imgui_test_suite/imgui_tests_widgets.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/imgui_test_suite/imgui_tests_widgets.cpp b/imgui_test_suite/imgui_tests_widgets.cpp index 7a2d0f1..b81f6ab 100644 --- a/imgui_test_suite/imgui_tests_widgets.cpp +++ b/imgui_test_suite/imgui_tests_widgets.cpp @@ -5558,6 +5558,7 @@ void RegisterTests_Widgets(ImGuiTestEngine* e) ImGui::EndMenuBar(); } + ImGui::Checkbox("WidgetsDisabled", &vars.WidgetsDisabled); ImGui::Selectable("Enabled A"); int index = 0; @@ -5650,10 +5651,14 @@ void RegisterTests_Widgets(ImGuiTestEngine* e) IM_CHECK(g.HoveredId == ctx->GetID(disabled_items[i])); // Will set HoveredId even when disabled. } + // Verify that clicking on a disabled item takes focus #if IMGUI_VERSION_NUM >= 19135 - ctx->WindowFocus("//Dear ImGui Demo"); - ctx->ItemClick(disabled_items[0]); - IM_CHECK_EQ(g.NavWindow, window); + for (int i = 0; i < IM_ARRAYSIZE(disabled_items); i++) + { + ctx->WindowFocus("//Dear ImGui Demo"); + ctx->ItemClick(disabled_items[i]); + IM_CHECK_EQ(g.NavWindow, window); + } #endif // Dragging a disabled item.