Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

imgui.test_engine

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_test_engine/imgui_te_python_gil.jpg).

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

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

Python: Code
C++: ▶︎ Run · Code

Drive an app, capture screenshots

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

Python: Code
C++: Code

imgui_te_exporters.h

Forward Declarations

Types

TestEngineExportFormat (enum)

MemberValueC++
none0ImGuiTestEngineExportFormat_None = 0
j_unit_xml1ImGuiTestEngineExportFormat_JUnitXml, }

Functions

print_result_summary

def print_result_summary(engine: TestEngine) -> None
void ImGuiTestEngine_PrintResultSummary(ImGuiTestEngine* engine);

(private API)

export

def export(engine: TestEngine) -> None
void ImGuiTestEngine_Export(ImGuiTestEngine* engine);

(private API)

export_ex

def export_ex(engine: TestEngine, format: TestEngineExportFormat, filename: str) -> None
void 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

MemberValueC++
none0ImGuiTestActiveFunc_None
gui_func1ImGuiTestActiveFunc_GuiFunc== GuiFunc() handler
test_func2ImGuiTestActiveFunc_TestFunc== TestFunc() handler
teardown_func3ImGuiTestActiveFunc_TeardownFunc== TeardownFunc() handler

TestRunSpeed (enum)

MemberValueC++
fast0ImGuiTestRunSpeed_Fast = 0Run tests as fast as possible (teleport mouse, skip delays, etc.)
normal1ImGuiTestRunSpeed_Normal = 1Run tests at human watchable speed (for debugging)
cinematic2ImGuiTestRunSpeed_Cinematic = 2Run tests with pauses between actions (for e.g. tutorials)
count3ImGuiTestRunSpeed_COUNT

TestVerboseLevel (enum)

MemberValueC++
silent0ImGuiTestVerboseLevel_Silent = 0-v0
error1ImGuiTestVerboseLevel_Error = 1-v1
warning2ImGuiTestVerboseLevel_Warning = 2-v2
info3ImGuiTestVerboseLevel_Info = 3-v3
debug4ImGuiTestVerboseLevel_Debug = 4-v4
trace5ImGuiTestVerboseLevel_Trace = 5
count6ImGuiTestVerboseLevel_COUNT

TestStatus (enum)

Test status (stored in ImGuiTest)

MemberValueC++
unknown0ImGuiTestStatus_Unknown = 0
success1ImGuiTestStatus_Success = 1
queued2ImGuiTestStatus_Queued = 2
running3ImGuiTestStatus_Running = 3
error4ImGuiTestStatus_Error = 4
suspended5ImGuiTestStatus_Suspended = 5
count6ImGuiTestStatus_COUNT

TestGroup (enum)

Test group: this is mostly used to categorize tests in our testing UI. (Stored in ImGuiTest)

MemberValueC++
unknown-1ImGuiTestGroup_Unknown = -1
tests0ImGuiTestGroup_Tests = 0
perfs1ImGuiTestGroup_Perfs = 1
count2ImGuiTestGroup_COUNT

TestFlags_ (enum)

Flags (stored in ImGuiTest)

MemberValueC++
none0ImGuiTestFlags_None = 0
no_gui_warm_up1 << 0ImGuiTestFlags_NoGuiWarmUp = 1 << 0Disable running the GUI func for 2 frames before starting test code. For tests which absolutely need to start before GuiFunc.
no_auto_finish1 << 1ImGuiTestFlags_NoAutoFinish = 1 << 1By default, tests with no TestFunc (only a GuiFunc) will end after warmup. Setting this require test to call ctx->Finish().
no_recovery_warnings1 << 2ImGuiTestFlags_NoRecoveryWarnings = 1 << 2Error/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.

MemberValueC++
none0ImGuiTestCheckFlags_None = 0
silent_success1 << 0ImGuiTestCheckFlags_SilentSuccess = 1 << 0

TestLogFlags_ (enum)

Flags for ImGuiTestContext::Log* functions.

MemberValueC++
none0ImGuiTestLogFlags_None = 0
no_header1 << 0ImGuiTestLogFlags_NoHeader = 1 << 0Do not display frame count and depth padding

TestRunFlags_ (enum)

MemberValueC++
none0ImGuiTestRunFlags_None = 0
gui_func_disable1 << 0ImGuiTestRunFlags_GuiFuncDisable = 1 << 0Used internally to temporarily disable the GUI func (at the end of a test, etc)
gui_func_only1 << 1ImGuiTestRunFlags_GuiFuncOnly = 1 << 1Set when user selects “Run GUI func”
no_success_msg1 << 2ImGuiTestRunFlags_NoSuccessMsg = 1 << 2
enable_raw_inputs1 << 3ImGuiTestRunFlags_EnableRawInputs = 1 << 3Disable input submission to let test submission raw input event (in order to test e.g. IO queue)
run_from_gui1 << 4ImGuiTestRunFlags_RunFromGui = 1 << 4Test ran manually from GUI, will disable watchdog.
run_from_command_line1 << 5ImGuiTestRunFlags_RunFromCommandLine= 1 << 5Test queued from command-line.
no_error1 << 10ImGuiTestRunFlags_NoError = 1 << 10
share_vars1 << 11ImGuiTestRunFlags_ShareVars = 1 << 11Share generic vars and custom vars between child and parent tests (custom vars need to be same type)
share_test_context1 << 12ImGuiTestRunFlags_ShareTestContext = 1 << 12Share ImGuiTestContext instead of creating a new one (unsure what purpose this may be useful for yet)

TODO: Add GuiFunc options

TestEngineResultSummary (class)

AttributeC++
count_tested: intint CountTested = 0;Number of tests executed
count_success: intint CountSuccess = 0;Number of tests succeeded
count_in_queue: intint 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) -> None

Auto-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) -> None
extern 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) -> None
extern 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) -> str
extern 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) -> bool
IMGUI_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) -> bool
IMGUI_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) -> None
IMGUI_API void ImGuiTestEngine_AssertLog(const char* expr, const char* file, const char* function, int line);

get_temp_string_builder

def get_temp_string_builder() -> TextBuffer
IMGUI_API ImGuiTextBuffer* ImGuiTestEngine_GetTempStringBuilder();

ImGuiTestEngine API

Functions: Initialization

create_context

def create_context() -> TestEngine
IMGUI_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_test_engine/imgui_te_python_gil.jpg

destroy_context

def destroy_context(engine: TestEngine) -> None
IMGUI_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) -> None
IMGUI_API void ImGuiTestEngine_Start(ImGuiTestEngine* engine, ImGuiContext* ui_ctx);

Bind to a dear imgui context. Start coroutine.

stop

def stop(engine: TestEngine) -> None
IMGUI_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) -> None
IMGUI_API void ImGuiTestEngine_PreSwap(ImGuiTestEngine* engine);

Call every frame before framebuffer present/swap (used for time measurement)

post_swap

def post_swap(engine: TestEngine) -> None
IMGUI_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) -> TestEngineIO
IMGUI_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) -> Test
IMGUI_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) -> None
IMGUI_API void ImGuiTestEngine_UnregisterTest(ImGuiTestEngine* engine, ImGuiTest* test);

unregister_all_tests

