Dear ImGui Test Engine: automate and test an app, by scripting mouse and keyboard actions on its widgets.
A test drives the GUI as a user would: it clicks a button by its label, types text, checks a value. Run it inside
Hello ImGui or ImmApp: set runner_params.use_imgui_test_engine = True, and register the tests in
runner_params.callbacks.register_tests.
In Python, the test engine runs the tests on a second thread, and Hello ImGui and ImmApp hand the GIL between the
two threads. Using it without them is very difficult (details:
imgui
The module imgui_bundle.imgui.test_engine, the Python API of Dear ImGui, from bindings/imgui_bundle/imgui/test_engine.pyi: 46 functions, 24 classes, 15 enums. Each entry gives the Python signature, then the C++ one, then the doc of the C++ header. The sections are the header’s.
Demos using it¶
The demos of the catalog that use it (the pictures link to their code and to the playground).

Test engine¶
Three windows: the Dear ImGui demo, the ImGui Test Engine panel, and a few buttons that run tests.
More
Watch a test drive the mouse and the keyboard: it opens tree nodes, clicks buttons, types text, and checks the results. See the test engine doc.
Desktop only

Drive an app, capture screenshots¶
A test function drives the app: it clicks, moves a slider, opens a header, and takes a screenshot at each step.
More
immapp.testing.run() starts the app, runs the test function, then exits. Handy for automated checks and for documentation pictures. See the test engine doc.
Desktop only
imgui_te_exporters.h¶
Forward Declarations¶
Types¶
TestEngineExportFormat (enum)¶
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImGuiTestEngineExportFormat_None = 0 | |
j_unit_xml | 1 | ImGuiTestEngineExportFormat_JUnitXml, } |
Functions¶
print_result_summary¶
def print_result_summary(engine: TestEngine) -> Nonevoid ImGuiTestEngine_PrintResultSummary(ImGuiTestEngine* engine);(private API)
export¶
def export(engine: TestEngine) -> Nonevoid ImGuiTestEngine_Export(ImGuiTestEngine* engine);(private API)
export_ex¶
def export_ex(engine: TestEngine, format: TestEngineExportFormat, filename: str) -> Nonevoid ImGuiTestEngine_ExportEx(ImGuiTestEngine* engine, ImGuiTestEngineExportFormat format, const char* filename);(private API)
imgui_te_engine.h¶
TestActiveFunc (enum)¶
Stored in ImGuiTestContext: where we are currently running GuiFunc or TestFunc
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImGuiTestActiveFunc_None | |
gui_func | 1 | ImGuiTestActiveFunc_GuiFunc | == GuiFunc() handler |
test_func | 2 | ImGuiTestActiveFunc_TestFunc | == TestFunc() handler |
teardown_func | 3 | ImGuiTestActiveFunc_TeardownFunc | == TeardownFunc() handler |
TestRunSpeed (enum)¶
| Member | Value | C++ | |
|---|---|---|---|
fast | 0 | ImGuiTestRunSpeed_Fast = 0 | Run tests as fast as possible (teleport mouse, skip delays, etc.) |
normal | 1 | ImGuiTestRunSpeed_Normal = 1 | Run tests at human watchable speed (for debugging) |
cinematic | 2 | ImGuiTestRunSpeed_Cinematic = 2 | Run tests with pauses between actions (for e.g. tutorials) |
count | 3 | ImGuiTestRunSpeed_COUNT |
TestVerboseLevel (enum)¶
| Member | Value | C++ | |
|---|---|---|---|
silent | 0 | ImGuiTestVerboseLevel_Silent = 0 | -v0 |
error | 1 | ImGuiTestVerboseLevel_Error = 1 | -v1 |
warning | 2 | ImGuiTestVerboseLevel_Warning = 2 | -v2 |
info | 3 | ImGuiTestVerboseLevel_Info = 3 | -v3 |
debug | 4 | ImGuiTestVerboseLevel_Debug = 4 | -v4 |
trace | 5 | ImGuiTestVerboseLevel_Trace = 5 | |
count | 6 | ImGuiTestVerboseLevel_COUNT |
TestStatus (enum)¶
Test status (stored in ImGuiTest)
| Member | Value | C++ | |
|---|---|---|---|
unknown | 0 | ImGuiTestStatus_Unknown = 0 | |
success | 1 | ImGuiTestStatus_Success = 1 | |
queued | 2 | ImGuiTestStatus_Queued = 2 | |
running | 3 | ImGuiTestStatus_Running = 3 | |
error | 4 | ImGuiTestStatus_Error = 4 | |
suspended | 5 | ImGuiTestStatus_Suspended = 5 | |
count | 6 | ImGuiTestStatus_COUNT |
TestGroup (enum)¶
Test group: this is mostly used to categorize tests in our testing UI. (Stored in ImGuiTest)
| Member | Value | C++ | |
|---|---|---|---|
unknown | -1 | ImGuiTestGroup_Unknown = -1 | |
tests | 0 | ImGuiTestGroup_Tests = 0 | |
perfs | 1 | ImGuiTestGroup_Perfs = 1 | |
count | 2 | ImGuiTestGroup_COUNT |
TestFlags_ (enum)¶
Flags (stored in ImGuiTest)
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImGuiTestFlags_None = 0 | |
no_gui_warm_up | 1 << 0 | ImGuiTestFlags_NoGuiWarmUp = 1 << 0 | Disable running the GUI func for 2 frames before starting test code. For tests which absolutely need to start before GuiFunc. |
no_auto_finish | 1 << 1 | ImGuiTestFlags_NoAutoFinish = 1 << 1 | By default, tests with no TestFunc (only a GuiFunc) will end after warmup. Setting this require test to call ctx->Finish(). |
no_recovery_warnings | 1 << 2 | ImGuiTestFlags_NoRecoveryWarnings = 1 << 2 | Error/recovery warnings (missing End/Pop calls etc.) will be displayed as normal debug entries, for tests which may rely on those. |
ImGuiTestFlags_RequireViewports = 1 << 10¶
TestCheckFlags_ (enum)¶
Flags for IM_CHECK* macros.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImGuiTestCheckFlags_None = 0 | |
silent_success | 1 << 0 | ImGuiTestCheckFlags_SilentSuccess = 1 << 0 |
TestLogFlags_ (enum)¶
Flags for ImGuiTestContext::Log* functions.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImGuiTestLogFlags_None = 0 | |
no_header | 1 << 0 | ImGuiTestLogFlags_NoHeader = 1 << 0 | Do not display frame count and depth padding |
TestRunFlags_ (enum)¶
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImGuiTestRunFlags_None = 0 | |
gui_func_disable | 1 << 0 | ImGuiTestRunFlags_GuiFuncDisable = 1 << 0 | Used internally to temporarily disable the GUI func (at the end of a test, etc) |
gui_func_only | 1 << 1 | ImGuiTestRunFlags_GuiFuncOnly = 1 << 1 | Set when user selects “Run GUI func” |
no_success_msg | 1 << 2 | ImGuiTestRunFlags_NoSuccessMsg = 1 << 2 | |
enable_raw_inputs | 1 << 3 | ImGuiTestRunFlags_EnableRawInputs = 1 << 3 | Disable input submission to let test submission raw input event (in order to test e.g. IO queue) |
run_from_gui | 1 << 4 | ImGuiTestRunFlags_RunFromGui = 1 << 4 | Test ran manually from GUI, will disable watchdog. |
run_from_command_line | 1 << 5 | ImGuiTestRunFlags_RunFromCommandLine= 1 << 5 | Test queued from command-line. |
no_error | 1 << 10 | ImGuiTestRunFlags_NoError = 1 << 10 | |
share_vars | 1 << 11 | ImGuiTestRunFlags_ShareVars = 1 << 11 | Share generic vars and custom vars between child and parent tests (custom vars need to be same type) |
share_test_context | 1 << 12 | ImGuiTestRunFlags_ShareTestContext = 1 << 12 | Share ImGuiTestContext instead of creating a new one (unsure what purpose this may be useful for yet) |
TODO: Add GuiFunc options¶
TestEngineResultSummary (class)¶
| Attribute | C++ | |
|---|---|---|
count_tested: int | int CountTested = 0; | Number of tests executed |
count_success: int | int CountSuccess = 0; | Number of tests succeeded |
count_in_queue: int | int CountInQueue = 0; | Number of tests remaining in queue (e.g. aborted, crashed) |
TestEngineResultSummary.__init__¶
def __init__(self, count_tested: int = 0, count_success: int = 0, count_in_queue: int = 0) -> NoneAuto-generated default constructor with named params
Functions¶
Legacy version support¶
hook_item_add¶
def hook_item_add(ui_ctx: Context, id_: ID, bb: ImRect, item_data: LastItemData) -> Noneextern void ImGuiTestEngineHook_ItemAdd(ImGuiContext* ui_ctx, ImGuiID id, const ImRect& bb, const ImGuiLastItemData* item_data);Hooks for core imgui/ library (generally called via macros) (private API)
hook_log¶
def hook_log(ui_ctx: Context, fmt: str) -> Noneextern void ImGuiTestEngineHook_Log(ImGuiContext* ui_ctx, const char* fmt, ...);(private API)
find_item_debug_label¶
def find_item_debug_label(ui_ctx: Context, id_: ID) -> strextern const char* ImGuiTestEngine_FindItemDebugLabel(ImGuiContext* ui_ctx, ImGuiID id);(private API)
Functions (generally called via IM_CHECK() macros)¶
check¶
def check(file: str, func: str, line: int, flags: TestCheckFlags, result: bool, expr: str) -> boolIMGUI_API bool ImGuiTestEngine_Check(const char* file, const char* func, int line, ImGuiTestCheckFlags flags, bool result, const char* expr);check_op_str¶
def check_op_str(file: str, func: str, line: int, flags: TestCheckFlags, op: str, lhs_desc: str, lhs_value: str, rhs_desc: str, rhs_value: str, out_result: bool) -> Tuple[bool, bool]IMGUI_API bool ImGuiTestEngine_CheckOpStr(const char* file, const char* func, int line, ImGuiTestCheckFlags flags, const char* op, const char* lhs_desc, const char* lhs_value, const char* rhs_desc, const char* rhs_value, bool* out_result);error¶
def error(file: str, func: str, line: int, flags: TestCheckFlags, fmt: str) -> boolIMGUI_API bool ImGuiTestEngine_Error(const char* file, const char* func, int line, ImGuiTestCheckFlags flags, const char* fmt, ...);assert_log¶
def assert_log(expr: str, file: str, function: str, line: int) -> NoneIMGUI_API void ImGuiTestEngine_AssertLog(const char* expr, const char* file, const char* function, int line);get_temp_string_builder¶
def get_temp_string_builder() -> TextBufferIMGUI_API ImGuiTextBuffer* ImGuiTestEngine_GetTempStringBuilder();ImGuiTestEngine API¶
Functions: Initialization¶
create_context¶
def create_context() -> TestEngineIMGUI_API ImGuiTestEngine* ImGuiTestEngine_CreateContext();ImGuiTestEngine_CreateContext: Create test engine
Note for python bindings users:
Integrating ImGui TestEngine directly from python, and without using HelloImGui and ImmApp is very difficult:
ImGui Test Engine uses two different threads (one for the main gui, and one for the scenario runner).
Your python code will be called from two separate threads, and this breaks the GIL!
HelloImGui and ImmApp handle this well by transferring the GIL between threads (from C++)
For gory details, see imgui
destroy_context¶
def destroy_context(engine: TestEngine) -> NoneIMGUI_API void ImGuiTestEngine_DestroyContext(ImGuiTestEngine* engine);Destroy test engine. Call after ImGui::DestroyContext() so test engine specific ini data gets saved.
start¶
def start(engine: TestEngine, ui_ctx: Context) -> NoneIMGUI_API void ImGuiTestEngine_Start(ImGuiTestEngine* engine, ImGuiContext* ui_ctx);Bind to a dear imgui context. Start coroutine.
stop¶
def stop(engine: TestEngine) -> NoneIMGUI_API void ImGuiTestEngine_Stop(ImGuiTestEngine* engine);Stop coroutine and export if any. (Unbind will lazily happen on context shutdown)
pre_swap¶
def pre_swap(engine: TestEngine) -> NoneIMGUI_API void ImGuiTestEngine_PreSwap(ImGuiTestEngine* engine);Call every frame before framebuffer present/swap (used for time measurement)
post_swap¶
def post_swap(engine: TestEngine) -> NoneIMGUI_API void ImGuiTestEngine_PostSwap(ImGuiTestEngine* engine);Call every frame after framebuffer present/swap, will process screen capture and call test_io.ScreenCaptureFunc()
get_io¶
def get_io(engine: TestEngine) -> TestEngineIOIMGUI_API ImGuiTestEngineIO& ImGuiTestEngine_GetIO(ImGuiTestEngine* engine);register_test¶
def register_test(engine: TestEngine, category: str, name: str, src_file: Optional[str] = None, src_line: int = 0) -> TestIMGUI_API ImGuiTest* ImGuiTestEngine_RegisterTest(ImGuiTestEngine* engine, const char* category, const char* name, const char* src_file = nullptr, int src_line = 0);Prefer calling IM_REGISTER_TEST()
unregister_test¶
def unregister_test(engine: TestEngine, test: Test) -> NoneIMGUI_API void ImGuiTestEngine_UnregisterTest(ImGuiTestEngine* engine, ImGuiTest* test);unregister_all_tests¶
def unregister_all_tests(engine: TestEngine) -> NoneIMGUI_API void ImGuiTestEngine_UnregisterAllTests(ImGuiTestEngine* engine);Functions: Main¶
queue_test¶
def queue_test(engine: TestEngine, test: Test, run_flags: TestRunFlags = 0) -> NoneIMGUI_API void ImGuiTestEngine_QueueTest(ImGuiTestEngine* engine, ImGuiTest* test, ImGuiTestRunFlags run_flags = 0);queue_tests¶
def queue_tests(engine: TestEngine, group: TestGroup, filter: Optional[str] = None, run_flags: TestRunFlags = 0) -> NoneIMGUI_API void ImGuiTestEngine_QueueTests(ImGuiTestEngine* engine, ImGuiTestGroup group, const char* filter = nullptr, ImGuiTestRunFlags run_flags = 0);try_abort_engine¶
def try_abort_engine(engine: TestEngine) -> boolIMGUI_API bool ImGuiTestEngine_TryAbortEngine(ImGuiTestEngine* engine);abort_current_test¶
def abort_current_test(engine: TestEngine) -> NoneIMGUI_API void ImGuiTestEngine_AbortCurrentTest(ImGuiTestEngine* engine);find_test_by_name¶
def find_test_by_name(engine: TestEngine, category: str, name: str) -> TestIMGUI_API ImGuiTest* ImGuiTestEngine_FindTestByName(ImGuiTestEngine* engine, const char* category, const char* name);Functions: Status Queries¶
FIXME: Clarify API to avoid function calls vs raw bools in ImGuiTestEngineIO
is_test_queue_empty¶
def is_test_queue_empty(engine: TestEngine) -> boolIMGUI_API bool ImGuiTestEngine_IsTestQueueEmpty(ImGuiTestEngine* engine);is_using_simulated_inputs¶
def is_using_simulated_inputs(engine: TestEngine) -> boolIMGUI_API bool ImGuiTestEngine_IsUsingSimulatedInputs(ImGuiTestEngine* engine);get_result_summary¶
def get_result_summary(engine: TestEngine, out_results: TestEngineResultSummary) -> NoneIMGUI_API void ImGuiTestEngine_GetResultSummary(ImGuiTestEngine* engine, ImGuiTestEngineResultSummary* out_results);Functions: Crash Handling¶
Ensure past test results are properly exported even if application crash during a test.
install_default_crash_handler¶
def install_default_crash_handler() -> NoneIMGUI_API void ImGuiTestEngine_InstallDefaultCrashHandler();Install default crash handler (if you don’t have one)
crash_handler¶
def crash_handler() -> NoneIMGUI_API void ImGuiTestEngine_CrashHandler();Default crash handler, should be called from a custom crash handler if such exists
IO structure to configure the test engine¶
TestEngineIO (class)¶
| Attribute | C++ | |
|---|---|---|
src_file_open_user_data: Optional[Any] | void* SrcFileOpenUserData = nullptr; | (Optional) User data for SrcFileOpenFunc |
screen_capture_user_data: Optional[Any] | void* ScreenCaptureUserData = nullptr; | (Optional) User data for ScreenCaptureFunc |
config_saved_settings: bool | bool ConfigSavedSettings = true; | Load/Save settings in main context .ini file. |
config_run_speed: TestRunSpeed | ImGuiTestRunSpeed ConfigRunSpeed = ImGuiTestRunSpeed_Fast; | Run tests in fast/normal/cinematic mode |
config_stop_on_error: bool | bool ConfigStopOnError = false; | Stop queued tests on test error |
config_break_on_error: bool | bool ConfigBreakOnError = false; | Break debugger on test error by calling IM_DEBUG_BREAK() |
config_keep_gui_func: bool | bool ConfigKeepGuiFunc = false; | Keep test GUI running at the end of the test |
config_restore_focus_after_tests: bool | bool ConfigRestoreFocusAfterTests = true; | Restore focus back after running tests |
config_capture_enabled: bool | bool ConfigCaptureEnabled = true; | Master enable flags for capturing and saving captures. Disable to avoid e.g. lengthy saving of large PNG files. |
config_capture_on_error: bool | bool ConfigCaptureOnError = false; | |
config_no_throttle: bool | bool ConfigNoThrottle = false; | Disable vsync for performance measurement or fast test running |
config_mouse_draw_cursor: bool | bool ConfigMouseDrawCursor = true; | Enable drawing of Dear ImGui software mouse cursor when running tests |
config_fixed_delta_time: float | float ConfigFixedDeltaTime = 0.0f; | Use fixed delta time instead of calculating it from wall clock |
perf_stress_amount: int | int PerfStressAmount = 1; | Integer to scale the amount of items submitted in test |
config_verbose_level: TestVerboseLevel | ImGuiTestVerboseLevel ConfigVerboseLevel = ImGuiTestVerboseLevel_Warning; | |
config_verbose_level_on_error: TestVerboseLevel | ImGuiTestVerboseLevel ConfigVerboseLevelOnError = ImGuiTestVerboseLevel_Info; | |
config_log_to_tty: bool | bool ConfigLogToTTY = false; | Output log entries to TTY (in addition to Test Engine UI) |
config_log_to_debugger: bool | bool ConfigLogToDebugger = false; | Output log entries to Debugger (in addition to Test Engine UI) |
config_log_to_func_user_data: Optional[Any] | void* ConfigLogToFuncUserData = NULL; | |
mouse_speed: float | float MouseSpeed = 600.0f; | Mouse speed (pixel/second) when not running in fast mode |
mouse_wobble: float | float MouseWobble = 0.25f; | (0.0..1.0) How much wobble to apply to the mouse (pixels per pixel of move distance) when not running in fast mode |
scroll_speed: float | float ScrollSpeed = 1400.0f; | Scroll speed (pixel/second) when not running in fast mode |
typing_speed: float | float TypingSpeed = 20.0f; | Char input speed (characters/second) when not running in fast mode |
action_delay_short: float | float ActionDelayShort = 0.15f; | Time between short actions |
action_delay_standard: float | float ActionDelayStandard = 0.40f; | Time between most actions |
config_watchdog_warning: float | float ConfigWatchdogWarning = 30.0f; | Warn when a test exceed this time (in second) |
config_watchdog_kill_test: float | float ConfigWatchdogKillTest = 60.0f; | Attempt to stop running a test when exceeding this time (in second) |
config_watchdog_kill_app: float | float ConfigWatchdogKillApp = FLT_MAX; | Stop application when exceeding this time (in second) |
export_results_format: TestEngineExportFormat | ImGuiTestEngineExportFormat ExportResultsFormat = (ImGuiTestEngineExportFormat)0; | |
check_draw_data_integrity: bool | bool CheckDrawDataIntegrity = false; | Check ImDrawData integrity (buffer count, etc.). Currently cheap but may become a slow operation. |
is_running_tests: bool | bool IsRunningTests = false; | |
is_requesting_max_app_speed: bool | bool IsRequestingMaxAppSpeed = false; | When running in fast mode: request app to skip vsync or even skip rendering if it wants |
is_capturing: bool | bool IsCapturing = false; | Capture is in progress |
TestEngineIO.export_results_filename_set¶
def export_results_filename_set(self, filename: str) -> Nonevoid ExportResultsFilename_Set(const char* filename);Set ExportResultsFilename from Python (private API)
TestEngineIO.__init__¶
def __init__(self, config_saved_settings: bool = True, config_run_speed: TestRunSpeed = TestRunSpeed_Fast, config_stop_on_error: bool = False, config_break_on_error: bool = False, config_keep_gui_func: bool = False, config_restore_focus_after_tests: bool = True, config_capture_enabled: bool = True, config_capture_on_error: bool = False, config_no_throttle: bool = False, config_mouse_draw_cursor: bool = True, config_fixed_delta_time: float = 0.0, perf_stress_amount: int = 1, config_verbose_level: TestVerboseLevel = TestVerboseLevel_Warning, config_verbose_level_on_error: TestVerboseLevel = TestVerboseLevel_Info, config_log_to_tty: bool = False, config_log_to_debugger: bool = False, mouse_speed: float = 600.0, mouse_wobble: float = 0.25, scroll_speed: float = 1400.0, typing_speed: float = 20.0, action_delay_short: float = 0.15, action_delay_standard: float = 0.4, config_watchdog_warning: float = 30.0, config_watchdog_kill_test: float = 60.0, config_watchdog_kill_app: float = sys.float_info.max, export_results_format: TestEngineExportFormat = TestEngineExportFormat.j_unit_xml, check_draw_data_integrity: bool = False, is_running_tests: bool = False, is_requesting_max_app_speed: bool = False, is_capturing: bool = False) -> NoneAuto-generated default constructor with named params
ImGuiTestItemInfo¶
TestItemInfo (class)¶
Information about a given item or window, result of an ItemInfo() or WindowInfo() query
| Attribute | C++ | |
|---|---|---|
id_: ID | ImGuiID ID = 0; | Item ID |
window: Optional[Window] | ImGuiWindow* Window = nullptr; | Item Window |
timestamp_main: int | int TimestampMain; | Timestamp of main result (all fields) |
timestamp_status: int | int TimestampStatus; | Timestamp of StatusFlags |
parent_id: ID | ImGuiID ParentID = 0; | Item Parent ID (value at top of the ID stack) |
rect_full: ImRect | ImRect RectFull = ImRect(); | Item Rectangle |
rect_clipped: ImRect | ImRect RectClipped = ImRect(); | Item Rectangle (clipped with window->ClipRect at time of item submission) |
item_flags: ItemFlags | ImGuiItemFlags ItemFlags = 0; | Item flags |
status_flags: ItemStatusFlags | ImGuiItemStatusFlags StatusFlags = 0; | Item Status flags (fully updated for some items only, compare TimestampStatus to FrameCount) |
TestItemInfo.__init__¶
def __init__(self) -> NoneImGuiTestItemInfo();TestItemList (class)¶
Result of an GatherItems() query
TestItemList.clear¶
def clear(self) -> Nonevoid Clear();(private API)
TestItemList.reserve¶
def reserve(self, capacity: int) -> Nonevoid Reserve(int capacity);(private API)
TestItemList.get_size¶
def get_size(self) -> intint GetSize() const;(private API)
TestItemList.get_by_index¶
def get_by_index(self, n: int) -> TestItemInfoconst ImGuiTestItemInfo* GetByIndex(int n);(private API)
TestItemList.get_by_id¶
def get_by_id(self, id_: ID) -> TestItemInfoconst ImGuiTestItemInfo* GetByID(ImGuiID id);(private API)
TestItemList.size¶
def size(self) -> intsize_t size() const;(private API)
TestItemList.begin¶
def begin(self) -> TestItemInfoconst ImGuiTestItemInfo* begin() const;(private API)
TestItemList.end¶
def end(self) -> TestItemInfoconst ImGuiTestItemInfo* end() const;(private API)
TestItemList.__init__¶
def __init__(self) -> NoneAuto-generated default constructor
TestLogLineInfo (class)¶
| Attribute | C++ | |
|---|---|---|
level: TestVerboseLevel | ImGuiTestVerboseLevel Level; | |
line_offset: int | int LineOffset; |
TestLogLineInfo.__init__¶
def __init__(self, level: TestVerboseLevel = TestVerboseLevel.warning, line_offset: int = int()) -> NoneAuto-generated default constructor with named params
TestLog (class)¶
| Attribute | C++ | |
|---|---|---|
buffer: TextBuffer | ImGuiTextBuffer Buffer; |
TestLog.__init__¶
def __init__(self) -> NoneImGuiTestLog();Functions
TestLog.is_empty¶
def is_empty(self) -> boolbool IsEmpty() const;(private API)
TestLog.get_text¶
def get_text(self) -> strconst char* GetText();(private API)
TestLog.get_text_len¶
def get_text_len(self) -> intint GetTextLen();(private API)
TestLog.clear¶
def clear(self) -> Nonevoid Clear();(private API)
TestLog.extract_lines_for_verbose_levels¶
def extract_lines_for_verbose_levels(self, level_min: TestVerboseLevel, level_max: TestVerboseLevel, out_buffer: TextBuffer) -> intint ExtractLinesForVerboseLevels(ImGuiTestVerboseLevel level_min, ImGuiTestVerboseLevel level_max, ImGuiTextBuffer* out_buffer);Extract log contents filtered per log-level.
Output:
- If ‘buffer != None’: all extracted lines are appended to ‘buffer’. Use ‘buffer->c_str()’ on your side to obtain the text.
- Return value: number of lines extracted (should be equivalent to number of ’
’ inside buffer->c_str()).
- You may call the function with buffer == None to only obtain a count without getting the data.
Verbose levels are inclusive:
- To get All Errors, Warnings, Debug... Use level_min == ImGuiTestVerboseLevel_Error, level_max = ImGuiTestVerboseLevel_Trace
(private API)TestLog.update_line_offsets¶
def update_line_offsets(self, engine_io: TestEngineIO, level: TestVerboseLevel, start: str) -> Nonevoid UpdateLineOffsets(ImGuiTestEngineIO* engine_io, ImGuiTestVerboseLevel level, const char* start);[Internal] (private API)
ImGuiTest¶
TestOutput (class)¶
Storage for the output of a test run
| Attribute | C++ | |
|---|---|---|
status: TestStatus | ImGuiTestStatus Status = ImGuiTestStatus_Unknown; | |
log: TestLog | ImGuiTestLog Log; | |
start_time: ImU64 | ImU64 StartTime = 0; | |
end_time: ImU64 | ImU64 EndTime = 0; |
TestOutput.__init__¶
def __init__(self, status: TestStatus = TestStatus_Unknown, log: Optional[TestLog] = None, start_time: ImU64 = 0, end_time: ImU64 = 0) -> NoneAuto-generated default constructor with named params
Python bindings defaults:
If Log is None, then its default value will be: TestLog()
Test (class)¶
Storage for one test
| Attribute | C++ | |
|---|---|---|
category: Str30 | Str30 Category; | Stored on the stack if len<30 |
name: Str30 | Str30 Name; | Stored on the stack if len<30 |
group: TestGroup | ImGuiTestGroup Group = ImGuiTestGroup_Unknown; | Coarse groups: ‘Tests’ or ‘Perf’ |
arg_variant: int | int ArgVariant = 0; | User parameter. Generally we use it to run variations of a same test by sharing GuiFunc/TestFunc |
flags: TestFlags | ImGuiTestFlags Flags = ImGuiTestFlags_None; | See ImGuiTestFlags_ |
gui_func: Function_TestGui | Function_TestGui GuiFunc = nullptr; | GUI function (optional if your test are running over an existing GUI application) |
test_func: Function_TestRunner | Function_TestRunner TestFunc = nullptr; | Test driving function |
teardown_func: Function_TestRunner | Function_TestRunner TeardownFunc = nullptr; | Teardown driving function, executed after TestFunc regardless of TestFunc failing. |
user_data: Optional[Any] | void* UserData = nullptr; | General purpose user data (if assigning capturing lambdas on GuiFunc/TestFunc you may not need to use this) |
source_file: Str256 | Str256 SourceFile; | FILE |
source_line: int | int SourceLine = 0; | LINE |
source_line_end: int | int SourceLineEnd = 0; | end of line (when calculated by ImGuiTestEngine_StartCalcSourceLineEnds()) |
output: TestOutput | ImGuiTestOutput Output; | |
vars_size: int | size_t VarsSize = 0; | |
vars_post_constructor_user_fn: Optional[Any] | void* VarsPostConstructorUserFn = nullptr; |
Test.__init__¶
def __init__(self) -> NoneImGuiTest();Functions
Test.set_owned_name¶
def set_owned_name(self, name: str) -> Nonevoid SetOwnedName(const char* name);[Bundle] Compatibility with upstream API: Name is owning here (Str30), no separate copy needed. (private API)
TestRunTask (class)¶
Stored in test queue
| Attribute | C++ | |
|---|---|---|
test: Optional[Test] | ImGuiTest* Test = nullptr; | |
run_flags: TestRunFlags | ImGuiTestRunFlags RunFlags = ImGuiTestRunFlags_None; |
TestRunTask.__init__¶
def __init__(self, run_flags: TestRunFlags = TestRunFlags_None) -> NoneAuto-generated default constructor with named params
imgui_te_context.h¶
ImGuiTestRef¶
TestRef (class)¶
Weak reference to an Item/Window given an hashed ID or a string path ID.
This is most often passed as argument to function and generally has a very short lifetime.
Documentation: https://
| Attribute | C++ | |
|---|---|---|
id_: ID | ImGuiID ID; | Pre-hashed ID |
TestRef.__init__¶
@overload
def __init__(self) -> None
@overload
def __init__(self, id_: ID) -> None
@overload
def __init__(self, path: str) -> NoneImGuiTestRef();
ImGuiTestRef(ImGuiID id);
ImGuiTestRef(const char* path);TestRef.is_empty¶
def is_empty(self) -> boolbool IsEmpty() const;(private API)
TestRefDesc (class)¶
Debug helper to output a string showing the Path, ID or Debug Label based on what is available (some items only have ID as we couldn’t find/store a Path) (The size is arbitrary, this is only used for logging info the user/debugger)
TestRefDesc.c_str¶
def c_str(self) -> strconst char* c_str();(private API)
TestRefDesc.__init__¶
@overload
def __init__(self, ref: Union[TestRef, str]) -> None
@overload
def __init__(self, ref: Union[TestRef, str], item: TestItemInfo) -> NoneImGuiTestRefDesc(const ImGuiTestRef& ref);
ImGuiTestRefDesc(const ImGuiTestRef& ref, const ImGuiTestItemInfo& item);ImGuiTestContext related Flags/Enumerations¶
TestAction (enum)¶
Named actions. Generally you will call the named helpers e.g. ItemClick(). This is used by shared/low-level functions such as ItemAction().
| Member | Value | C++ | |
|---|---|---|---|
unknown | 0 | ImGuiTestAction_Unknown = 0 | |
hover | 1 | ImGuiTestAction_Hover | Move mouse |
click | 2 | ImGuiTestAction_Click | Move mouse and click |
double_click | 3 | ImGuiTestAction_DoubleClick | Move mouse and double-click |
check | 4 | ImGuiTestAction_Check | Check item if unchecked (Checkbox, MenuItem or any widget reporting ImGuiItemStatusFlags_Checkable) |
uncheck | 5 | ImGuiTestAction_Uncheck | Uncheck item if checked |
open | 6 | ImGuiTestAction_Open | Open item if closed (TreeNode, BeginMenu or any widget reporting ImGuiItemStatusFlags_Openable) |
close | 7 | ImGuiTestAction_Close | Close item if opened |
input | 8 | ImGuiTestAction_Input | Start text inputing into a field (e.g. CTRL+Click on Drags/Slider, click on InputText etc.) |
nav_activate | 9 | ImGuiTestAction_NavActivate | Activate item with navigation |
count | 10 | ImGuiTestAction_COUNT |
TestOpFlags_ (enum)¶
Generic flags for many ImGuiTestContext functions
Some flags are only supported by a handful of functions. Check function headers for list of supported flags.
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImGuiTestOpFlags_None = 0 | |
no_check_hovered_id | 1 << 1 | ImGuiTestOpFlags_NoCheckHoveredId = 1 << 1 | Don’t check for HoveredId after aiming for a widget. This is automatic when there’s an active item, typically in drag and drop operation. Otherwise, a few situations may want this e.g. for items that don’t use ItemHoverable(), or when intently aiming for an item behind a popup/modal inhibition layer. |
no_error | 1 << 2 | ImGuiTestOpFlags_NoError = 1 << 2 | Don’t abort/error e.g. if the item cannot be found or the operation doesn’t succeed. |
no_focus_window | 1 << 3 | ImGuiTestOpFlags_NoFocusWindow = 1 << 3 | Don’t focus window when aiming at an item |
no_auto_uncollapse | 1 << 4 | ImGuiTestOpFlags_NoAutoUncollapse = 1 << 4 | Disable automatically uncollapsing windows (useful when specifically testing Collapsing behaviors) |
no_auto_open_full_path | 1 << 5 | ImGuiTestOpFlags_NoAutoOpenFullPath = 1 << 5 | Disable automatically opening intermediaries (e.g. ItemClick(“Hello/OK”) will automatically first open “Hello” if “OK” isn’t found. Only works if ref is a string path. |
no_yield | 1 << 6 | ImGuiTestOpFlags_NoYield = 1 << 6 | Don’t yield (only supported by a few functions), in case you need to manage rigorous per-frame timing. |
is_second_attempt | 1 << 7 | ImGuiTestOpFlags_IsSecondAttempt = 1 << 7 | Used by recursing functions to indicate a second attempt |
move_to_edge_l | 1 << 8 | ImGuiTestOpFlags_MoveToEdgeL = 1 << 8 | Simple Dumb aiming helpers to test widget that care about clicking position. May need to replace will better functionalities. |
move_to_edge_r | 1 << 9 | ImGuiTestOpFlags_MoveToEdgeR = 1 << 9 | |
move_to_edge_u | 1 << 10 | ImGuiTestOpFlags_MoveToEdgeU = 1 << 10 | |
move_to_edge_d | 1 << 11 | ImGuiTestOpFlags_MoveToEdgeD = 1 << 11 | |
no_scroll | 1 << 12 | ImGuiTestOpFlags_NoScroll = 1 << 12 | Disable automatically scrolling to reach an item. |
no_wait_when_moving | 1 << 13 | ImGuiTestOpFlags_NoWaitWhenMoving = 1 << 13 | Avoid waiting for item to be stable, lock current position and aim. |
TestActionFilter (class)¶
Advanced filtering for ItemActionAll()
| Attribute | C++ | |
|---|---|---|
max_depth: int | int MaxDepth; | |
max_passes: int | int MaxPasses; | |
max_item_count_per_depth: int | const int* MaxItemCountPerDepth; | (const) |
require_all_status_flags: ItemStatusFlags | ImGuiItemStatusFlags RequireAllStatusFlags; | |
require_any_status_flags: ItemStatusFlags | ImGuiItemStatusFlags RequireAnyStatusFlags; |
TestActionFilter.__init__¶
def __init__(self) -> NoneImGuiTestActionFilter();ImGuiTestGenericVars, ImGuiTestGenericItemStatus¶
TestGenericItemStatus (class)¶
Helper struct to store various query-able state of an item.
This facilitate interactions between GuiFunc and TestFunc, since those state are frequently used.
| Attribute | C++ | |
|---|---|---|
ret_value: int | int RetValue; | return value |
hovered: int | int Hovered; | result of IsItemHovered() |
hovered_allow_disabled: int | int HoveredAllowDisabled; | result of IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) |
active: int | int Active; | result of IsItemActive() |
focused: int | int Focused; | result of IsItemFocused() |
clicked: int | int Clicked; | result of IsItemClicked() |
visible: int | int Visible; | result of IsItemVisible() |
edited: int | int Edited; | result of IsItemEdited() |
activated: int | int Activated; | result of IsItemActivated() |
deactivated: int | int Deactivated; | result of IsItemDeactivated() |
deactivated_after_edit: int | int DeactivatedAfterEdit; | result of IsItemDeactivatedAfterEdit() |
TestGenericItemStatus.__init__¶
def __init__(self) -> NoneImGuiTestGenericItemStatus();TestGenericItemStatus.clear¶
def clear(self) -> Nonevoid Clear();(private API)
TestGenericItemStatus.query_set¶
def query_set(self, ret_val: bool = False) -> Nonevoid QuerySet(bool ret_val = false);(private API)
TestGenericItemStatus.query_inc¶
def query_inc(self, ret_val: bool = False) -> Nonevoid QueryInc(bool ret_val = false);(private API)
TestGenericItemStatus.draw¶
def draw(self) -> Nonevoid Draw();(private API)
TestGenericVars (class)¶
Generic structure with various storage fields.
This is useful for tests to quickly share data between GuiFunc and TestFunc without creating custom data structure.
If those fields are not enough: using test->SetVarsDataType<>() + ctx->GetVars<>() it is possible to store custom data.
| Attribute | C++ | |
|---|---|---|
step: int | int Step; | |
count: int | int Count; | |
dock_id: ID | ImGuiID DockId; | |
owner_id: ID | ImGuiID OwnerId; | |
window_size: ImVec2 | ImVec2 WindowSize; | |
window_flags: WindowFlags | ImGuiWindowFlags WindowFlags; | |
table_flags: TableFlags | ImGuiTableFlags TableFlags; | |
popup_flags: PopupFlags | ImGuiPopupFlags PopupFlags; | |
input_text_flags: InputTextFlags | ImGuiInputTextFlags InputTextFlags; | |
status: TestGenericItemStatus | ImGuiTestGenericItemStatus Status; | |
show_window1: bool | bool ShowWindow1, | |
show_window2: bool | ShowWindow2; | |
use_clipper: bool | bool UseClipper; | |
use_viewports: bool | bool UseViewports; | |
use_mixed_value: bool | bool UseMixedValue; | |
width: float | float Width; | |
pos: ImVec2 | ImVec2 Pos; | |
pivot: ImVec2 | ImVec2 Pivot; | |
item_size: ImVec2 | ImVec2 ItemSize; | |
color1: ImVec4 | ImVec4 Color1, | |
color2: ImVec4 | Color2; | |
int1: int | int Int1, | |
int2: int | Int2, | |
int_array: np.ndarray | IntArray[10]; | ndarray[type=int, size=10] |
float1: float | float Float1, | |
float2: float | Float2, | |
float_array: np.ndarray | FloatArray[10]; | ndarray[type=float, size=10] |
bool1: bool | bool Bool1, | |
bool2: bool | Bool2, | |
bool_array: np.ndarray | BoolArray[10]; | ndarray[type=bool, size=10] |
id_: ID | ImGuiID Id, | |
id_array: np.ndarray | IdArray[10]; | ndarray[type=ImGuiID, size=10] |
TestGenericVars.__init__¶
def __init__(self) -> NoneImGuiTestGenericVars();TestGenericVars.clear¶
def clear(self) -> Nonevoid Clear();(private API)
ImGuiTestContext¶
Context for a running ImGuiTest¶
This is the interface that most tests will interact with.
TestContext (class)¶
| Attribute | C++ | |
|---|---|---|
generic_vars: TestGenericVars | ImGuiTestGenericVars GenericVars; | Generic variables holder for convenience. |
user_vars: Optional[Any] | void* UserVars = nullptr; | Access using ctx->GetVars(). Setup with test->SetVarsDataType<>(). |
ui_context: Optional[Context] | ImGuiContext* UiContext = nullptr; | UI context |
engine_io: Optional[TestEngineIO] | ImGuiTestEngineIO* EngineIO = nullptr; | Test Engine IO/settings |
test: Optional[Test] | ImGuiTest* Test = nullptr; | Test currently running |
test_output: Optional[TestOutput] | ImGuiTestOutput* TestOutput = nullptr; | Test output (generally == &Test->Output while executing TestFunc) |
op_flags: TestOpFlags | ImGuiTestOpFlags OpFlags = ImGuiTestOpFlags_None; | Flags affecting all operation (supported: ImGuiTestOpFlags_NoAutoUncollapse) |
perf_stress_amount: int | int PerfStressAmount = 0; | Convenience copy of engine->IO.PerfStressAmount |
frame_count: int | int FrameCount = 0; | Test frame count (restarts from zero every time) |
first_test_frame_count: int | int FirstTestFrameCount = 0; | First frame where TestFunc is running (after warm-up frame). This is generally -1 or 0 depending on whether we have warm up enabled |
first_gui_frame: bool | bool FirstGuiFrame = false; | |
has_dock: bool | bool HasDock = false; | #ifdef IMGUI_HAS_DOCK expressed in an easier to test value |
engine: Optional[TestEngine] | ImGuiTestEngine* Engine = nullptr; | |
inputs: Optional[TestInputs] | ImGuiTestInputs* Inputs = nullptr; | |
run_flags: TestRunFlags | ImGuiTestRunFlags RunFlags = ImGuiTestRunFlags_None; | |
active_func: TestActiveFunc | ImGuiTestActiveFunc ActiveFunc = ImGuiTestActiveFunc_None; | None/GuiFunc/TestFunc |
running_time: float | double RunningTime = 0.0; | Amount of wall clock time the Test has been running. Used by safety watchdog. |
action_depth: int | int ActionDepth = 0; | Nested depth of ctx-> function calls (used to decorate log) |
capture_counter: int | int CaptureCounter = 0; | Number of captures |
error_counter: int | int ErrorCounter = 0; | Number of errors (generally this maxxes at 1 as most functions will early out) |
abort: bool | bool Abort = false; | |
perf_ref_dt: float | double PerfRefDt = -1.0; | |
perf_iterations: int | int PerfIterations = 400; | Number of frames for PerfCapture() measurements |
ref_id: ID | ImGuiID RefID = 0; | Reference ID over which all named references are based |
ref_window_id: ID | ImGuiID RefWindowID = 0; | ID of a window that contains RefID item |
input_mode: InputSource | ImGuiInputSource InputMode = ImGuiInputSource_Mouse; | Prefer interacting with mouse/keyboard/gamepad |
temp_string: ImVector_char | ImVector<char> TempString; | |
clipboard: ImVector_char | ImVector<char> Clipboard; | Private clipboard for the test instance |
foreign_windows_to_hide: ImVector_Window_ptr | ImVector<ImGuiWindow*> ForeignWindowsToHide; | |
dummy_item_info_null: TestItemInfo | ImGuiTestItemInfo DummyItemInfoNull; | Storage for ItemInfoNull() |
cached_lines_printed_to_tty: bool | bool CachedLinesPrintedToTTY = false; |
TestContext.finish¶
def finish(self, status: TestStatus = TestStatus_Success) -> Nonevoid Finish(ImGuiTestStatus status = ImGuiTestStatus_Success);(private API)
Set test status and stop running. Usually called when running test logic from GuiFunc() only.
TestContext.run_child_test¶
def run_child_test(self, test_name: str, flags: TestRunFlags = 0) -> TestStatusImGuiTestStatus RunChildTest(const char* test_name, ImGuiTestRunFlags flags = 0);(private API)
[Experimental] Run another test from the current test.
TestContext.is_error¶
def is_error(self) -> boolbool IsError() const;(private API)
TestContext.is_warm_up_gui_frame¶
def is_warm_up_gui_frame(self) -> boolbool IsWarmUpGuiFrame() const;(private API)
Unless test->Flags has ImGuiTestFlags_NoGuiWarmUp, we run GuiFunc() twice before running TestFunc(). Those frames are called “WarmUp” frames.
TestContext.is_first_gui_frame¶
def is_first_gui_frame(self) -> boolbool IsFirstGuiFrame() const;(private API)
TestContext.is_first_test_frame¶
def is_first_test_frame(self) -> boolbool IsFirstTestFrame() const;(private API)
First frame where TestFunc is running (after warm-up frame).
TestContext.is_gui_func_only¶
def is_gui_func_only(self) -> boolbool IsGuiFuncOnly() const;(private API)
TestContext.suspend_test_func¶
def suspend_test_func(self, file: Optional[str] = None, line: int = 0) -> boolbool SuspendTestFunc(const char* file = nullptr, int line = 0);(private API)
[DEBUG] Generally called via IM_SUSPEND_TESTFUNC
TestContext.log_ex¶
def log_ex(self, level: TestVerboseLevel, flags: TestLogFlags, fmt: str) -> Nonevoid LogEx(ImGuiTestVerboseLevel level, ImGuiTestLogFlags flags, const char* fmt, ...) ;(private API)
TestContext.log_to_tty¶
def log_to_tty(self, level: TestVerboseLevel, message: str, message_end: Optional[str] = None) -> Nonevoid LogToTTY(ImGuiTestVerboseLevel level, const char* message, const char* message_end = nullptr);(private API)
TestContext.log_to_debugger¶
def log_to_debugger(self, level: TestVerboseLevel, message: str) -> Nonevoid LogToDebugger(ImGuiTestVerboseLevel level, const char* message);(private API)
TestContext.log_debug¶
def log_debug(self, fmt: str) -> Nonevoid LogDebug(const char* fmt, ...) ;(private API)
ImGuiTestVerboseLevel_Debug or ImGuiTestVerboseLevel_Trace depending on context depth
TestContext.log_info¶
def log_info(self, fmt: str) -> Nonevoid LogInfo(const char* fmt, ...) ;(private API)
ImGuiTestVerboseLevel_Info
TestContext.log_warning¶
def log_warning(self, fmt: str) -> Nonevoid LogWarning(const char* fmt, ...) ;(private API)
ImGuiTestVerboseLevel_Warning
TestContext.log_error¶
def log_error(self, fmt: str) -> Nonevoid LogError(const char* fmt, ...) ;(private API)
ImGuiTestVerboseLevel_Error
TestContext.log_basic_ui_state¶
def log_basic_ui_state(self) -> Nonevoid LogBasicUiState();(private API)
TestContext.log_item_list¶
def log_item_list(self, list: TestItemList) -> Nonevoid LogItemList(ImGuiTestItemList* list);(private API)
TestContext.yield_¶
def yield_(self, count: int = 1) -> Nonevoid Yield(int count = 1);(private API)
TestContext.sleep¶
def sleep(self, time_in_second: float) -> Nonevoid Sleep(float time_in_second);(private API)
Sleep for a given simulation time, unless in Fast mode
TestContext.sleep_short¶
def sleep_short(self) -> Nonevoid SleepShort();(private API)
Standard short delay of io.ActionDelayShort (~0.15), unless in Fast mode.
TestContext.sleep_standard¶
def sleep_standard(self) -> Nonevoid SleepStandard();(private API)
Standard regular delay of io.ActionDelayStandard (~0.40), unless in Fast mode.
TestContext.sleep_no_skip¶
def sleep_no_skip(self, time_in_second: float, framestep_in_second: float) -> Nonevoid SleepNoSkip(float time_in_second, float framestep_in_second);(private API)
TestContext.set_ref¶
@overload
def set_ref(self, ref: Union[TestRef, str]) -> None
@overload
def set_ref(self, window: Window) -> Nonevoid SetRef(ImGuiTestRef ref);
void SetRef(ImGuiWindow* window);(private API)
TestContext.get_ref¶
def get_ref(self) -> TestRefImGuiTestRef GetRef();(private API)
TestContext.window_info¶
def window_info(self, window_ref: Union[TestRef, str], flags: TestOpFlags = TestOpFlags_None) -> TestItemInfoImGuiTestItemInfo WindowInfo(ImGuiTestRef window_ref, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);(private API)
TestContext.window_close¶
def window_close(self, window_ref: Union[TestRef, str]) -> Nonevoid WindowClose(ImGuiTestRef window_ref);(private API)
TestContext.window_collapse¶
def window_collapse(self, window_ref: Union[TestRef, str], collapsed: bool) -> Nonevoid WindowCollapse(ImGuiTestRef window_ref, bool collapsed);(private API)
TestContext.window_focus¶
def window_focus(self, window_ref: Union[TestRef, str], flags: TestOpFlags = TestOpFlags_None) -> Nonevoid WindowFocus(ImGuiTestRef window_ref, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);(private API)
TestContext.window_bring_to_front¶
def window_bring_to_front(self, window_ref: Union[TestRef, str], flags: TestOpFlags = TestOpFlags_None) -> Nonevoid WindowBringToFront(ImGuiTestRef window_ref, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);(private API)
TestContext.window_move¶
def window_move(self, window_ref: Union[TestRef, str], pos: ImVec2Like, pivot: Optional[ImVec2Like] = None, flags: TestOpFlags = TestOpFlags_None) -> Nonevoid WindowMove(ImGuiTestRef window_ref, ImVec2 pos, ImVec2 pivot = ImVec2(0.0f, 0.0f), ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);Python bindings defaults:
If pivot is None, then its default value will be: ImVec2(0.0, 0.0)
(private API)
TestContext.window_resize¶
def window_resize(self, window_ref: Union[TestRef, str], sz: ImVec2Like) -> Nonevoid WindowResize(ImGuiTestRef window_ref, ImVec2 sz);(private API)
TestContext.window_teleport_to_make_pos_visible¶
def window_teleport_to_make_pos_visible(self, window_ref: Union[TestRef, str], pos_in_window: ImVec2Like) -> boolbool WindowTeleportToMakePosVisible(ImGuiTestRef window_ref, ImVec2 pos_in_window);(private API)
TestContext.get_window_by_ref¶
def get_window_by_ref(self, window_ref: Union[TestRef, str]) -> WindowImGuiWindow*GetWindowByRef(ImGuiTestRef window_ref);(private API)
TestContext.popup_close_one¶
def popup_close_one(self) -> Nonevoid PopupCloseOne();(private API)
TestContext.popup_close_all¶
def popup_close_all(self) -> Nonevoid PopupCloseAll();(private API)
TestContext.popup_get_window_id¶
def popup_get_window_id(self, ref: Union[TestRef, str]) -> IDImGuiID PopupGetWindowID(ImGuiTestRef ref);(private API)
TestContext.get_id¶
@overload
def get_id(self, ref: Union[TestRef, str]) -> ID
@overload
def get_id(self, ref: Union[TestRef, str], seed_ref: Union[TestRef, str]) -> IDImGuiID GetID(ImGuiTestRef ref);
ImGuiID GetID(ImGuiTestRef ref, ImGuiTestRef seed_ref);(private API)
Get hash for a decorated ID Path.
Note: for windows you may use WindowInfo()
TestContext.get_pos_on_void¶
def get_pos_on_void(self, viewport: Viewport) -> ImVec2ImVec2 GetPosOnVoid(ImGuiViewport* viewport);(private API)
Find a point that has no windows // FIXME: This needs error return and flag to enable/disable forcefully finding None.
TestContext.get_window_titlebar_point¶
def get_window_titlebar_point(self, window_ref: Union[TestRef, str]) -> ImVec2ImVec2 GetWindowTitlebarPoint(ImGuiTestRef window_ref);(private API)
Return a clickable point on window title-bar (window tab for docked windows) that will e.g. move this single window.
TestContext.get_main_monitor_work_pos¶
def get_main_monitor_work_pos(self) -> ImVec2ImVec2 GetMainMonitorWorkPos();(private API)
Work pos and size of main viewport when viewports are disabled, or work pos and size of monitor containing main viewport when viewports are enabled.
TestContext.get_main_monitor_work_size¶
def get_main_monitor_work_size(self) -> ImVec2ImVec2 GetMainMonitorWorkSize();(private API)
TestContext.capture_reset¶
def capture_reset(self) -> Nonevoid CaptureReset();(private API)
Reset state (use when doing multiple captures)
TestContext.capture_set_extension¶
def capture_set_extension(self, ext: str) -> Nonevoid CaptureSetExtension(const char* ext);(private API)
Set capture file format (otherwise for video this default to EngineIO->VideoCaptureExtension)
TestContext.capture_set_filename¶
def capture_set_filename(self, filename: str) -> Nonevoid CaptureSetFilename(const char* filename);[ADAPT_IMGUI_BUNDLE]
Where to save the next CaptureScreenshot*/CaptureBeginVideo (length: 256 max!)
(private API)
TestContext.capture_add_window¶
def capture_add_window(self, ref: Union[TestRef, str]) -> boolbool CaptureAddWindow(ImGuiTestRef ref);(private API)
Add window to be captured (default to capture everything)
TestContext.capture_screenshot_window¶
def capture_screenshot_window(self, ref: Union[TestRef, str], capture_flags: int = 0) -> Nonevoid CaptureScreenshotWindow(ImGuiTestRef ref, int capture_flags = 0);(private API)
Trigger a screen capture of a single window (== CaptureAddWindow() + CaptureScreenshot())
TestContext.capture_screenshot¶
def capture_screenshot(self, capture_flags: int = 0) -> boolbool CaptureScreenshot(int capture_flags = 0);(private API)
Trigger a screen capture
TestContext.capture_begin_video¶
def capture_begin_video(self) -> boolbool CaptureBeginVideo();(private API)
Start a video capture
TestContext.capture_end_video¶
def capture_end_video(self) -> boolbool CaptureEndVideo();(private API)
TestContext.mouse_move¶
def mouse_move(self, ref: Union[TestRef, str], flags: TestOpFlags = TestOpFlags_None) -> Nonevoid MouseMove(ImGuiTestRef ref, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);(private API)
TestContext.mouse_move_to_pos¶
def mouse_move_to_pos(self, pos: ImVec2Like) -> Nonevoid MouseMoveToPos(ImVec2 pos);(private API)
TestContext.mouse_teleport_to_pos¶
def mouse_teleport_to_pos(self, pos: ImVec2Like, flags: TestOpFlags = TestOpFlags_None) -> Nonevoid MouseTeleportToPos(ImVec2 pos, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);(private API)
TestContext.mouse_click¶
def mouse_click(self, button: MouseButton = 0) -> Nonevoid MouseClick(ImGuiMouseButton button = 0);(private API)
TestContext.mouse_click_multi¶
def mouse_click_multi(self, button: MouseButton, count: int) -> Nonevoid MouseClickMulti(ImGuiMouseButton button, int count);(private API)
TestContext.mouse_double_click¶
def mouse_double_click(self, button: MouseButton = 0) -> Nonevoid MouseDoubleClick(ImGuiMouseButton button = 0);(private API)
TestContext.mouse_down¶
def mouse_down(self, button: MouseButton = 0) -> Nonevoid MouseDown(ImGuiMouseButton button = 0);(private API)
TestContext.mouse_up¶
def mouse_up(self, button: MouseButton = 0) -> Nonevoid MouseUp(ImGuiMouseButton button = 0);(private API)
TestContext.mouse_lift_drag_threshold¶
def mouse_lift_drag_threshold(self, button: MouseButton = 0) -> Nonevoid MouseLiftDragThreshold(ImGuiMouseButton button = 0);(private API)
TestContext.mouse_drag_with_delta¶
def mouse_drag_with_delta(self, delta: ImVec2Like, button: MouseButton = 0) -> Nonevoid MouseDragWithDelta(ImVec2 delta, ImGuiMouseButton button = 0);(private API)
TestContext.mouse_wheel¶
def mouse_wheel(self, delta: ImVec2Like) -> Nonevoid MouseWheel(ImVec2 delta);(private API)
TestContext.mouse_wheel_x¶
def mouse_wheel_x(self, dx: float) -> Nonevoid MouseWheelX(float dx);(private API)
TestContext.mouse_wheel_y¶
def mouse_wheel_y(self, dy: float) -> Nonevoid MouseWheelY(float dy);(private API)
+1: up, -1: down
TestContext.mouse_move_to_void¶
def mouse_move_to_void(self, viewport: Optional[Viewport] = None) -> Nonevoid MouseMoveToVoid(ImGuiViewport* viewport = nullptr);(private API)
TestContext.mouse_click_on_void¶
def mouse_click_on_void(self, button: MouseButton = 0, viewport: Optional[Viewport] = None) -> Nonevoid MouseClickOnVoid(ImGuiMouseButton button = 0, ImGuiViewport* viewport = nullptr);(private API)
TestContext.find_hovered_window_at_pos¶
def find_hovered_window_at_pos(self, pos: ImVec2Like) -> WindowImGuiWindow*FindHoveredWindowAtPos(const ImVec2& pos);(private API)
TestContext.find_existing_void_pos_on_viewport¶
def find_existing_void_pos_on_viewport(self, viewport: Viewport, out: ImVec2Like) -> boolbool FindExistingVoidPosOnViewport(ImGuiViewport* viewport, ImVec2* out);(private API)
TestContext.mouse_set_viewport¶
def mouse_set_viewport(self, window: Window) -> Nonevoid MouseSetViewport(ImGuiWindow* window);(private API)
TestContext.mouse_set_viewport_id¶
def mouse_set_viewport_id(self, viewport_id: ID) -> Nonevoid MouseSetViewportID(ImGuiID viewport_id);(private API)
TestContext.key_down¶
def key_down(self, key_chord: KeyChord) -> Nonevoid KeyDown(ImGuiKeyChord key_chord);(private API)
TestContext.key_up¶
def key_up(self, key_chord: KeyChord) -> Nonevoid KeyUp(ImGuiKeyChord key_chord);(private API)
TestContext.key_press¶
def key_press(self, key_chord: KeyChord, count: int = 1) -> Nonevoid KeyPress(ImGuiKeyChord key_chord, int count = 1);(private API)
TestContext.key_hold¶
def key_hold(self, key_chord: KeyChord, time: float) -> Nonevoid KeyHold(ImGuiKeyChord key_chord, float time);(private API)
TestContext.key_set_ex¶
def key_set_ex(self, key_chord: KeyChord, is_down: bool, time: float) -> Nonevoid KeySetEx(ImGuiKeyChord key_chord, bool is_down, float time);(private API)
TestContext.key_chars¶
def key_chars(self, chars: str) -> Nonevoid KeyChars(const char* chars);(private API)
Input characters
TestContext.key_chars_append¶
def key_chars_append(self, chars: str) -> Nonevoid KeyCharsAppend(const char* chars);(private API)
Input characters at end of field
TestContext.key_chars_append_enter¶
def key_chars_append_enter(self, chars: str) -> Nonevoid KeyCharsAppendEnter(const char* chars);(private API)
Input characters at end of field, press Enter
TestContext.key_chars_replace¶
def key_chars_replace(self, chars: str) -> Nonevoid KeyCharsReplace(const char* chars);(private API)
Delete existing field then input characters
TestContext.key_chars_replace_enter¶
def key_chars_replace_enter(self, chars: str) -> Nonevoid KeyCharsReplaceEnter(const char* chars);(private API)
Delete existing field then input characters, press Enter
TestContext.set_input_mode¶
def set_input_mode(self, input_mode: InputSource) -> Nonevoid SetInputMode(ImGuiInputSource input_mode);(private API)
Mouse or Keyboard or Gamepad. In Keyboard or Gamepad mode, actions such as ItemClick or ItemInput are using nav facilities instead of Mouse.
TestContext.nav_move_to¶
def nav_move_to(self, ref: Union[TestRef, str]) -> Nonevoid NavMoveTo(ImGuiTestRef ref);(private API)
TestContext.nav_activate¶
def nav_activate(self) -> Nonevoid NavActivate();(private API)
Activate current selected item: activate button, tweak sliders/drags. Equivalent of pressing Space on keyboard, ImGuiKey_GamepadFaceUp on a gamepad.
TestContext.nav_input¶
def nav_input(self) -> Nonevoid NavInput();(private API)
Input into select item: input sliders/drags. Equivalent of pressing Enter on keyboard, ImGuiKey_GamepadFaceDown on a gamepad.
TestContext.scroll_to¶
def scroll_to(self, ref: Union[TestRef, str], axis: Axis, scroll_v: float, flags: TestOpFlags = TestOpFlags_None) -> Nonevoid ScrollTo(ImGuiTestRef ref, ImGuiAxis axis, float scroll_v, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);Scrolling (private API)
TestContext.scroll_to_x¶
def scroll_to_x(self, ref: Union[TestRef, str], scroll_x: float) -> Nonevoid ScrollToX(ImGuiTestRef ref, float scroll_x);(private API)
TestContext.scroll_to_y¶
def scroll_to_y(self, ref: Union[TestRef, str], scroll_y: float) -> Nonevoid ScrollToY(ImGuiTestRef ref, float scroll_y);(private API)
TestContext.scroll_to_top¶
def scroll_to_top(self, ref: Union[TestRef, str]) -> Nonevoid ScrollToTop(ImGuiTestRef ref);(private API)
TestContext.scroll_to_bottom¶
def scroll_to_bottom(self, ref: Union[TestRef, str]) -> Nonevoid ScrollToBottom(ImGuiTestRef ref);(private API)
TestContext.scroll_to_pos¶
def scroll_to_pos(self, window_ref: Union[TestRef, str], pos_v: float, axis: Axis, flags: TestOpFlags = TestOpFlags_None) -> Nonevoid ScrollToPos(ImGuiTestRef window_ref, float pos_v, ImGuiAxis axis, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);(private API)
TestContext.scroll_to_pos_x¶
def scroll_to_pos_x(self, window_ref: Union[TestRef, str], pos_x: float) -> Nonevoid ScrollToPosX(ImGuiTestRef window_ref, float pos_x);(private API)
TestContext.scroll_to_pos_y¶
def scroll_to_pos_y(self, window_ref: Union[TestRef, str], pos_y: float) -> Nonevoid ScrollToPosY(ImGuiTestRef window_ref, float pos_y);(private API)
TestContext.scroll_to_item¶
def scroll_to_item(self, ref: Union[TestRef, str], axis: Axis, flags: TestOpFlags = TestOpFlags_None) -> Nonevoid ScrollToItem(ImGuiTestRef ref, ImGuiAxis axis, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);(private API)
TestContext.scroll_to_item_x¶
def scroll_to_item_x(self, ref: Union[TestRef, str]) -> Nonevoid ScrollToItemX(ImGuiTestRef ref);(private API)
TestContext.scroll_to_item_y¶
def scroll_to_item_y(self, ref: Union[TestRef, str]) -> Nonevoid ScrollToItemY(ImGuiTestRef ref);(private API)
TestContext.scroll_to_tab_item¶
def scroll_to_tab_item(self, tab_bar: TabBar, tab_id: ID) -> Nonevoid ScrollToTabItem(ImGuiTabBar* tab_bar, ImGuiID tab_id);(private API)
TestContext.item_info¶
def item_info(self, ref: Union[TestRef, str], flags: TestOpFlags = TestOpFlags_None) -> TestItemInfoImGuiTestItemInfo ItemInfo(ImGuiTestRef ref, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);(private API)
TestContext.item_info_open_full_path¶
def item_info_open_full_path(self, ref: Union[TestRef, str], flags: TestOpFlags = TestOpFlags_None) -> TestItemInfoImGuiTestItemInfo ItemInfoOpenFullPath(ImGuiTestRef ref, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);(private API)
TestContext.item_info_handle_wildcard_search¶
def item_info_handle_wildcard_search(self, wildcard_prefix_start: str, wildcard_prefix_end: str, wildcard_suffix_start: str) -> IDImGuiID ItemInfoHandleWildcardSearch(const char* wildcard_prefix_start, const char* wildcard_prefix_end, const char* wildcard_suffix_start);(private API)
TestContext.item_info_null¶
def item_info_null(self) -> TestItemInfoImGuiTestItemInfo ItemInfoNull();(private API)
TestContext.gather_items¶
def gather_items(self, out_list: TestItemList, parent: Union[TestRef, str], depth: int = -1) -> Nonevoid GatherItems(ImGuiTestItemList* out_list, ImGuiTestRef parent, int depth = -1);(private API)
TestContext.item_action¶
def item_action(self, action: TestAction, ref: Union[TestRef, str], flags: TestOpFlags = 0, action_arg: Optional[Any] = None) -> Nonevoid ItemAction(ImGuiTestAction action, ImGuiTestRef ref, ImGuiTestOpFlags flags = 0, void* action_arg = nullptr);Item/Widgets manipulation (private API)
TestContext.item_click¶
def item_click(self, ref: Union[TestRef, str], button: MouseButton = 0, flags: TestOpFlags = 0) -> Nonevoid ItemClick(ImGuiTestRef ref, ImGuiMouseButton button = 0, ImGuiTestOpFlags flags = 0);(private API)
TestContext.item_double_click¶
def item_double_click(self, ref: Union[TestRef, str], flags: TestOpFlags = 0) -> Nonevoid ItemDoubleClick(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0);(private API)
TestContext.item_check¶
def item_check(self, ref: Union[TestRef, str], flags: TestOpFlags = 0) -> Nonevoid ItemCheck(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0);(private API)
TestContext.item_uncheck¶
def item_uncheck(self, ref: Union[TestRef, str], flags: TestOpFlags = 0) -> Nonevoid ItemUncheck(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0);(private API)
TestContext.item_open¶
def item_open(self, ref: Union[TestRef, str], flags: TestOpFlags = 0) -> Nonevoid ItemOpen(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0);(private API)
TestContext.item_close¶
def item_close(self, ref: Union[TestRef, str], flags: TestOpFlags = 0) -> Nonevoid ItemClose(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0);(private API)
TestContext.item_input¶
def item_input(self, ref: Union[TestRef, str], flags: TestOpFlags = 0) -> Nonevoid ItemInput(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0);(private API)
TestContext.item_nav_activate¶
def item_nav_activate(self, ref: Union[TestRef, str], flags: TestOpFlags = 0) -> Nonevoid ItemNavActivate(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0);(private API)
TestContext.item_action_all¶
def item_action_all(self, action: TestAction, ref_parent: Union[TestRef, str], filter: Optional[TestActionFilter] = None) -> Nonevoid ItemActionAll(ImGuiTestAction action, ImGuiTestRef ref_parent, const ImGuiTestActionFilter* filter = nullptr);(private API)
TestContext.item_open_all¶
def item_open_all(self, ref_parent: Union[TestRef, str], depth: int = -1, passes: int = -1) -> Nonevoid ItemOpenAll(ImGuiTestRef ref_parent, int depth = -1, int passes = -1);(private API)
TestContext.item_close_all¶
def item_close_all(self, ref_parent: Union[TestRef, str], depth: int = -1, passes: int = -1) -> Nonevoid ItemCloseAll(ImGuiTestRef ref_parent, int depth = -1, int passes = -1);(private API)
TestContext.item_input_value¶
@overload
def item_input_value(self, ref: Union[TestRef, str], v: int) -> None
@overload
def item_input_value(self, ref: Union[TestRef, str], f: float) -> None
@overload
def item_input_value(self, ref: Union[TestRef, str], str: str) -> Nonevoid ItemInputValue(ImGuiTestRef ref, int v);
void ItemInputValue(ImGuiTestRef ref, float f);
void ItemInputValue(ImGuiTestRef ref, const char* str);(private API)
TestContext.item_read_as_int¶
def item_read_as_int(self, ref: Union[TestRef, str]) -> intint ItemReadAsInt(ImGuiTestRef ref);(private API)
Item/Widgets: Helpers to easily read a value by selecting Slider/Drag/Input text, copying it and parsing it.
This requires the item to be selectable (we will later provide helpers that works in more general manner)
(this temporarily use the internal test clipboard, but original clipboard value is restored afterwards)
See https://github .com /ocornut /imgui _test _engine /wiki /Automation -API #accessing -your -data
TestContext.item_read_as_float¶
def item_read_as_float(self, ref: Union[TestRef, str]) -> floatfloat ItemReadAsFloat(ImGuiTestRef ref);(private API)
TestContext.item_read_as_scalar¶
def item_read_as_scalar(self, ref: Union[TestRef, str], data_type: DataType, out_data: Any, flags: TestOpFlags = TestOpFlags_None) -> boolbool ItemReadAsScalar(ImGuiTestRef ref, ImGuiDataType data_type, void* out_data, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);(private API)
TestContext.item_exists¶
def item_exists(self, ref: Union[TestRef, str]) -> boolbool ItemExists(ImGuiTestRef ref);(private API)
TestContext.item_is_checked¶
def item_is_checked(self, ref: Union[TestRef, str]) -> boolbool ItemIsChecked(ImGuiTestRef ref);(private API)
TestContext.item_is_opened¶
def item_is_opened(self, ref: Union[TestRef, str]) -> boolbool ItemIsOpened(ImGuiTestRef ref);(private API)
TestContext.item_is_visible¶
def item_is_visible(self, ref: Union[TestRef, str]) -> boolbool ItemIsVisible(ImGuiTestRef ref);(private API)
TestContext.item_make_visible¶
def item_make_visible(self, ref: Union[TestRef, str], flags: TestOpFlags) -> Nonevoid ItemMakeVisible(ImGuiTestRef ref, ImGuiTestOpFlags flags);(private API)
TestContext.item_verify_checked_if_alive¶
def item_verify_checked_if_alive(self, ref: Union[TestRef, str], checked: bool) -> Nonevoid ItemVerifyCheckedIfAlive(ImGuiTestRef ref, bool checked);(private API)
TestContext.item_hold¶
def item_hold(self, ref: Union[TestRef, str], time: float) -> Nonevoid ItemHold(ImGuiTestRef ref, float time);(private API)
TestContext.item_hold_for_frames¶
def item_hold_for_frames(self, ref: Union[TestRef, str], frames: int) -> Nonevoid ItemHoldForFrames(ImGuiTestRef ref, int frames);(private API)
TestContext.item_drag_over_and_hold¶
def item_drag_over_and_hold(self, ref_src: Union[TestRef, str], ref_dst: Union[TestRef, str]) -> Nonevoid ItemDragOverAndHold(ImGuiTestRef ref_src, ImGuiTestRef ref_dst);(private API)
TestContext.item_drag_and_drop¶
def item_drag_and_drop(self, ref_src: Union[TestRef, str], ref_dst: Union[TestRef, str], button: MouseButton = 0) -> Nonevoid ItemDragAndDrop(ImGuiTestRef ref_src, ImGuiTestRef ref_dst, ImGuiMouseButton button = 0);(private API)
TestContext.item_drag_to_pos¶
def item_drag_to_pos(self, ref_src: Union[TestRef, str], pos: ImVec2Like) -> Nonevoid ItemDragToPos(ImGuiTestRef ref_src, const ImVec2& pos);(private API)
TestContext.item_drag_with_delta¶
def item_drag_with_delta(self, ref_src: Union[TestRef, str], pos_delta: ImVec2Like) -> Nonevoid ItemDragWithDelta(ImGuiTestRef ref_src, const ImVec2& pos_delta);(private API)
TestContext.tab_close¶
def tab_close(self, ref: Union[TestRef, str]) -> Nonevoid TabClose(ImGuiTestRef ref);(private API)
TestContext.menu_action¶
def menu_action(self, action: TestAction, ref: Union[TestRef, str]) -> Nonevoid MenuAction(ImGuiTestAction action, ImGuiTestRef ref);(private API)
TestContext.menu_action_all¶
def menu_action_all(self, action: TestAction, ref_parent: Union[TestRef, str]) -> Nonevoid MenuActionAll(ImGuiTestAction action, ImGuiTestRef ref_parent);(private API)
TestContext.menu_click¶
def menu_click(self, ref: Union[TestRef, str]) -> Nonevoid MenuClick(ImGuiTestRef ref);(private API)
TestContext.menu_check¶
def menu_check(self, ref: Union[TestRef, str]) -> Nonevoid MenuCheck(ImGuiTestRef ref);(private API)
TestContext.menu_uncheck¶
def menu_uncheck(self, ref: Union[TestRef, str]) -> Nonevoid MenuUncheck(ImGuiTestRef ref);(private API)
TestContext.menu_check_all¶
def menu_check_all(self, ref_parent: Union[TestRef, str]) -> Nonevoid MenuCheckAll(ImGuiTestRef ref_parent);(private API)
TestContext.menu_uncheck_all¶
def menu_uncheck_all(self, ref_parent: Union[TestRef, str]) -> Nonevoid MenuUncheckAll(ImGuiTestRef ref_parent);(private API)
TestContext.combo_click¶
def combo_click(self, ref: Union[TestRef, str]) -> Nonevoid ComboClick(ImGuiTestRef ref);(private API)
TestContext.combo_click_all¶
def combo_click_all(self, ref: Union[TestRef, str]) -> Nonevoid ComboClickAll(ImGuiTestRef ref);(private API)
TestContext.table_open_context_menu¶
def table_open_context_menu(self, ref: Union[TestRef, str], column_n: int = -1) -> Nonevoid TableOpenContextMenu(ImGuiTestRef ref, int column_n = -1);(private API)
TestContext.table_click_header¶
def table_click_header(self, ref: Union[TestRef, str], label: str, key_mods: KeyChord = 0) -> SortDirectionImGuiSortDirection TableClickHeader(ImGuiTestRef ref, const char* label, ImGuiKeyChord key_mods = 0);(private API)
TestContext.table_set_column_enabled¶
@overload
def table_set_column_enabled(self, ref: Union[TestRef, str], column_n: int, enabled: bool) -> None
@overload
def table_set_column_enabled(self, ref: Union[TestRef, str], label: str, enabled: bool) -> Nonevoid TableSetColumnEnabled(ImGuiTestRef ref, int column_n, bool enabled);
void TableSetColumnEnabled(ImGuiTestRef ref, const char* label, bool enabled);(private API)
TestContext.table_resize_column¶
@overload
def table_resize_column(self, ref: Union[TestRef, str], column_n: int, width: float) -> None
@overload
def table_resize_column(self, ref: Union[TestRef, str], label: str, width: float) -> Nonevoid TableResizeColumn(ImGuiTestRef ref, int column_n, float width);
void TableResizeColumn(ImGuiTestRef ref, const char* label, float width);(private API)
TestContext.table_get_sort_specs¶
def table_get_sort_specs(self, ref: Union[TestRef, str]) -> TableSortSpecsconst ImGuiTableSortSpecs* TableGetSortSpecs(ImGuiTestRef ref);(private API)
TestContext.dock_clear¶
def dock_clear(self, window_name: str) -> Nonevoid DockClear(const char* window_name, ...);(private API)
TestContext.dock_into¶
def dock_into(self, src_id: Union[TestRef, str], dst_id: Union[TestRef, str], split_dir: Optional[Dir] = None, is_outer_docking: bool = False, flags: TestOpFlags = 0) -> Nonevoid DockInto(ImGuiTestRef src_id, ImGuiTestRef dst_id, ImGuiDir split_dir = ImGuiDir_None, bool is_outer_docking = false, ImGuiTestOpFlags flags = 0);Python bindings defaults:
If split_dir is None, then its default value will be: Dir_None
(private API)
TestContext.undock_node¶
def undock_node(self, dock_id: ID) -> Nonevoid UndockNode(ImGuiID dock_id);(private API)
TestContext.undock_window¶
def undock_window(self, window_name: str) -> Nonevoid UndockWindow(const char* window_name);(private API)
TestContext.window_is_undocked_or_standalone¶
def window_is_undocked_or_standalone(self, window: Window) -> boolbool WindowIsUndockedOrStandalone(ImGuiWindow* window);(private API)
TestContext.dock_id_is_undocked_or_standalone¶
def dock_id_is_undocked_or_standalone(self, dock_id: ID) -> boolbool DockIdIsUndockedOrStandalone(ImGuiID dock_id);(private API)
TestContext.dock_node_hide_tab_bar¶
def dock_node_hide_tab_bar(self, node: DockNode, hidden: bool) -> Nonevoid DockNodeHideTabBar(ImGuiDockNode* node, bool hidden);(private API)
TestContext.perf_calc_ref¶
def perf_calc_ref(self) -> Nonevoid PerfCalcRef();(private API)
ImVec2 GetDockNodeTitlebarPos(ImGuiDockNode* node);
#endifPerformances Measurement (use along with Dear ImGui Perf Tool)
TestContext.perf_capture¶
def perf_capture(self, category: Optional[str] = None, test_name: Optional[str] = None, csv_file: Optional[str] = None) -> Nonevoid PerfCapture(const char* category = nullptr, const char* test_name = nullptr, const char* csv_file = nullptr);(private API)
TestContext.__init__¶
def __init__(self, generic_vars: Optional[TestGenericVars] = None, op_flags: TestOpFlags = TestOpFlags_None, perf_stress_amount: int = 0, frame_count: int = 0, first_test_frame_count: int = 0, first_gui_frame: bool = False, has_dock: bool = False, run_flags: TestRunFlags = TestRunFlags_None, active_func: TestActiveFunc = TestActiveFunc_None, running_time: float = 0.0, action_depth: int = 0, capture_counter: int = 0, error_counter: int = 0, abort: bool = False, perf_ref_dt: float = -1.0, perf_iterations: int = 400, ref_id: ID = 0, ref_window_id: ID = 0, input_mode: Optional[InputSource] = None, temp_string: Optional[ImVector_int] = None, clipboard: Optional[ImVector_int] = None, foreign_windows_to_hide: Optional[ImVector_Window] = None, dummy_item_info_null: Optional[TestItemInfo] = None, cached_lines_printed_to_tty: bool = False) -> NoneAuto-generated default constructor with named params
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* GenericVars: TestGenericVars()
* InputMode: InputSource_Mouse
* TempString: ImVector_char()
* Clipboard: ImVector_char()
* ForeignWindowsToHide: ImVector_Window_ptr()
* DummyItemInfoNull: TestItemInfo()
imgui_te_internal.h¶
FORWARD DECLARATIONS¶
DATA STRUCTURES¶
TestInfoTask (class)¶
Query item position/window/state given ID.
| Attribute | C++ | |
|---|---|---|
id_: ID | ImGuiID ID = 0; | |
frame_count: int | int FrameCount = -1; | Timestamp of request |
result: TestItemInfo | ImGuiTestItemInfo Result; |
TestInfoTask.__init__¶
def __init__(self, id_: ID = 0, frame_count: int = -1, result: Optional[TestItemInfo] = None) -> NoneAuto-generated default constructor with named params
Python bindings defaults:
If Result is None, then its default value will be: TestItemInfo()
TestGatherTask (class)¶
Gather item list in given parent ID.
| Attribute | C++ | |
|---|---|---|
in_parent_id: ID | ImGuiID InParentID = 0; | |
in_max_depth: int | int InMaxDepth = 0; | |
in_layer_mask: int | short InLayerMask = 0; | |
out_list: Optional[TestItemList] | ImGuiTestItemList* OutList = nullptr; | |
last_item_info: Optional[TestItemInfo] | ImGuiTestItemInfo* LastItemInfo = nullptr; |
TestGatherTask.clear¶
def clear(self) -> Nonevoid Clear();(private API)
TestGatherTask.__init__¶
def __init__(self, in_parent_id: ID = 0, in_max_depth: int = 0, in_layer_mask: int = 0) -> NoneAuto-generated default constructor with named params
TestFindByLabelTask (class)¶
Find item ID given a label and a parent id
Usually used by queries with wildcards such as ItemInfo(“hello/**/foo/bar”)
| Attribute | C++ | |
|---|---|---|
in_prefix_id: ID | ImGuiID InPrefixId = 0; | A known base ID which appears BEFORE the wildcard ID (for “hello/**/foo/bar” it would be hash of “hello”) |
in_suffix_depth: int | int InSuffixDepth = 0; | Number of labels in a path, after unknown base ID (for “hello/**/foo/bar” it would be 2) |
in_suffix: Optional[str] | const char* InSuffix = nullptr; | A label string which appears on ID stack after unknown base ID (for “hello/**/foo/bar” it would be “foo/bar”) # (const) |
in_suffix_last_item: Optional[str] | const char* InSuffixLastItem = nullptr; | A last label string (for “hello/**/foo/bar” it would be “bar”) # (const) |
in_suffix_last_item_hash: ID | ImGuiID InSuffixLastItemHash = 0; | |
in_filter_item_status_flags: ItemStatusFlags | ImGuiItemStatusFlags InFilterItemStatusFlags = 0; | Flags required for item to be returned |
out_item_id: ID | ImGuiID OutItemId = 0; | Result item ID |
TestFindByLabelTask.__init__¶
def __init__(self, in_prefix_id: ID = 0, in_suffix_depth: int = 0, in_suffix_last_item_hash: ID = 0, in_filter_item_status_flags: ItemStatusFlags = 0, out_item_id: ID = 0) -> NoneAuto-generated default constructor with named params
TestInputType (enum)¶
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImGuiTestInputType_None | |
key | 1 | ImGuiTestInputType_Key | |
char | 2 | ImGuiTestInputType_Char | |
viewport_focus | 3 | ImGuiTestInputType_ViewportFocus | |
viewport_set_pos | 4 | ImGuiTestInputType_ViewportSetPos | |
viewport_set_size | 5 | ImGuiTestInputType_ViewportSetSize | |
viewport_close | 6 | ImGuiTestInputType_ViewportClose |
TestInput (class)¶
FIXME: May want to strip further now that core imgui is using its own input queue
| Attribute | C++ | |
|---|---|---|
type: TestInputType | ImGuiTestInputType Type = ImGuiTestInputType_None; | |
key_chord: KeyChord | ImGuiKeyChord KeyChord = ImGuiKey_None; | |
char: ImWchar | ImWchar Char = 0; | |
down: bool | bool Down = false; | |
viewport_id: ID | ImGuiID ViewportId = 0; | |
viewport_pos_size: ImVec2 | ImVec2 ViewportPosSize; |
TestInput.for_key_chord¶
@staticmethod
def for_key_chord(key_chord: KeyChord, down: bool) -> TestInputstatic ImGuiTestInput ForKeyChord(ImGuiKeyChord key_chord, bool down);(private API)
TestInput.for_char¶
@staticmethod
def for_char(v: ImWchar) -> TestInputstatic ImGuiTestInput ForChar(ImWchar v);(private API)
TestInput.for_viewport_focus¶
@staticmethod
def for_viewport_focus(viewport_id: ID) -> TestInputstatic ImGuiTestInput ForViewportFocus(ImGuiID viewport_id);(private API)
TestInput.for_viewport_set_pos¶
@staticmethod
def for_viewport_set_pos(viewport_id: ID, pos: ImVec2Like) -> TestInputstatic ImGuiTestInput ForViewportSetPos(ImGuiID viewport_id, const ImVec2& pos);(private API)
TestInput.for_viewport_set_size¶
@staticmethod
def for_viewport_set_size(viewport_id: ID, size: ImVec2Like) -> TestInputstatic ImGuiTestInput ForViewportSetSize(ImGuiID viewport_id, const ImVec2& size);(private API)
TestInput.for_viewport_close¶
@staticmethod
def for_viewport_close(viewport_id: ID) -> TestInputstatic ImGuiTestInput ForViewportClose(ImGuiID viewport_id);(private API)
TestInput.__init__¶
def __init__(self, type: TestInputType = TestInputType_None, key_chord: Optional[KeyChord] = None, char: ImWchar = 0, down: bool = False, viewport_id: ID = 0, viewport_pos_size: Optional[ImVec2Like] = None) -> NoneAuto-generated default constructor with named params
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* KeyChord: Key_None
* ViewportPosSize: ImVec2()
TestInputs (class)¶
| Attribute | C++ | |
|---|---|---|
mouse_pos_value: ImVec2 | ImVec2 MousePosValue; | Own non-rounded copy of MousePos in order facilitate simulating mouse movement very slow speed and high-framerate |
mouse_wheel: ImVec2 | ImVec2 MouseWheel; | |
mouse_hovered_viewport: ID | ImGuiID MouseHoveredViewport = 0; | |
mouse_buttons_value: int | int MouseButtonsValue = 0x00; | FIXME-TESTS: Use simulated_io.MouseDown[] ? |
host_esc_down: bool | bool HostEscDown = false; | |
host_esc_down_duration: float | float HostEscDownDuration = -1.0f; | Maintain our own DownDuration for host/backend ESC key so we can abort. |
host_mouse_pos: ImVec2 | ImVec2 HostMousePos; |
TestInputs.__init__¶
def __init__(self, mouse_pos_value: Optional[ImVec2Like] = None, mouse_wheel: Optional[ImVec2Like] = None, mouse_hovered_viewport: ID = 0, mouse_buttons_value: int = 0, host_esc_down: bool = False, host_esc_down_duration: float = -1.0, host_mouse_pos: Optional[ImVec2Like] = None) -> NoneAuto-generated default constructor with named params
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* MousePosValue: ImVec2()
* MouseWheel: ImVec2()
* HostMousePos: ImVec2()
TestEnginePerfRecord (class)¶
| Attribute | C++ | |
|---|---|---|
raw_value_ms: float | double RawValueMs; | For current frame |
TestEnginePerfRecord.__init__¶
def __init__(self) -> NoneImGuiTestEnginePerfRecord();TestEnginePerfRecord.update_value_for_current_frame¶
def update_value_for_current_frame(self, v_ms: float) -> Nonevoid UpdateValueForCurrentFrame(double v_ms);(private API)
TestEngine (class)¶
[Internal] Test Engine Context
| Attribute | C++ | |
|---|---|---|
io: TestEngineIO | ImGuiTestEngineIO IO; | |
ui_context_target: Optional[Context] | ImGuiContext* UiContextTarget = nullptr; | imgui context for testing |
ui_context_active: Optional[Context] | ImGuiContext* UiContextActive = nullptr; | imgui context for testing == UiContextTarget or None |
started: bool | bool Started = false; | |
ui_context_has_hooks: bool | bool UiContextHasHooks = false; | |
batch_start_time: ImU64 | ImU64 BatchStartTime = 0; | |
batch_end_time: ImU64 | ImU64 BatchEndTime = 0; | |
frame_count: int | int FrameCount = 0; | |
override_delta_time: float | float OverrideDeltaTime = -1.0f; | Inject custom delta time into imgui context to simulate clock passing faster than wall clock time. |
test_context: Optional[TestContext] | ImGuiTestContext* TestContext = nullptr; | Running test context |
tests_source_lines_dirty: bool | bool TestsSourceLinesDirty = false; | |
gather_task: TestGatherTask | ImGuiTestGatherTask GatherTask; | |
find_by_label_task: TestFindByLabelTask | ImGuiTestFindByLabelTask FindByLabelTask; | |
string_builder_for_checks: TextBuffer | ImGuiTextBuffer StringBuilderForChecks; | |
inputs: TestInputs | ImGuiTestInputs Inputs; | |
abort: bool | bool Abort = false; | |
ui_select_and_scroll_to_test: Optional[Test] | ImGuiTest* UiSelectAndScrollToTest = nullptr; | |
ui_selected_test: Optional[Test] | ImGuiTest* UiSelectedTest = nullptr; | |
ui_metrics_open: bool | bool UiMetricsOpen = false; | |
ui_debug_log_open: bool | bool UiDebugLogOpen = false; | |
ui_capture_tool_open: bool | bool UiCaptureToolOpen = false; | |
ui_stack_tool_open: bool | bool UiStackToolOpen = false; | |
ui_perf_tool_open: bool | bool UiPerfToolOpen = false; | |
ui_log_height: float | float UiLogHeight = 150.0f; | |
perf_timestamp_pre_new_frame: ImU64 | ImU64 PerfTimestampPreNewFrame; | |
perf_timestamp_pre_render: ImU64 | ImU64 PerfTimestampPreRender; | |
perf_timestamp_pre_swap: ImU64 | ImU64 PerfTimestampPreSwap; | |
perf_timestamp_post_swap: ImU64 | ImU64 PerfTimestampPostSwap; | |
perf_dt_app: TestEnginePerfRecord | ImGuiTestEnginePerfRecord PerfDtApp; | |
perf_dt_pre_new_frame_to_pre_render: TestEnginePerfRecord | ImGuiTestEnginePerfRecord PerfDtPreNewFrameToPreRender; | |
perf_dt_pre_render_to_pre_swap: TestEnginePerfRecord | ImGuiTestEnginePerfRecord PerfDtPreRenderToPreSwap; | |
perf_dt_pre_new_frame_to_pre_swap: TestEnginePerfRecord | ImGuiTestEnginePerfRecord PerfDtPreNewFrameToPreSwap; | |
perf_dt_pre_swap_to_post_swap: TestEnginePerfRecord | ImGuiTestEnginePerfRecord PerfDtPreSwapToPostSwap; | |
pre_swap_called: bool | bool PreSwapCalled = false; | |
post_swap_called: bool | bool PostSwapCalled = false; | |
tool_debug_reboot_ui_context: bool | bool ToolDebugRebootUiContext = false; | Completely shutdown and recreate the dear imgui context in place |
tool_slow_down: bool | bool ToolSlowDown = false; | |
tool_slow_down_ms: int | int ToolSlowDownMs = 100; | |
backup_config_run_speed: TestRunSpeed | ImGuiTestRunSpeed BackupConfigRunSpeed = ImGuiTestRunSpeed_Fast; | |
backup_config_no_throttle: bool | bool BackupConfigNoThrottle = false; |
TestEngine.__init__¶
def __init__(self) -> NoneImGuiTestEngine();Functions
INTERNAL FUNCTIONS¶
find_item_info¶
def find_item_info(engine: TestEngine, id_: ID, debug_id: str) -> TestItemInfoImGuiTestItemInfo* ImGuiTestEngine_FindItemInfo(ImGuiTestEngine* engine, ImGuiID id, const char* debug_id);(private API)
yield_¶
def yield_(engine: TestEngine) -> Nonevoid ImGuiTestEngine_Yield(ImGuiTestEngine* engine);(private API)
set_delta_time¶
def set_delta_time(engine: TestEngine, delta_time: float) -> Nonevoid ImGuiTestEngine_SetDeltaTime(ImGuiTestEngine* engine, float delta_time);(private API)
get_frame_count¶
def get_frame_count(engine: TestEngine) -> intint ImGuiTestEngine_GetFrameCount(ImGuiTestEngine* engine);(private API)
pass_filter¶
def pass_filter(test: Test, filter: str) -> boolbool ImGuiTestEngine_PassFilter(ImGuiTest* test, const char* filter);(private API)
run_test¶
def run_test(engine: TestEngine, ctx: TestContext, test: Test, run_flags: TestRunFlags) -> Nonevoid ImGuiTestEngine_RunTest(ImGuiTestEngine* engine, ImGuiTestContext* ctx, ImGuiTest* test, ImGuiTestRunFlags run_flags);(private API)
bind_im_gui_context¶
def bind_im_gui_context(engine: TestEngine, ui_ctx: Context) -> Nonevoid ImGuiTestEngine_BindImGuiContext(ImGuiTestEngine* engine, ImGuiContext* ui_ctx);(private API)
unbind_im_gui_context¶
def unbind_im_gui_context(engine: TestEngine, ui_ctx: Context) -> Nonevoid ImGuiTestEngine_UnbindImGuiContext(ImGuiTestEngine* engine, ImGuiContext* ui_ctx);(private API)
reboot_ui_context¶
def reboot_ui_context(engine: TestEngine) -> Nonevoid ImGuiTestEngine_RebootUiContext(ImGuiTestEngine* engine);(private API)
update_tests_source_lines¶
def update_tests_source_lines(engine: TestEngine) -> Nonevoid ImGuiTestEngine_UpdateTestsSourceLines(ImGuiTestEngine* engine);(private API)
Helper functions¶
get_status_name¶
def get_status_name(v: TestStatus) -> strconst char* ImGuiTestEngine_GetStatusName(ImGuiTestStatus v);(private API)
get_run_speed_name¶
def get_run_speed_name(v: TestRunSpeed) -> strconst char* ImGuiTestEngine_GetRunSpeedName(ImGuiTestRunSpeed v);(private API)
get_verbose_level_name¶
def get_verbose_level_name(v: TestVerboseLevel) -> strconst char* ImGuiTestEngine_GetVerboseLevelName(ImGuiTestVerboseLevel v);(private API)
imgui_te_ui.h¶
Functions¶
show_test_engine_windows¶
def show_test_engine_windows(engine: TestEngine, p_open: bool) -> boolIMGUI_API void ImGuiTestEngine_ShowTestEngineWindows(ImGuiTestEngine* engine, bool* p_open);open_source_file¶
def open_source_file(engine: TestEngine, source_filename: str, source_line_no: int) -> NoneIMGUI_API void ImGuiTestEngine_OpenSourceFile(ImGuiTestEngine* engine, const char* source_filename, int source_line_no);imgui_capture_tool.h¶
Forward declarations¶
Our types¶
External types
CaptureFlags_ (enum)¶
| Member | Value | C++ | |
|---|---|---|---|
none | 0 | ImGuiCaptureFlags_None = 0 | |
stitch_all | 1 << 0 | ImGuiCaptureFlags_StitchAll = 1 << 0 | Capture entire window scroll area (by scrolling and taking multiple screenshot). Only works for a single window. |
include_other_windows | 1 << 1 | ImGuiCaptureFlags_IncludeOtherWindows = 1 << 1 | Disable hiding other windows (when CaptureAddWindow has been called by default other windows are hidden) |
include_popups | 1 << 2 | ImGuiCaptureFlags_IncludePopups = 1 << 2 | Expand capture area to automatically include visible popups (Unused if ImGuiCaptureFlags_IncludeOtherWindows is set) |
hide_mouse_cursor | 1 << 3 | ImGuiCaptureFlags_HideMouseCursor = 1 << 3 | Hide render software mouse cursor during capture. |
instant | 1 << 4 | ImGuiCaptureFlags_Instant = 1 << 4 | Perform capture on very same frame. Only works when capturing a rectangular region. Unsupported features: content stitching, window hiding, window relocation. |
no_save | 1 << 5 | ImGuiCaptureFlags_NoSave = 1 << 5 | Do not save output image. |
CaptureArgs (class)¶
Defines input and output arguments for capture process.
When capturing from tests you can usually use the ImGuiTestContext::CaptureXXX() helpers functions.
| Attribute | C++ | |
|---|---|---|
in_flags: CaptureFlags | ImGuiCaptureFlags InFlags = 0; | Flags for customizing behavior of screenshot tool. |
in_capture_windows: ImVector_Window_ptr | ImVector<ImGuiWindow*> InCaptureWindows; | Windows to capture. All other windows will be hidden. May be used with InCaptureRect to capture only some windows in specified rect. |
in_capture_rect: ImRect | ImRect InCaptureRect; | Screen rect to capture. Does not include padding. |
in_padding: float | float InPadding = 16.0f; | Extra padding at the edges of the screenshot. Ensure that there is available space around capture rect horizontally, also vertically if ImGuiCaptureFlags_StitchAll is not used. |
in_record_fps_target: int | int InRecordFPSTarget = 30; | FPS target for recording videos. |
in_size_align: int | int InSizeAlign = 0; | Resolution alignment (0 = auto, 1 = no alignment, >= 2 = align width/height to be multiple of given value) |
out_image_size: ImVec2 | ImVec2 OutImageSize; | Produced image size. |
CaptureArgs.__init__¶
def __init__(self, in_flags: CaptureFlags = 0, in_capture_windows: Optional[ImVector_Window] = None, in_capture_rect: Optional[ImRect] = None, in_padding: float = 16.0, in_record_fps_target: int = 30, in_size_align: int = 0, out_image_size: Optional[ImVec2Like] = None) -> NoneAuto-generated default constructor with named params
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* InCaptureWindows: ImVector_Window_ptr()
* InCaptureRect: ImRect()
* OutImageSize: ImVec2()
CaptureStatus (enum)¶
| Member | Value | C++ | |
|---|---|---|---|
in_progress | 0 | ImGuiCaptureStatus_InProgress | |
done | 1 | ImGuiCaptureStatus_Done | |
error | 2 | ImGuiCaptureStatus_Error |
CaptureWindowData (class)¶
| Attribute | C++ | |
|---|---|---|
window: Window | ImGuiWindow* Window; | |
backup_rect: ImRect | ImRect BackupRect; | |
pos_during_capture: ImVec2 | ImVec2 PosDuringCapture; |
CaptureWindowData.__init__¶
def __init__(self, backup_rect: Optional[ImRect] = None, pos_during_capture: Optional[ImVec2Like] = None) -> NoneAuto-generated default constructor with named params
Python bindings defaults:
If any of the params below is None, then its default value below will be used:
* BackupRect: ImRect()
* PosDuringCapture: ImVec2()