Skip to content

Commit

Permalink
TestSuite: update for IMGUI_VERSION_NUM=18984 + amend "widgets_multis…
Browse files Browse the repository at this point in the history
…elect_3_multiple"
  • Loading branch information
ocornut committed Aug 26, 2023
1 parent b3f8937 commit 620add3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
5 changes: 4 additions & 1 deletion imgui_test_suite/imgui_tests_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3661,7 +3661,10 @@ void RegisterTests_Misc(ImGuiTestEngine* e)
clipper.Begin(vars.ItemsIn, ImGui::GetTextLineHeightWithSpacing());
else
clipper.Begin(vars.ItemsIn);
#if IMGUI_VERSION_NUM >= 18509
#if IMGUI_VERSION_NUM >= 18984
if (vars.ForceDisplayStart != vars.ForceDisplayEnd)
clipper.IncludeItemsByIndex(vars.ForceDisplayStart, vars.ForceDisplayEnd);
#elif IMGUI_VERSION_NUM >= 18509
if (vars.ForceDisplayStart != vars.ForceDisplayEnd)
clipper.IncludeRangeByIndices(vars.ForceDisplayStart, vars.ForceDisplayEnd);
#endif
Expand Down
16 changes: 15 additions & 1 deletion imgui_test_suite/imgui_tests_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3302,7 +3302,7 @@ void RegisterTests_Widgets(ImGuiTestEngine* e)
ImGuiListClipper clipper;
clipper.Begin(ITEMS_COUNT);
if (ms_io->RangeSrcItem > 0)
clipper.IncludeByIndex(selection.ItemDataToIndex(ms_io->RangeSrcItem));
clipper.IncludeItemByIndex(selection.ItemDataToIndex(ms_io->RangeSrcItem));
while (clipper.Step())
{
for (int item_n = clipper.DisplayStart; item_n < clipper.DisplayEnd; item_n++)
Expand Down Expand Up @@ -3570,6 +3570,20 @@ void RegisterTests_Widgets(ImGuiTestEngine* e)
ctx->KeyPress(ImGuiMod_Ctrl | ImGuiKey_A);
IM_CHECK_EQ(selection0.SelectionSize, 1);
IM_CHECK_EQ(selection1.SelectionSize, 10);

// Check leaving a scope with keyboard directional move
// May need to clarify how this behave depending on "leaving" source, as mouse clicks don't impact this.
#if IMGUI_VERSION_NUM >= 18983
ctx->ItemClick("Scope 1/Object 0000");
IM_CHECK_EQ(selection0.SelectionSize, 1);
IM_CHECK_EQ(selection1.SelectionSize, 1);
ctx->KeyPress(ImGuiKey_UpArrow);
IM_CHECK_EQ(selection0.SelectionSize, 1);
IM_CHECK_EQ(selection1.SelectionSize, 0);
ctx->KeyPress(ImGuiKey_DownArrow);
IM_CHECK_EQ(selection0.SelectionSize, 0);
IM_CHECK_EQ(selection1.SelectionSize, 1);
#endif
};

// Test mouse-right click on unfocused window
Expand Down

0 comments on commit 620add3

Please sign in to comment.