def unregister_all_tests(engine: TestEngine) -> None
IMGUI_API void ImGuiTestEngine_UnregisterAllTests(ImGuiTestEngine* engine);

Functions: Main

queue_test

def queue_test(engine: TestEngine, test: Test, run_flags: TestRunFlags = 0) -> None
IMGUI_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) -> None
IMGUI_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) -> bool
IMGUI_API bool ImGuiTestEngine_TryAbortEngine(ImGuiTestEngine* engine);

abort_current_test

def abort_current_test(engine: TestEngine) -> None
IMGUI_API void ImGuiTestEngine_AbortCurrentTest(ImGuiTestEngine* engine);

find_test_by_name

def find_test_by_name(engine: TestEngine, category: str, name: str) -> Test
IMGUI_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) -> bool
IMGUI_API bool ImGuiTestEngine_IsTestQueueEmpty(ImGuiTestEngine* engine);

is_using_simulated_inputs

def is_using_simulated_inputs(engine: TestEngine) -> bool
IMGUI_API bool ImGuiTestEngine_IsUsingSimulatedInputs(ImGuiTestEngine* engine);

get_result_summary

def get_result_summary(engine: TestEngine, out_results: TestEngineResultSummary) -> None
IMGUI_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() -> None
IMGUI_API void ImGuiTestEngine_InstallDefaultCrashHandler();

Install default crash handler (if you don’t have one)

crash_handler

def crash_handler() -> None
IMGUI_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)

AttributeC++
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: boolbool ConfigSavedSettings = true;Load/Save settings in main context .ini file.
config_run_speed: TestRunSpeedImGuiTestRunSpeed ConfigRunSpeed = ImGuiTestRunSpeed_Fast;Run tests in fast/normal/cinematic mode
config_stop_on_error: boolbool ConfigStopOnError = false;Stop queued tests on test error
config_break_on_error: boolbool ConfigBreakOnError = false;Break debugger on test error by calling IM_DEBUG_BREAK()
config_keep_gui_func: boolbool ConfigKeepGuiFunc = false;Keep test GUI running at the end of the test
config_restore_focus_after_tests: boolbool ConfigRestoreFocusAfterTests = true;Restore focus back after running tests
config_capture_enabled: boolbool 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: boolbool ConfigCaptureOnError = false;
config_no_throttle: boolbool ConfigNoThrottle = false;Disable vsync for performance measurement or fast test running
config_mouse_draw_cursor: boolbool ConfigMouseDrawCursor = true;Enable drawing of Dear ImGui software mouse cursor when running tests
config_fixed_delta_time: floatfloat ConfigFixedDeltaTime = 0.0f;Use fixed delta time instead of calculating it from wall clock
perf_stress_amount: intint PerfStressAmount = 1;Integer to scale the amount of items submitted in test
config_verbose_level: TestVerboseLevelImGuiTestVerboseLevel ConfigVerboseLevel = ImGuiTestVerboseLevel_Warning;
config_verbose_level_on_error: TestVerboseLevelImGuiTestVerboseLevel ConfigVerboseLevelOnError = ImGuiTestVerboseLevel_Info;
config_log_to_tty: boolbool ConfigLogToTTY = false;Output log entries to TTY (in addition to Test Engine UI)
config_log_to_debugger: boolbool 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: floatfloat MouseSpeed = 600.0f;Mouse speed (pixel/second) when not running in fast mode
mouse_wobble: floatfloat 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: floatfloat ScrollSpeed = 1400.0f;Scroll speed (pixel/second) when not running in fast mode
typing_speed: floatfloat TypingSpeed = 20.0f;Char input speed (characters/second) when not running in fast mode
action_delay_short: floatfloat ActionDelayShort = 0.15f;Time between short actions
action_delay_standard: floatfloat ActionDelayStandard = 0.40f;Time between most actions
config_watchdog_warning: floatfloat ConfigWatchdogWarning = 30.0f;Warn when a test exceed this time (in second)
config_watchdog_kill_test: floatfloat ConfigWatchdogKillTest = 60.0f;Attempt to stop running a test when exceeding this time (in second)
config_watchdog_kill_app: floatfloat ConfigWatchdogKillApp = FLT_MAX;Stop application when exceeding this time (in second)
export_results_format: TestEngineExportFormatImGuiTestEngineExportFormat ExportResultsFormat = (ImGuiTestEngineExportFormat)0;
check_draw_data_integrity: boolbool CheckDrawDataIntegrity = false;Check ImDrawData integrity (buffer count, etc.). Currently cheap but may become a slow operation.
is_running_tests: boolbool IsRunningTests = false;
is_requesting_max_app_speed: boolbool IsRequestingMaxAppSpeed = false;When running in fast mode: request app to skip vsync or even skip rendering if it wants
is_capturing: boolbool IsCapturing = false;Capture is in progress
TestEngineIO.export_results_filename_set
def export_results_filename_set(self, filename: str) -> None
void 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) -> None

Auto-generated default constructor with named params

ImGuiTestItemInfo

TestItemInfo (class)

Information about a given item or window, result of an ItemInfo() or WindowInfo() query

AttributeC++
id_: IDImGuiID ID = 0;Item ID
window: Optional[Window]ImGuiWindow* Window = nullptr;Item Window
timestamp_main: intint TimestampMain;Timestamp of main result (all fields)
timestamp_status: intint TimestampStatus;Timestamp of StatusFlags
parent_id: IDImGuiID ParentID = 0;Item Parent ID (value at top of the ID stack)
rect_full: ImRectImRect RectFull = ImRect();Item Rectangle
rect_clipped: ImRectImRect RectClipped = ImRect();Item Rectangle (clipped with window->ClipRect at time of item submission)
item_flags: ItemFlagsImGuiItemFlags ItemFlags = 0;Item flags
status_flags: ItemStatusFlagsImGuiItemStatusFlags StatusFlags = 0;Item Status flags (fully updated for some items only, compare TimestampStatus to FrameCount)
TestItemInfo.__init__
def __init__(self) -> None
ImGuiTestItemInfo();

TestItemList (class)

Result of an GatherItems() query

TestItemList.clear
def clear(self) -> None
void Clear();

(private API)

TestItemList.reserve
def reserve(self, capacity: int) -> None
void Reserve(int capacity);

(private API)

TestItemList.get_size
def get_size(self) -> int
int GetSize() const;

(private API)

TestItemList.get_by_index
def get_by_index(self, n: int) -> TestItemInfo
const ImGuiTestItemInfo* GetByIndex(int n);

(private API)

TestItemList.get_by_id
def get_by_id(self, id_: ID) -> TestItemInfo
const ImGuiTestItemInfo* GetByID(ImGuiID id);

(private API)

TestItemList.size
def size(self) -> int
size_t size() const;

(private API)

TestItemList.begin
def begin(self) -> TestItemInfo
const ImGuiTestItemInfo* begin() const;

(private API)

TestItemList.end
def end(self) -> TestItemInfo
const ImGuiTestItemInfo* end() const;

(private API)

TestItemList.__init__
def __init__(self) -> None

Auto-generated default constructor

TestLogLineInfo (class)

