-
Notifications
You must be signed in to change notification settings - Fork 58
Imgui test engine cant find BeginChildEx because of '/' #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I would like to change the mangling of child windows indeed. However,
ImGuiWindow* window = ImGui::FindWindowByName(file_dialog);
constexpr const char* child = "##files";
ImGuiID id = window->GetID(child);
std::string child_name = std::format("{}_{}_{:08X}", file_dialog, child, id);
ctx.SetRef(child_name.c_str());
ctx.ScrollToItemY(std::format("##folder_{}", folder).c_str()); You should be able to use, e.g. ctx->SetRef(ctx->WindowInfo("//FileDialog/##files")->Window);
ctx->ScrollToItemY(....); |
Oh ok so that will presumably add the hash at the end of //FileDialog/##files ? Great to know I'll try it out. Thanks |
Yes, |
Just to say this works a treat for me and allowed me to reverse my alternative child window name mangling. Thanks |
Great to hear! |
BeginChildEx cant be found because the child window name contains a '/'. If I change these lines in BegindChildEx:
to
i.e replace the slash with an underscore then ImGuiTestContext::ItemInfo can find the child window and doesn't chop off the name_id part.
ImGuiTestItemInfo ImGuiTestContext::ItemInfo(ImGuiTestRef ref, ImGuiTestOpFlags flags)
This is important for scrolling as otherwise items off screen in child windows can't be found as the current work around of serarching via **/name doesn't work.
This has allowed me to do this to scroll the item onto screen in the test framework:
There is also a line in
ImGuiTestItemInfo ImGuiTestContext::WindowInfo(ImGuiTestRef ref, ImGuiTestOpFlags flags)
that needs to be changed here:
The text was updated successfully, but these errors were encountered: