slint-ui/slint · error

access_testing_window called without testing backend/adapter

Error message

access_testing_window called without testing backend/adapter

What it means

Error "access_testing_window called without testing backend/adapter" thrown in slint-ui/slint.

Source

Thrown at internal/backends/testing/internal_tests.rs:193

            position: i_slint_core::lengths::logical_point_from_api(
                i_slint_core::api::LogicalPosition::new(center_x, center_y),
            ),
            delta,
            phase,
        },
    ));
}

pub fn access_testing_window<R>(
    window: &i_slint_core::api::Window,
    callback: impl FnOnce(&TestingWindow) -> R,
) -> R {
    i_slint_core::window::WindowInner::from_pub(window)
        .window_adapter()
        .internal(i_slint_core::InternalToken)
        .and_then(|wa| (wa as &dyn core::any::Any).downcast_ref::<TestingWindow>())
        .map(callback)
        .expect("access_testing_window called without testing backend/adapter")
}

/// Runs a future to completion by polling the future and updating the mock time until the future is ready
pub fn block_on<R>(future: impl Future<Output = R>) -> R {
    let mut pinned = core::pin::pin!(future);
    let mut ctx = core::task::Context::from_waker(core::task::Waker::noop());
    loop {
        if let core::task::Poll::Ready(r) = pinned.as_mut().poll(&mut ctx) {
            return r;
        }
        let duration = i_slint_core::platform::duration_until_next_timer_update()
            .unwrap_or(core::time::Duration::from_secs(1));
        crate::testing_backend::mock_elapsed_time(duration.as_millis() as u64);
    }
}

View on GitHub (pinned to 3fd8f2ec03)

Solutions

  1. Initialize the testing backend before accessing the testing window.
  2. Verify the window was created by the testing adapter.

When it happens

Trigger: Thrown at internal/backends/testing/internal_tests.rs:193 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of slint-ui/slint@3fd8f2ec03 (2026-08-19). Data as JSON: /api/errors/a919c818a1f64a90. Report an issue: GitHub.