AttributeC++
level: TestVerboseLevelImGuiTestVerboseLevel Level;
line_offset: intint LineOffset;
TestLogLineInfo.__init__
def __init__(self, level: TestVerboseLevel = TestVerboseLevel.warning, line_offset: int = int()) -> None

Auto-generated default constructor with named params

TestLog (class)

AttributeC++
buffer: TextBufferImGuiTextBuffer Buffer;
TestLog.__init__
def __init__(self) -> None
ImGuiTestLog();

Functions

TestLog.is_empty
def is_empty(self) -> bool
bool IsEmpty() const;

(private API)

TestLog.get_text
def get_text(self) -> str
const char* GetText();

(private API)

TestLog.get_text_len
def get_text_len(self) -> int
int GetTextLen();

(private API)

TestLog.clear
def clear(self) -> None
void 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) -> int
int 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 ONLY Error:                     Use level_min == ImGuiTestVerboseLevel_Error, level_max = ImGuiTestVerboseLevel_Error
         - To get ONLY Error and Warnings:        Use level_min == ImGuiTestVerboseLevel_Error, level_max = ImGuiTestVerboseLevel_Warning
     - 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) -> None
void UpdateLineOffsets(ImGuiTestEngineIO* engine_io, ImGuiTestVerboseLevel level, const char* start);

[Internal] (private API)

ImGuiTest

TestOutput (class)

Storage for the output of a test run

AttributeC++
status: TestStatusImGuiTestStatus Status = ImGuiTestStatus_Unknown;
log: TestLogImGuiTestLog Log;
start_time: ImU64ImU64 StartTime = 0;
end_time: ImU64ImU64 EndTime = 0;
TestOutput.__init__
def __init__(self, status: TestStatus = TestStatus_Unknown, log: Optional[TestLog] = None, start_time: ImU64 = 0, end_time: ImU64 = 0) -> None

Auto-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

AttributeC++
category: Str30Str30 Category;Stored on the stack if len<30
name: Str30Str30 Name;Stored on the stack if len<30
group: TestGroupImGuiTestGroup Group = ImGuiTestGroup_Unknown;Coarse groups: ‘Tests’ or ‘Perf’
arg_variant: intint ArgVariant = 0;User parameter. Generally we use it to run variations of a same test by sharing GuiFunc/TestFunc
flags: TestFlagsImGuiTestFlags Flags = ImGuiTestFlags_None;See ImGuiTestFlags_
gui_func: Function_TestGuiFunction_TestGui GuiFunc = nullptr;GUI function (optional if your test are running over an existing GUI application)
test_func: Function_TestRunnerFunction_TestRunner TestFunc = nullptr;Test driving function
teardown_func: Function_TestRunnerFunction_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: Str256Str256 SourceFile;FILE
source_line: intint SourceLine = 0;LINE
source_line_end: intint SourceLineEnd = 0;end of line (when calculated by ImGuiTestEngine_StartCalcSourceLineEnds())
output: TestOutputImGuiTestOutput Output;
vars_size: intsize_t VarsSize = 0;
vars_post_constructor_user_fn: Optional[Any]void* VarsPostConstructorUserFn = nullptr;
Test.__init__
def __init__(self) -> None
ImGuiTest();

Functions

Test.set_owned_name
def set_owned_name(self, name: str) -> None
void 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

AttributeC++
test: Optional[Test]ImGuiTest* Test = nullptr;
run_flags: TestRunFlagsImGuiTestRunFlags RunFlags = ImGuiTestRunFlags_None;
TestRunTask.__init__
def __init__(self, run_flags: TestRunFlags = TestRunFlags_None) -> None

Auto-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://github.com/ocornut/imgui_test_engine/wiki/Named-References (SUGGESTION: add those constructors to “VA Step Filter” (Visual Assist) or a .natstepfilter file (Visual Studio) so they are skipped by F11 (StepInto)

AttributeC++
id_: IDImGuiID ID;Pre-hashed ID
TestRef.__init__
@overload
def __init__(self) -> None

@overload
def __init__(self, id_: ID) -> None

@overload
def __init__(self, path: str) -> None
ImGuiTestRef();
ImGuiTestRef(ImGuiID id);
ImGuiTestRef(const char* path);
TestRef.is_empty
def is_empty(self) -> bool
bool 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) -> str
const 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) -> None
ImGuiTestRefDesc(const ImGuiTestRef& ref);
ImGuiTestRefDesc(const ImGuiTestRef& ref, const ImGuiTestItemInfo& item);

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().

MemberValueC++
unknown0ImGuiTestAction_Unknown = 0
hover1ImGuiTestAction_HoverMove mouse
click2ImGuiTestAction_ClickMove mouse and click
double_click3ImGuiTestAction_DoubleClickMove mouse and double-click
check4ImGuiTestAction_CheckCheck item if unchecked (Checkbox, MenuItem or any widget reporting ImGuiItemStatusFlags_Checkable)
uncheck5ImGuiTestAction_UncheckUncheck item if checked
open6ImGuiTestAction_OpenOpen item if closed (TreeNode, BeginMenu or any widget reporting ImGuiItemStatusFlags_Openable)
close7ImGuiTestAction_CloseClose item if opened
input8ImGuiTestAction_InputStart text inputing into a field (e.g. CTRL+Click on Drags/Slider, click on InputText etc.)
nav_activate9ImGuiTestAction_NavActivateActivate item with navigation
count10ImGuiTestAction_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.

MemberValueC++
none0ImGuiTestOpFlags_None = 0
no_check_hovered_id1 << 1ImGuiTestOpFlags_NoCheckHoveredId = 1 << 1Don’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_error1 << 2ImGuiTestOpFlags_NoError = 1 << 2Don’t abort/error e.g. if the item cannot be found or the operation doesn’t succeed.
no_focus_window1 << 3ImGuiTestOpFlags_NoFocusWindow = 1 << 3Don’t focus window when aiming at an item
no_auto_uncollapse1 << 4ImGuiTestOpFlags_NoAutoUncollapse = 1 << 4Disable automatically uncollapsing windows (useful when specifically testing Collapsing behaviors)
no_auto_open_full_path1 << 5ImGuiTestOpFlags_NoAutoOpenFullPath = 1 << 5Disable 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_yield1 << 6ImGuiTestOpFlags_NoYield = 1 << 6Don’t yield (only supported by a few functions), in case you need to manage rigorous per-frame timing.
is_second_attempt1 << 7ImGuiTestOpFlags_IsSecondAttempt = 1 << 7Used by recursing functions to indicate a second attempt
move_to_edge_l1 << 8ImGuiTestOpFlags_MoveToEdgeL = 1 << 8Simple Dumb aiming helpers to test widget that care about clicking position. May need to replace will better functionalities.
move_to_edge_r1 << 9ImGuiTestOpFlags_MoveToEdgeR = 1 << 9
move_to_edge_u1 << 10ImGuiTestOpFlags_MoveToEdgeU = 1 << 10
move_to_edge_d1 << 11ImGuiTestOpFlags_MoveToEdgeD = 1 << 11
no_scroll1 << 12ImGuiTestOpFlags_NoScroll = 1 << 12Disable automatically scrolling to reach an item.
no_wait_when_moving1 << 13ImGuiTestOpFlags_NoWaitWhenMoving = 1 << 13Avoid waiting for item to be stable, lock current position and aim.

