TestEngine: revert part of 5b0510c as IMGUI_TEST_ENGINE_ITEM_ADD() woul see an erreneous hierarchy.

+ Fix typo (#5600)
This commit is contained in:
ocornut
2022-08-22 14:36:32 +02:00
parent 7f4b477d2e
commit d357e8504b
2 changed files with 3 additions and 1 deletions

View File

@ -6455,8 +6455,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
if (g.TestEngineHookItems)
{
IM_ASSERT(window->IDStack.Size == 1);
window->IDStack.Size = 0; // As window->IDStack[0] == window->ID here, make sure TestEngine doesn't erroneously see window as parent of itself.
IMGUI_TEST_ENGINE_ITEM_ADD(window->Rect(), window->ID);
IMGUI_TEST_ENGINE_ITEM_INFO(window->ID, window->Name, (g.HoveredWindow == window) ? ImGuiItemStatusFlags_HoveredRect : 0);
window->IDStack.Size = 1;
}
#endif