Skip to content

Commit

Permalink
TestEngine: fixed error recovery mis-asserting after a GuiFunc trigge…
Browse files Browse the repository at this point in the history
…red a failed error.

+ TestSuite: added "misc_recover_4_table"
ocornut committed Dec 20, 2024
1 parent 6de3d90 commit 42d0539
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 4 additions & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -5,6 +5,10 @@ CHANGELOG
Those changes are not all listed here.
** For a while this is going to ONLY INCLUDE BREAKING CHANGES.

2024/12/20:
- TestEngine: fixed error recovery mis-asserting after a GuiFunc triggered
a failed error (when a test fail, error recover runs but shouldn't assert).

2024/12/19:
- TestEngine: ctx->SetVarsDataType() created blocks are zero-cleared before
construction.
8 changes: 4 additions & 4 deletions imgui_test_engine/imgui_te_engine.cpp
Original file line number Diff line number Diff line change
@@ -1926,17 +1926,17 @@ void ImGuiTestEngine_ErrorRecoverySetup(ImGuiTestEngine* engine)
IM_ASSERT(ctx != NULL);
IM_ASSERT(ctx->Test != NULL);
#if IMGUI_VERSION_NUM >= 19123
if (ctx->Test->Flags & ImGuiTestFlags_NoRecoveryWarnings)
if ((ctx->Test->Flags & ImGuiTestFlags_NoRecoveryWarnings) == 0)
{
ctx->UiContext->IO.ConfigErrorRecoveryEnableAssert = false;
ctx->UiContext->ErrorCallback = LogAsDebugFunc;
ctx->UiContext->ErrorCallback = LogAsWarningFunc;
ctx->UiContext->ErrorCallbackUserData = ctx;
}
else
{
ctx->UiContext->ErrorCallback = LogAsWarningFunc;
ctx->UiContext->ErrorCallback = LogAsDebugFunc;
ctx->UiContext->ErrorCallbackUserData = ctx;
}
ctx->UiContext->IO.ConfigErrorRecoveryEnableAssert = ((ctx->Test->Flags & ImGuiTestFlags_NoRecoveryWarnings) == 0 && ctx->TestOutput->Status != ImGuiTestStatus_Error);
#else
IM_UNUSED(ctx);
#endif
13 changes: 12 additions & 1 deletion imgui_test_suite/imgui_tests_core.cpp
Original file line number Diff line number Diff line change
@@ -3963,9 +3963,20 @@ void RegisterTests_Misc(ImGuiTestEngine* e)
// Ensure we run two frames.
};

// ## Table with scrolling are child windows
#if IMGUI_VERSION_NUM >= 19163
t = IM_REGISTER_TEST(e, "misc", "misc_recover_4_table");
t->Flags |= ImGuiTestFlags_NoRecoveryWarnings;
t->GuiFunc = [](ImGuiTestContext* ctx)
{
ImGui::Begin("Test window", NULL, ImGuiWindowFlags_NoSavedSettings);
ImGui::BeginTable("table", 4, ImGuiTableFlags_ScrollY);
};
#endif

// ## Basic way for manual state record/recover
#if IMGUI_VERSION_NUM >= 19123
t = IM_REGISTER_TEST(e, "misc", "misc_recover_4_midway");
t = IM_REGISTER_TEST(e, "misc", "misc_recover_5_midway");
t->Flags |= ImGuiTestFlags_NoRecoveryWarnings;
t->GuiFunc = [](ImGuiTestContext* ctx)
{

0 comments on commit 42d0539

Please sign in to comment.