TestActionFilter (class)

Advanced filtering for ItemActionAll()

AttributeC++
max_depth: intint MaxDepth;
max_passes: intint MaxPasses;
max_item_count_per_depth: intconst int* MaxItemCountPerDepth;(const)
require_all_status_flags: ItemStatusFlagsImGuiItemStatusFlags RequireAllStatusFlags;
require_any_status_flags: ItemStatusFlagsImGuiItemStatusFlags RequireAnyStatusFlags;
TestActionFilter.__init__
def __init__(self) -> None
ImGuiTestActionFilter();

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.

AttributeC++
ret_value: intint RetValue;return value
hovered: intint Hovered;result of IsItemHovered()
hovered_allow_disabled: intint HoveredAllowDisabled;result of IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)
active: intint Active;result of IsItemActive()
focused: intint Focused;result of IsItemFocused()
clicked: intint Clicked;result of IsItemClicked()
visible: intint Visible;result of IsItemVisible()
edited: intint Edited;result of IsItemEdited()
activated: intint Activated;result of IsItemActivated()
deactivated: intint Deactivated;result of IsItemDeactivated()
deactivated_after_edit: intint DeactivatedAfterEdit;result of IsItemDeactivatedAfterEdit()
TestGenericItemStatus.__init__
def __init__(self) -> None
ImGuiTestGenericItemStatus();
TestGenericItemStatus.clear
def clear(self) -> None
void Clear();

(private API)

TestGenericItemStatus.query_set
def query_set(self, ret_val: bool = False) -> None
void QuerySet(bool ret_val = false);

(private API)

TestGenericItemStatus.query_inc
def query_inc(self, ret_val: bool = False) -> None
void QueryInc(bool ret_val = false);

(private API)

TestGenericItemStatus.draw
def draw(self) -> None
void 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.

AttributeC++
step: intint Step;
count: intint Count;
dock_id: IDImGuiID DockId;
owner_id: IDImGuiID OwnerId;
window_size: ImVec2ImVec2 WindowSize;
window_flags: WindowFlagsImGuiWindowFlags WindowFlags;
table_flags: TableFlagsImGuiTableFlags TableFlags;
popup_flags: PopupFlagsImGuiPopupFlags PopupFlags;
input_text_flags: InputTextFlagsImGuiInputTextFlags InputTextFlags;
status: TestGenericItemStatusImGuiTestGenericItemStatus Status;
show_window1: boolbool ShowWindow1,
show_window2: boolShowWindow2;
use_clipper: boolbool UseClipper;
use_viewports: boolbool UseViewports;
use_mixed_value: boolbool UseMixedValue;
width: floatfloat Width;
pos: ImVec2ImVec2 Pos;
pivot: ImVec2ImVec2 Pivot;
item_size: ImVec2ImVec2 ItemSize;
color1: ImVec4ImVec4 Color1,
color2: ImVec4Color2;
int1: intint Int1,
int2: intInt2,
int_array: np.ndarrayIntArray[10];ndarray[type=int, size=10]
float1: floatfloat Float1,
float2: floatFloat2,
float_array: np.ndarrayFloatArray[10];ndarray[type=float, size=10]
bool1: boolbool Bool1,
bool2: boolBool2,
bool_array: np.ndarrayBoolArray[10];ndarray[type=bool, size=10]
id_: IDImGuiID Id,
id_array: np.ndarrayIdArray[10];ndarray[type=ImGuiID, size=10]
TestGenericVars.__init__
def __init__(self) -> None
ImGuiTestGenericVars();
TestGenericVars.clear
def clear(self) -> None
void Clear();

(private API)

ImGuiTestContext

Context for a running ImGuiTest

This is the interface that most tests will interact with.

TestContext (class)

AttributeC++
generic_vars: TestGenericVarsImGuiTestGenericVars 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: TestOpFlagsImGuiTestOpFlags OpFlags = ImGuiTestOpFlags_None;Flags affecting all operation (supported: ImGuiTestOpFlags_NoAutoUncollapse)
perf_stress_amount: intint PerfStressAmount = 0;Convenience copy of engine->IO.PerfStressAmount
frame_count: intint FrameCount = 0;Test frame count (restarts from zero every time)
first_test_frame_count: intint 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: boolbool FirstGuiFrame = false;
has_dock: boolbool 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: TestRunFlagsImGuiTestRunFlags RunFlags = ImGuiTestRunFlags_None;
active_func: TestActiveFuncImGuiTestActiveFunc ActiveFunc = ImGuiTestActiveFunc_None;None/GuiFunc/TestFunc
running_time: floatdouble RunningTime = 0.0;Amount of wall clock time the Test has been running. Used by safety watchdog.
action_depth: intint ActionDepth = 0;Nested depth of ctx-> function calls (used to decorate log)
capture_counter: intint CaptureCounter = 0;Number of captures
error_counter: intint ErrorCounter = 0;Number of errors (generally this maxxes at 1 as most functions will early out)
abort: boolbool Abort = false;
perf_ref_dt: floatdouble PerfRefDt = -1.0;
perf_iterations: intint PerfIterations = 400;Number of frames for PerfCapture() measurements
ref_id: IDImGuiID RefID = 0;Reference ID over which all named references are based
ref_window_id: IDImGuiID RefWindowID = 0;ID of a window that contains RefID item
input_mode: InputSourceImGuiInputSource InputMode = ImGuiInputSource_Mouse;Prefer interacting with mouse/keyboard/gamepad
temp_string: ImVector_charImVector<char> TempString;
clipboard: ImVector_charImVector<char> Clipboard;Private clipboard for the test instance
foreign_windows_to_hide: ImVector_Window_ptrImVector<ImGuiWindow*> ForeignWindowsToHide;
dummy_item_info_null: TestItemInfoImGuiTestItemInfo DummyItemInfoNull;Storage for ItemInfoNull()
cached_lines_printed_to_tty: boolbool CachedLinesPrintedToTTY = false;
TestContext.finish
def finish(self, status: TestStatus = TestStatus_Success) -> None
void 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) -> TestStatus
ImGuiTestStatus 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) -> bool
bool IsError() const;

(private API)

TestContext.is_warm_up_gui_frame
def is_warm_up_gui_frame(self) -> bool
bool 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) -> bool
bool IsFirstGuiFrame() const;

(private API)

TestContext.is_first_test_frame
def is_first_test_frame(self) -> bool
bool 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) -> bool
bool IsGuiFuncOnly() const;

(private API)

TestContext.suspend_test_func
def suspend_test_func(self, file: Optional[str] = None, line: int = 0) -> bool
bool 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) -> None
void 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) -> None
void 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) -> None
void LogToDebugger(ImGuiTestVerboseLevel level, const char* message);

(private API)

TestContext.log_debug
def log_debug(self, fmt: str) -> None
void LogDebug(const char* fmt, ...) ;

(private API)

ImGuiTestVerboseLevel_Debug or ImGuiTestVerboseLevel_Trace depending on context depth

TestContext.log_info
def log_info(self, fmt: str) -> None
void LogInfo(const char* fmt, ...) ;

(private API)

ImGuiTestVerboseLevel_Info

