FuncDoodle
Loading...
Searching...
No Matches
ImTest.h File Reference

Helper for registering ImGui test engine tests with popup access. More...

#include "Core/App.h"
#include "Test/Test.h"
#include "imgui_te_context.h"

Go to the source code of this file.

Classes

struct  ImTestCtx
 Bundles the ImGui test context with a popup registry reference. More...

Functions

FuncDoodle::ApplicationGetApp ()
 Returns the active FuncDoodle application instance.
FuncDoodle::PopupRegistryGetPopups ()
 Returns the application's popup registry.
template<typename F>
ImGuiTest * ImTest (const char *name, F testFunc)
 Registers a test under the "funcdoodle" group with automatic popup injection.

Detailed Description

Helper for registering ImGui test engine tests with popup access.

Provides the ImTest() function which eliminates boilerplate around IM_REGISTER_TEST and automatically injects a PopupRegistry reference into each test via ImTestCtx.

See also
ImTestCtx
PopupRegistry

Function Documentation

◆ GetApp()

FuncDoodle::Application * GetApp ( )
inline

Returns the active FuncDoodle application instance.

Tries the ImGui UserData pointer first, then falls back to the singleton.

Returns
Pointer to the running Application.

◆ GetPopups()

FuncDoodle::PopupRegistry & GetPopups ( )
inline

Returns the application's popup registry.

Convenience shorthand for GetApp()->GetUiManager().GetPopups().

Returns
Reference to the global PopupRegistry.

◆ ImTest()

template<typename F>
ImGuiTest * ImTest ( const char * name,
F testFunc )
inline

Registers a test under the "funcdoodle" group with automatic popup injection.

Stores the user-provided callable via heap allocation and wires it into the ImGui test engine via UserData. The trampoline in TestFunc constructs an ImTestCtx with the current ImGuiTestContext and PopupRegistry, then forwards it to the user's function.

Example usage:

ImTest("my_test", [](ImTestCtx& tc) {
tc.Popups.Open("pref");
tc.Ctx->Yield();
IM_CHECK(ImGui::IsPopupOpen("Preferences##pref"));
});
ImGuiTest * ImTest(const char *name, F testFunc)
Registers a test under the "funcdoodle" group with automatic popup injection.
Definition ImTest.h:87
void Open(std::string_view id)
Marks a popup as open.
Definition PopupRegistry.cc:14
Bundles the ImGui test context with a popup registry reference.
Definition ImTest.h:29
FuncDoodle::PopupRegistry & Popups
Definition ImTest.h:31
ImGuiTestContext * Ctx
Definition ImTest.h:30
Template Parameters
FCallable type taking ImTestCtx&.
Parameters
nameShort test name (e.g. "menu_open_close").
testFuncLambda or function object.
Returns
Pointer to the registered ImGuiTest for further customization.