pub struct TestEngine { /* private fields */ }Expand description
Dear ImGui Test Engine context.
The upstream engine is not thread-safe; create and use it on the same thread as the target ImGui context.
Implementations§
Source§impl TestEngine
impl TestEngine
Sourcepub fn try_create() -> ImGuiResult<Self>
pub fn try_create() -> ImGuiResult<Self>
Creates a new test engine context.
pub fn as_raw(&self) -> *mut ImGuiTestEngine
pub fn is_bound(&self) -> bool
pub fn is_started(&self) -> bool
Sourcepub fn try_start(&mut self, imgui_ctx: &Context) -> ImGuiResult<()>
pub fn try_start(&mut self, imgui_ctx: &Context) -> ImGuiResult<()>
Tries to start (bind) the test engine to an ImGui context.
Calling this multiple times with the same context is a no-op.
Returns an error if the engine is already bound to a different context, or if the engine
was previously stopped but is still bound (call shutdown() to detach first).
Sourcepub fn start(&mut self, imgui_ctx: &Context)
pub fn start(&mut self, imgui_ctx: &Context)
Starts (binds) the test engine to an ImGui context.
Calling this multiple times with the same context is a no-op.
§Panics
Panics if called while already started with a different ImGui context.
Sourcepub fn stop(&mut self)
pub fn stop(&mut self)
Stops the test coroutine and exports results, but keeps the engine bound to the ImGui context.
Sourcepub fn shutdown(&mut self)
pub fn shutdown(&mut self)
Stops (if needed) and detaches the engine from the bound ImGui context.
This is the most ergonomic shutdown path for Rust applications: it avoids relying on drop order
between Context and TestEngine.
pub fn post_swap(&mut self)
pub fn show_windows(&mut self, _ui: &Ui, opened: Option<&mut bool>)
Sourcepub fn register_default_tests(&mut self)
pub fn register_default_tests(&mut self)
Registers a small set of built-in demo tests (useful to validate integration).
Sourcepub fn add_script_test<F>(
&mut self,
category: &str,
name: &str,
build: F,
) -> ImGuiResult<()>
pub fn add_script_test<F>( &mut self, category: &str, name: &str, build: F, ) -> ImGuiResult<()>
Registers a script-driven test.
Script tests do not provide a GUI function: they are meant to drive your application’s existing UI.
pub fn queue_tests( &mut self, group: TestGroup, filter: Option<&str>, run_flags: RunFlags, ) -> ImGuiResult<()>
pub fn queue_all_tests(&mut self)
Sourcepub fn result_summary(&self) -> ResultSummary
pub fn result_summary(&self) -> ResultSummary
Returns a best-effort snapshot of test results.
Note: upstream asserts if queried while a test is running; our sys shim
intentionally avoids aborting and will count Running tests as “remaining”.