TestContext.log_warning
def log_warning(self, fmt: str) -> None
void LogWarning(const char* fmt, ...) ;

(private API)

ImGuiTestVerboseLevel_Warning

TestContext.log_error
def log_error(self, fmt: str) -> None
void LogError(const char* fmt, ...) ;

(private API)

ImGuiTestVerboseLevel_Error

TestContext.log_basic_ui_state
def log_basic_ui_state(self) -> None
void LogBasicUiState();

(private API)

TestContext.log_item_list
def log_item_list(self, list: TestItemList) -> None
void LogItemList(ImGuiTestItemList* list);

(private API)

TestContext.yield_
def yield_(self, count: int = 1) -> None
void Yield(int count = 1);

(private API)

TestContext.sleep
def sleep(self, time_in_second: float) -> None
void Sleep(float time_in_second);

(private API)

Sleep for a given simulation time, unless in Fast mode

TestContext.sleep_short
def sleep_short(self) -> None
void SleepShort();

(private API)

Standard short delay of io.ActionDelayShort (~0.15), unless in Fast mode.

TestContext.sleep_standard
def sleep_standard(self) -> None
void 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) -> None
void 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) -> None
void SetRef(ImGuiTestRef ref);
void SetRef(ImGuiWindow* window);

(private API)

TestContext.get_ref
def get_ref(self) -> TestRef
ImGuiTestRef GetRef();

(private API)

TestContext.window_info
def window_info(self, window_ref: Union[TestRef, str], flags: TestOpFlags = TestOpFlags_None) -> TestItemInfo
ImGuiTestItemInfo WindowInfo(ImGuiTestRef window_ref, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);

(private API)

TestContext.window_close
def window_close(self, window_ref: Union[TestRef, str]) -> None
void WindowClose(ImGuiTestRef window_ref);

(private API)

TestContext.window_collapse
def window_collapse(self, window_ref: Union[TestRef, str], collapsed: bool) -> None
void WindowCollapse(ImGuiTestRef window_ref, bool collapsed);

(private API)

TestContext.window_focus
def window_focus(self, window_ref: Union[TestRef, str], flags: TestOpFlags = TestOpFlags_None) -> None
void 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) -> None
void 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) -> None
void 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) -> None
void 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) -> bool
bool 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]) -> Window
ImGuiWindow*GetWindowByRef(ImGuiTestRef window_ref);

(private API)

TestContext.popup_close_one
def popup_close_one(self) -> None
void PopupCloseOne();

(private API)

TestContext.popup_close_all
def popup_close_all(self) -> None
void PopupCloseAll();

(private API)

TestContext.popup_get_window_id
def popup_get_window_id(self, ref: Union[TestRef, str]) -> ID
ImGuiID 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]) -> ID
ImGuiID 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) -> ImVec2
ImVec2 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]) -> ImVec2
ImVec2 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) -> ImVec2
ImVec2 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) -> ImVec2
ImVec2 GetMainMonitorWorkSize();

(private API)

TestContext.capture_reset
def capture_reset(self) -> None
void CaptureReset();

(private API)

Reset state (use when doing multiple captures)

TestContext.capture_set_extension
def capture_set_extension(self, ext: str) -> None
void 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) -> None
void 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]) -> bool
bool 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) -> None
void 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) -> bool
bool CaptureScreenshot(int capture_flags = 0);

(private API)

Trigger a screen capture

TestContext.capture_begin_video
def capture_begin_video(self) -> bool
bool CaptureBeginVideo();

(private API)

Start a video capture

TestContext.capture_end_video
def capture_end_video(self) -> bool
bool CaptureEndVideo();

(private API)

TestContext.mouse_move
def mouse_move(self, ref: Union[TestRef, str], flags: TestOpFlags = TestOpFlags_None) -> None
void MouseMove(ImGuiTestRef ref, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);

(private API)

TestContext.mouse_move_to_pos
def mouse_move_to_pos(self, pos: ImVec2Like) -> None
void MouseMoveToPos(ImVec2 pos);

(private API)

TestContext.mouse_teleport_to_pos
def mouse_teleport_to_pos(self, pos: ImVec2Like, flags: TestOpFlags = TestOpFlags_None) -> None
void MouseTeleportToPos(ImVec2 pos, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);

(private API)

TestContext.mouse_click
def mouse_click(self, button: MouseButton = 0) -> None
void MouseClick(ImGuiMouseButton button = 0);

(private API)

TestContext.mouse_click_multi
def mouse_click_multi(self, button: MouseButton, count: int) -> None
void MouseClickMulti(ImGuiMouseButton button, int count);

(private API)

TestContext.mouse_double_click
def mouse_double_click(self, button: MouseButton = 0) -> None
void MouseDoubleClick(ImGuiMouseButton button = 0);

(private API)

TestContext.mouse_down
def mouse_down(self, button: MouseButton = 0) -> None
void MouseDown(ImGuiMouseButton button = 0);

(private API)

TestContext.mouse_up
def mouse_up(self, button: MouseButton = 0) -> None
void MouseUp(ImGuiMouseButton button = 0);

(private API)

TestContext.mouse_lift_drag_threshold
def mouse_lift_drag_threshold(self, button: MouseButton = 0) -> None
void MouseLiftDragThreshold(ImGuiMouseButton button = 0);

(private API)

TestContext.mouse_drag_with_delta
def mouse_drag_with_delta(self, delta: ImVec2Like, button: MouseButton = 0) -> None
void MouseDragWithDelta(ImVec2 delta, ImGuiMouseButton button = 0);

(private API)

TestContext.mouse_wheel
def mouse_wheel(self, delta: ImVec2Like) -> None
void MouseWheel(ImVec2 delta);

(private API)

TestContext.mouse_wheel_x
def mouse_wheel_x(self, dx: float) -> None
void MouseWheelX(float dx);

(private API)

TestContext.mouse_wheel_y
def mouse_wheel_y(self, dy: float) -> None
void MouseWheelY(float dy);

(private API)

+1: up, -1: down

TestContext.mouse_move_to_void
def mouse_move_to_void(self, viewport: Optional[Viewport] = None) -> None
void MouseMoveToVoid(ImGuiViewport* viewport = nullptr);

(private API)

TestContext.mouse_click_on_void
def mouse_click_on_void(self, button: MouseButton = 0, viewport: Optional[Viewport] = None) -> None
void MouseClickOnVoid(ImGuiMouseButton button = 0, ImGuiViewport* viewport = nullptr);

(private API)

TestContext.find_hovered_window_at_pos
def find_hovered_window_at_pos(self, pos: ImVec2Like) -> Window
ImGuiWindow*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) -> bool
bool FindExistingVoidPosOnViewport(ImGuiViewport* viewport, ImVec2* out);

(private API)

TestContext.mouse_set_viewport
def mouse_set_viewport(self, window: Window) -> None
void MouseSetViewport(ImGuiWindow* window);

(private API)

TestContext.mouse_set_viewport_id
def mouse_set_viewport_id(self, viewport_id: ID) -> None
void MouseSetViewportID(ImGuiID viewport_id);

(private API)

TestContext.key_down
def key_down(self, key_chord: KeyChord) -> None
void KeyDown(ImGuiKeyChord key_chord);

(private API)

