@@ -1522,6 +1522,9 @@ void RegisterTests_WidgetsInputText(ImGuiTestEngine* e)
15221522 int & i_stored = vars.Int1 ;
15231523 int & i_tmp = vars.Int2 ;
15241524 i_tmp = i_stored;
1525+
1526+ const bool is_multiline = (vars.Step % 4 ) == 2 ;
1527+
15251528 if (ImGui::InputInt (" Field1" , &i_tmp))
15261529 if (ImGui::IsItemDeactivatedAfterEdit ())
15271530 i_stored = i_tmp;
@@ -1530,7 +1533,13 @@ void RegisterTests_WidgetsInputText(ImGuiTestEngine* e)
15301533 char * s_tmp = vars.Str2 ;
15311534 int s_bufsize = IM_COUNTOF (vars.Str1 );
15321535 memcpy (s_tmp, s_stored, s_bufsize);
1533- if (ImGui::InputText (" Field2" , s_tmp, s_bufsize, vars.InputTextFlags ))
1536+
1537+ bool ret;
1538+ if (is_multiline)
1539+ ret = ImGui::InputTextMultiline (" Field2" , s_tmp, s_bufsize, { 0 ,0 }, vars.InputTextFlags );
1540+ else
1541+ ret = ImGui::InputText (" Field2" , s_tmp, s_bufsize, vars.InputTextFlags );
1542+ if (ret)
15341543 if (ImGui::IsItemDeactivatedAfterEdit ())
15351544 memcpy (s_stored, s_tmp, s_bufsize);
15361545
@@ -1541,13 +1550,16 @@ void RegisterTests_WidgetsInputText(ImGuiTestEngine* e)
15411550 auto & vars = ctx->GenericVars ;
15421551 ctx->SetRef (" Test Window" );
15431552
1544- for (int step = 0 ; step < 2 ; step++)
1553+ for (int step = 0 ; step < 4 ; step++)
15451554 {
1555+ const bool is_enter_keep_active = (step % 2 ) == 1 ;
1556+ const bool is_multiline = (step % 4 ) == 2 ;
15461557#if IMGUI_VERSION_NUM < 19264
1547- if (step == 1 )
1558+ if (is_enter_keep_active )
15481559 continue ;
15491560#endif
1550- ImGui::GetIO ().ConfigInputTextEnterKeepActive = (step == 1 );
1561+ ImGui::GetIO ().ConfigInputTextEnterKeepActive = is_enter_keep_active;
1562+ vars.Step = step;
15511563 ctx->Yield ();
15521564
15531565 int & i_stored = vars.Int1 ;
@@ -1573,10 +1585,23 @@ void RegisterTests_WidgetsInputText(ImGuiTestEngine* e)
15731585 char * s_stored = vars.Str1 ;
15741586 char * s_tmp = vars.Str2 ;
15751587 ctx->ItemClick (" Field2" );
1576-
15771588 const char * s_step1 = (n == 0 || n == 1 ) ? " abc" : " " ;
1578- ctx->KeyCharsReplaceEnter (s_step1);
1589+ ctx->KeyCharsReplace (s_step1);
1590+ ctx->KeyPress (is_multiline ? ImGuiMod_Ctrl | ImGuiKey_Enter : ImGuiKey_Enter);
15791591 IM_CHECK_STR_EQ (s_stored, s_step1);
1592+
1593+ // Testing with Tab as it takes the deactivation path (#9308, #8915)
1594+ #if IMGUI_VERSION_NUM >= 19266
1595+ ctx->ItemClick (" Field2" );
1596+ ctx->KeyCharsReplace (" eee" );
1597+ IM_CHECK_STR_EQ (s_stored, s_step1);
1598+ IM_CHECK_STR_EQ (s_tmp, " eee" );
1599+ ctx->KeyPress (ImGuiKey_Tab);
1600+ IM_CHECK_STR_EQ (s_stored, " eee" );
1601+ IM_CHECK_STR_EQ (s_tmp, " eee" );
1602+ strcpy (s_stored, s_step1);
1603+ #endif
1604+
15801605 ctx->ItemClick (" Field2" );
15811606 ctx->KeyCharsReplace (" fff" );
15821607 IM_CHECK_STR_EQ (s_stored, s_step1);
0 commit comments