Skip to main content

TestEngine

Struct TestEngine 

Source
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

Source

pub fn try_create() -> ImGuiResult<Self>

Creates a new test engine context.

Source

pub fn create() -> Self

Creates a new test engine context.

§Panics

Panics if the underlying context creation fails.

Source

pub fn as_raw(&self) -> *mut ImGuiTestEngine

Source

pub fn is_bound(&self) -> bool

Source

pub fn is_started(&self) -> bool

Source

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

Source

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.

Source

pub fn stop(&mut self)

Stops the test coroutine and exports results, but keeps the engine bound to the ImGui context.

Source

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.

Source

pub fn post_swap(&mut self)

Source

pub fn show_windows(&mut self, _ui: &Ui, opened: Option<&mut bool>)

Source

pub fn register_default_tests(&mut self)

Registers a small set of built-in demo tests (useful to validate integration).

Source

pub fn add_script_test<F>( &mut self, category: &str, name: &str, build: F, ) -> ImGuiResult<()>
where F: FnOnce(&mut ScriptTest<'_>) -> ImGuiResult<()>,

Registers a script-driven test.

Script tests do not provide a GUI function: they are meant to drive your application’s existing UI.

Source

pub fn queue_tests( &mut self, group: TestGroup, filter: Option<&str>, run_flags: RunFlags, ) -> ImGuiResult<()>

Source

pub fn queue_all_tests(&mut self)

Source

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

Source

pub fn is_test_queue_empty(&self) -> bool

Source

pub fn is_running_tests(&self) -> bool

Source

pub fn is_requesting_max_app_speed(&self) -> bool

Source

pub fn try_abort_engine(&mut self) -> bool

Source

pub fn abort_current_test(&mut self)

Source

pub fn set_run_speed(&mut self, speed: RunSpeed)

Source

pub fn set_verbose_level(&mut self, level: VerboseLevel)

Source

pub fn set_capture_enabled(&mut self, enabled: bool)

Source

pub fn install_default_crash_handler()

Trait Implementations§

Source§

impl Drop for TestEngine

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more