TestContext.key_up
def key_up(self, key_chord: KeyChord) -> None
void KeyUp(ImGuiKeyChord key_chord);

(private API)

TestContext.key_press
def key_press(self, key_chord: KeyChord, count: int = 1) -> None
void KeyPress(ImGuiKeyChord key_chord, int count = 1);

(private API)

TestContext.key_hold
def key_hold(self, key_chord: KeyChord, time: float) -> None
void 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) -> None
void KeySetEx(ImGuiKeyChord key_chord, bool is_down, float time);

(private API)

TestContext.key_chars
def key_chars(self, chars: str) -> None
void KeyChars(const char* chars);

(private API)

Input characters

TestContext.key_chars_append
def key_chars_append(self, chars: str) -> None
void 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) -> None
void 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) -> None
void 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) -> None
void 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) -> None
void 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]) -> None
void NavMoveTo(ImGuiTestRef ref);

(private API)

TestContext.nav_activate
def nav_activate(self) -> None
void 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) -> None
void 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) -> None
void 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) -> None
void ScrollToX(ImGuiTestRef ref, float scroll_x);

(private API)

TestContext.scroll_to_y
def scroll_to_y(self, ref: Union[TestRef, str], scroll_y: float) -> None
void ScrollToY(ImGuiTestRef ref, float scroll_y);

(private API)

TestContext.scroll_to_top
def scroll_to_top(self, ref: Union[TestRef, str]) -> None
void ScrollToTop(ImGuiTestRef ref);

(private API)

TestContext.scroll_to_bottom
def scroll_to_bottom(self, ref: Union[TestRef, str]) -> None
void 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) -> None
void 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) -> None
void 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) -> None
void 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) -> None
void 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]) -> None
void ScrollToItemX(ImGuiTestRef ref);

(private API)

TestContext.scroll_to_item_y
def scroll_to_item_y(self, ref: Union[TestRef, str]) -> None
void ScrollToItemY(ImGuiTestRef ref);

(private API)

TestContext.scroll_to_tab_item
def scroll_to_tab_item(self, tab_bar: TabBar, tab_id: ID) -> None
void ScrollToTabItem(ImGuiTabBar* tab_bar, ImGuiID tab_id);

(private API)

TestContext.item_info
def item_info(self, ref: Union[TestRef, str], flags: TestOpFlags = TestOpFlags_None) -> TestItemInfo
ImGuiTestItemInfo 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) -> TestItemInfo
ImGuiTestItemInfo ItemInfoOpenFullPath(ImGuiTestRef ref, ImGuiTestOpFlags flags = ImGuiTestOpFlags_None);

(private API)

def item_info_handle_wildcard_search(self, wildcard_prefix_start: str, wildcard_prefix_end: str, wildcard_suffix_start: str) -> ID
ImGuiID 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) -> TestItemInfo
ImGuiTestItemInfo ItemInfoNull();

(private API)

TestContext.gather_items
def gather_items(self, out_list: TestItemList, parent: Union[TestRef, str], depth: int = -1) -> None
void 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) -> None
void 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) -> None
void 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) -> None
void ItemDoubleClick(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0);

(private API)

TestContext.item_check
def item_check(self, ref: Union[TestRef, str], flags: TestOpFlags = 0) -> None
void ItemCheck(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0);

(private API)

TestContext.item_uncheck
def item_uncheck(self, ref: Union[TestRef, str], flags: TestOpFlags = 0) -> None
void ItemUncheck(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0);

(private API)

TestContext.item_open
def item_open(self, ref: Union[TestRef, str], flags: TestOpFlags = 0) -> None
void ItemOpen(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0);

(private API)

TestContext.item_close
def item_close(self, ref: Union[TestRef, str], flags: TestOpFlags = 0) -> None
void ItemClose(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0);

(private API)

TestContext.item_input
def item_input(self, ref: Union[TestRef, str], flags: TestOpFlags = 0) -> None
void ItemInput(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0);

(private API)

TestContext.item_nav_activate
def item_nav_activate(self, ref: Union[TestRef, str], flags: TestOpFlags = 0) -> None
void 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) -> None
void 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) -> None
void 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) -> None
void 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) -> None
void 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]) -> int
int ItemReadAsInt(ImGuiTestRef ref);

(private API)

Item/Widgets: Helpers to easily read a value by selecting Slider/Drag/Input text, copying it and parsing it.

TestContext.item_read_as_float
def item_read_as_float(self, ref: Union[TestRef, str]) -> float
float 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) -> bool
bool 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]) -> bool
bool ItemExists(ImGuiTestRef ref);

(private API)

TestContext.item_is_checked
def item_is_checked(self, ref: Union[TestRef, str]) -> bool
bool ItemIsChecked(ImGuiTestRef ref);

(private API)

TestContext.item_is_opened
def item_is_opened(self, ref: Union[TestRef, str]) -> bool
bool ItemIsOpened(ImGuiTestRef ref);

(private API)

TestContext.item_is_visible
def item_is_visible(self, ref: Union[TestRef, str]) -> bool
bool ItemIsVisible(ImGuiTestRef ref);

(private API)

TestContext.item_make_visible
def item_make_visible(self, ref: Union[TestRef, str], flags: TestOpFlags) -> None
void 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) -> None
void ItemVerifyCheckedIfAlive(ImGuiTestRef ref, bool checked);

(private API)

TestContext.item_hold
def item_hold(self, ref: Union[TestRef, str], time: float) -> None
void ItemHold(ImGuiTestRef ref, float time);

(private API)

TestContext.item_hold_for_frames
def item_hold_for_frames(self, ref: Union[TestRef, str], frames: int) -> None
void 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]) -> None
void 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) -> None
void 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) -> None
void 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) -> None
void ItemDragWithDelta(ImGuiTestRef ref_src, const ImVec2& pos_delta);

(private API)

TestContext.tab_close
def tab_close(self, ref: Union[TestRef, str]) -> None
void TabClose(ImGuiTestRef ref);

(private API)

TestContext.menu_action
def menu_action(self, action: TestAction, ref: Union[TestRef, str]) -> None
void MenuAction(ImGuiTestAction action, ImGuiTestRef ref);

(private API)

TestContext.menu_action_all
def menu_action_all(self, action: TestAction, ref_parent: Union[TestRef, str]) -> None
void MenuActionAll(ImGuiTestAction action, ImGuiTestRef ref_parent);

(private API)

TestContext.menu_click
def menu_click(self, ref: Union[TestRef, str]) -> None
void MenuClick(ImGuiTestRef ref);

(private API)

TestContext.menu_check
def menu_check(self, ref: Union[TestRef, str]) -> None
void MenuCheck(ImGuiTestRef ref);

(private API)

TestContext.menu_uncheck
def menu_uncheck(self, ref: Union[TestRef, str]) -> None
void MenuUncheck(ImGuiTestRef ref);

(private API)

TestContext.menu_check_all
def menu_check_all(self, ref_parent: Union[TestRef, str]) -> None
void MenuCheckAll(ImGuiTestRef ref_parent);

(private API)

TestContext.menu_uncheck_all
def menu_uncheck_all(self, ref_parent: Union[TestRef, str]) -> None
void MenuUncheckAll(ImGuiTestRef ref_parent);

(private API)

