Skip to content

Commit

Permalink
TestSuite: Amend "widgets_inputtext_cursor", "widgets_inputtext_scrol…
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed Sep 6, 2023
1 parent ea0b276 commit f0f74be
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion imgui_test_suite/imgui_tests_widgets_inputtext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,14 @@ void RegisterTests_WidgetsInputText(ImGuiTestEngine* e)
IM_CHECK_EQ(stb.cursor, 0);
ctx->KeyPress(ImGuiKey_RightArrow);
IM_CHECK_EQ(stb.cursor, 0);

#if IMGUI_VERSION_NUM >= 18991
// Extra test for #6783, long line trailed with \n, pressing down.
// This is almost exercised elsewhere but didn't crash with small values until we added bound-check in STB_TEXTEDIT_GETCHAR() too.
ctx->KeyCharsReplace("Click this text then press down-arrow twice to cause an assert.\n");
IM_CHECK_EQ(stb.cursor, state->CurLenA);
ctx->KeyPress(ImGuiKey_DownArrow);
#endif
};

// ## Test CTRL+arrow and other word boundaries functions
Expand Down Expand Up @@ -868,7 +876,10 @@ void RegisterTests_WidgetsInputText(ImGuiTestEngine* e)
ctx->SetRef("Test Window");
ctx->ItemInput("Field");
for (int n = 0; n < 10; n++)
ctx->KeyCharsAppendEnter(Str16f("Line %d", n).c_str());
ctx->KeyCharsAppend(Str30f("Line %d\n", n).c_str());
#if IMGUI_VERSION_NUM >= 18991
ctx->KeyPress(ImGuiKey_DownArrow); // Extra test for #6783
#endif
ctx->KeyDown(ImGuiMod_Shift);
ctx->KeyPress(ImGuiKey_UpArrow);
ctx->KeyUp(ImGuiMod_Shift);
Expand Down

0 comments on commit f0f74be

Please sign in to comment.