TestContext.combo_click
def combo_click(self, ref: Union[TestRef, str]) -> None
void ComboClick(ImGuiTestRef ref);

(private API)

TestContext.combo_click_all
def combo_click_all(self, ref: Union[TestRef, str]) -> None
void ComboClickAll(ImGuiTestRef ref);

(private API)

TestContext.table_open_context_menu
def table_open_context_menu(self, ref: Union[TestRef, str], column_n: int = -1) -> None
void 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) -> SortDirection
ImGuiSortDirection 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) -> None
void 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) -> None
void 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]) -> TableSortSpecs
const ImGuiTableSortSpecs* TableGetSortSpecs(ImGuiTestRef ref);

(private API)

TestContext.dock_clear
def dock_clear(self, window_name: str) -> None
void 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) -> None
void 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) -> None
void UndockNode(ImGuiID dock_id);

(private API)

TestContext.undock_window
def undock_window(self, window_name: str) -> None
void UndockWindow(const char* window_name);

(private API)

TestContext.window_is_undocked_or_standalone
def window_is_undocked_or_standalone(self, window: Window) -> bool
bool WindowIsUndockedOrStandalone(ImGuiWindow* window);

(private API)

TestContext.dock_id_is_undocked_or_standalone
def dock_id_is_undocked_or_standalone(self, dock_id: ID) -> bool
bool DockIdIsUndockedOrStandalone(ImGuiID dock_id);

(private API)

TestContext.dock_node_hide_tab_bar
def dock_node_hide_tab_bar(self, node: DockNode, hidden: bool) -> None
void DockNodeHideTabBar(ImGuiDockNode* node, bool hidden);

(private API)

TestContext.perf_calc_ref
def perf_calc_ref(self) -> None
void PerfCalcRef();

(private API)

ImVec2    GetDockNodeTitlebarPos(ImGuiDockNode* node);
                                                                    #endif

Performances 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) -> None
void 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) -> None

Auto-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.

AttributeC++
id_: IDImGuiID ID = 0;
frame_count: intint FrameCount = -1;Timestamp of request
result: TestItemInfoImGuiTestItemInfo Result;
TestInfoTask.__init__
def __init__(self, id_: ID = 0, frame_count: int = -1, result: Optional[TestItemInfo] = None) -> None

Auto-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.

AttributeC++
in_parent_id: IDImGuiID InParentID = 0;
in_max_depth: intint InMaxDepth = 0;
in_layer_mask: intshort InLayerMask = 0;
out_list: Optional[TestItemList]ImGuiTestItemList* OutList = nullptr;
last_item_info: Optional[TestItemInfo]ImGuiTestItemInfo* LastItemInfo = nullptr;
TestGatherTask.clear
def clear(self) -> None
void Clear();

(private API)

TestGatherTask.__init__
def __init__(self, in_parent_id: ID = 0, in_max_depth: int = 0, in_layer_mask: int = 0) -> None

Auto-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”)

AttributeC++
in_prefix_id: IDImGuiID 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: intint 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: IDImGuiID InSuffixLastItemHash = 0;
in_filter_item_status_flags: ItemStatusFlagsImGuiItemStatusFlags InFilterItemStatusFlags = 0;Flags required for item to be returned
out_item_id: IDImGuiID 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) -> None

Auto-generated default constructor with named params

TestInputType (enum)

MemberValueC++
none0ImGuiTestInputType_None
key1ImGuiTestInputType_Key
char2ImGuiTestInputType_Char
viewport_focus3ImGuiTestInputType_ViewportFocus
viewport_set_pos4ImGuiTestInputType_ViewportSetPos
viewport_set_size5ImGuiTestInputType_ViewportSetSize
viewport_close6ImGuiTestInputType_ViewportClose

TestInput (class)

FIXME: May want to strip further now that core imgui is using its own input queue

AttributeC++
type: TestInputTypeImGuiTestInputType Type = ImGuiTestInputType_None;
key_chord: KeyChordImGuiKeyChord KeyChord = ImGuiKey_None;
char: ImWcharImWchar Char = 0;
down: boolbool Down = false;
viewport_id: IDImGuiID ViewportId = 0;
viewport_pos_size: ImVec2ImVec2 ViewportPosSize;
TestInput.for_key_chord
@staticmethod
def for_key_chord(key_chord: KeyChord, down: bool) -> TestInput
static ImGuiTestInput ForKeyChord(ImGuiKeyChord key_chord, bool down);

(private API)

TestInput.for_char
@staticmethod
def for_char(v: ImWchar) -> TestInput
static ImGuiTestInput ForChar(ImWchar v);

(private API)

TestInput.for_viewport_focus
@staticmethod
def for_viewport_focus(viewport_id: ID) -> TestInput
static ImGuiTestInput ForViewportFocus(ImGuiID viewport_id);

(private API)

TestInput.for_viewport_set_pos
@staticmethod
def for_viewport_set_pos(viewport_id: ID, pos: ImVec2Like) -> TestInput
static 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) -> TestInput
static ImGuiTestInput ForViewportSetSize(ImGuiID viewport_id, const ImVec2& size);

(private API)

TestInput.for_viewport_close
@staticmethod
def for_viewport_close(viewport_id: ID) -> TestInput
static 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) -> None

Auto-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)

AttributeC++
mouse_pos_value: ImVec2ImVec2 MousePosValue;Own non-rounded copy of MousePos in order facilitate simulating mouse movement very slow speed and high-framerate
mouse_wheel: ImVec2ImVec2 MouseWheel;
mouse_hovered_viewport: IDImGuiID MouseHoveredViewport = 0;
mouse_buttons_value: intint MouseButtonsValue = 0x00;FIXME-TESTS: Use simulated_io.MouseDown[] ?
host_esc_down: boolbool HostEscDown = false;
host_esc_down_duration: floatfloat HostEscDownDuration = -1.0f;Maintain our own DownDuration for host/backend ESC key so we can abort.
host_mouse_pos: ImVec2ImVec2 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) -> None

Auto-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)

AttributeC++
raw_value_ms: floatdouble RawValueMs;For current frame
TestEnginePerfRecord.__init__
def __init__(self) -> None
ImGuiTestEnginePerfRecord();
TestEnginePerfRecord.update_value_for_current_frame
def update_value_for_current_frame(self, v_ms: float) -> None
void UpdateValueForCurrentFrame(double v_ms);

(private API)

TestEngine (class)

[Internal] Test Engine Context

AttributeC++
io: TestEngineIOImGuiTestEngineIO 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: boolbool Started = false;
ui_context_has_hooks: boolbool UiContextHasHooks = false;
batch_start_time: ImU64ImU64 BatchStartTime = 0;
batch_end_time: ImU64ImU64 BatchEndTime = 0;
frame_count: intint FrameCount = 0;
override_delta_time: floatfloat 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: boolbool TestsSourceLinesDirty = false;
gather_task: TestGatherTaskImGuiTestGatherTask GatherTask;
find_by_label_task: TestFindByLabelTaskImGuiTestFindByLabelTask FindByLabelTask;
string_builder_for_checks: TextBufferImGuiTextBuffer StringBuilderForChecks;
inputs: TestInputsImGuiTestInputs Inputs;
abort: boolbool Abort = false;
ui_select_and_scroll_to_test: Optional[Test]ImGuiTest* UiSelectAndScrollToTest = nullptr;
ui_selected_test: Optional[Test]ImGuiTest* UiSelectedTest = nullptr;
ui_metrics_open: boolbool UiMetricsOpen = false;
ui_debug_log_open: boolbool UiDebugLogOpen = false;
ui_capture_tool_open: boolbool UiCaptureToolOpen = false;
ui_stack_tool_open: boolbool UiStackToolOpen = false;
ui_perf_tool_open: boolbool UiPerfToolOpen = false;
ui_log_height: floatfloat UiLogHeight = 150.0f;
perf_timestamp_pre_new_frame: ImU64ImU64 PerfTimestampPreNewFrame;
perf_timestamp_pre_render: ImU64ImU64 PerfTimestampPreRender;
perf_timestamp_pre_swap: ImU64ImU64 PerfTimestampPreSwap;
perf_timestamp_post_swap: ImU64ImU64 PerfTimestampPostSwap;
perf_dt_app: TestEnginePerfRecordImGuiTestEnginePerfRecord PerfDtApp;
perf_dt_pre_new_frame_to_pre_render: TestEnginePerfRecordImGuiTestEnginePerfRecord PerfDtPreNewFrameToPreRender;
perf_dt_pre_render_to_pre_swap: TestEnginePerfRecordImGuiTestEnginePerfRecord PerfDtPreRenderToPreSwap;
perf_dt_pre_new_frame_to_pre_swap: TestEnginePerfRecordImGuiTestEnginePerfRecord PerfDtPreNewFrameToPreSwap;
perf_dt_pre_swap_to_post_swap: TestEnginePerfRecordImGuiTestEnginePerfRecord PerfDtPreSwapToPostSwap;
pre_swap_called: boolbool PreSwapCalled = false;
post_swap_called: boolbool PostSwapCalled = false;
tool_debug_reboot_ui_context: boolbool ToolDebugRebootUiContext = false;Completely shutdown and recreate the dear imgui context in place
tool_slow_down: boolbool ToolSlowDown = false;
tool_slow_down_ms: intint ToolSlowDownMs = 100;
backup_config_run_speed: TestRunSpeedImGuiTestRunSpeed BackupConfigRunSpeed = ImGuiTestRunSpeed_Fast;
backup_config_no_throttle: boolbool BackupConfigNoThrottle = false;
TestEngine.__init__
def __init__(self) -> None
ImGuiTestEngine();

Functions

INTERNAL FUNCTIONS

find_item_info

def find_item_info(engine: TestEngine, id_: ID, debug_id: str) -> TestItemInfo
ImGuiTestItemInfo* ImGuiTestEngine_FindItemInfo(ImGuiTestEngine* engine, ImGuiID id, const char* debug_id);

(private API)

yield_

def yield_(engine: TestEngine) -> None
void ImGuiTestEngine_Yield(ImGuiTestEngine* engine);

(private API)

set_delta_time

def set_delta_time(engine: TestEngine, delta_time: float) -> None
void ImGuiTestEngine_SetDeltaTime(ImGuiTestEngine* engine, float delta_time);

(private API)

get_frame_count

def get_frame_count(engine: TestEngine) -> int
int ImGuiTestEngine_GetFrameCount(ImGuiTestEngine* engine);

(private API)

pass_filter

def pass_filter(test: Test, filter: str) -> bool
bool ImGuiTestEngine_PassFilter(ImGuiTest* test, const char* filter);

(private API)

run_test

def run_test(engine: TestEngine, ctx: TestContext, test: Test, run_flags: TestRunFlags) -> None
void 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) -> None
void ImGuiTestEngine_BindImGuiContext(ImGuiTestEngine* engine, ImGuiContext* ui_ctx);

(private API)

unbind_im_gui_context

def unbind_im_gui_context(engine: TestEngine, ui_ctx: Context) -> None
void ImGuiTestEngine_UnbindImGuiContext(ImGuiTestEngine* engine, ImGuiContext* ui_ctx);

(private API)

reboot_ui_context

def reboot_ui_context(engine: TestEngine) -> None
void ImGuiTestEngine_RebootUiContext(ImGuiTestEngine* engine);

(private API)

update_tests_source_lines

def update_tests_source_lines(engine: TestEngine) -> None
void ImGuiTestEngine_UpdateTestsSourceLines(ImGuiTestEngine* engine);

(private API)

Helper functions

get_status_name

def get_status_name(v: TestStatus) -> str
const char* ImGuiTestEngine_GetStatusName(ImGuiTestStatus v);

(private API)

get_run_speed_name

def get_run_speed_name(v: TestRunSpeed) -> str
const char* ImGuiTestEngine_GetRunSpeedName(ImGuiTestRunSpeed v);

(private API)

get_verbose_level_name

def get_verbose_level_name(v: TestVerboseLevel) -> str
const 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) -> bool
IMGUI_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) -> None
IMGUI_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)

MemberValueC++
none0ImGuiCaptureFlags_None = 0
stitch_all1 << 0ImGuiCaptureFlags_StitchAll = 1 << 0Capture entire window scroll area (by scrolling and taking multiple screenshot). Only works for a single window.
include_other_windows1 << 1ImGuiCaptureFlags_IncludeOtherWindows = 1 << 1Disable hiding other windows (when CaptureAddWindow has been called by default other windows are hidden)
include_popups1 << 2ImGuiCaptureFlags_IncludePopups = 1 << 2Expand capture area to automatically include visible popups (Unused if ImGuiCaptureFlags_IncludeOtherWindows is set)
hide_mouse_cursor1 << 3ImGuiCaptureFlags_HideMouseCursor = 1 << 3Hide render software mouse cursor during capture.
instant1 << 4ImGuiCaptureFlags_Instant = 1 << 4Perform capture on very same frame. Only works when capturing a rectangular region. Unsupported features: content stitching, window hiding, window relocation.
no_save1 << 5ImGuiCaptureFlags_NoSave = 1 << 5Do 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.

AttributeC++
in_flags: CaptureFlagsImGuiCaptureFlags InFlags = 0;Flags for customizing behavior of screenshot tool.
in_capture_windows: ImVector_Window_ptrImVector<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: ImRectImRect InCaptureRect;Screen rect to capture. Does not include padding.
in_padding: floatfloat 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: intint InRecordFPSTarget = 30;FPS target for recording videos.
in_size_align: intint InSizeAlign = 0;Resolution alignment (0 = auto, 1 = no alignment, >= 2 = align width/height to be multiple of given value)
out_image_size: ImVec2ImVec2 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) -> None

Auto-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)

MemberValueC++
in_progress0ImGuiCaptureStatus_InProgress
done1ImGuiCaptureStatus_Done
error2ImGuiCaptureStatus_Error

CaptureWindowData (class)

AttributeC++
window: WindowImGuiWindow* Window;
backup_rect: ImRectImRect BackupRect;
pos_during_capture: ImVec2ImVec2 PosDuringCapture;
CaptureWindowData.__init__
def __init__(self, backup_rect: Optional[ImRect] = None, pos_during_capture: Optional[ImVec2Like] = None) -> None

Auto-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()