mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 06:41:14 +00:00
14 lines
602 B
Rust
14 lines
602 B
Rust
//! Functions usefull for testing
|
|
|
|
/// SixtyFPS animations do not use real time, but use a mocked time.
|
|
/// Normally, the event loop update the time of the animation using
|
|
/// real time, but in tests, it is more convinient to use the fake time.
|
|
/// This function will add some milliseconds to the fake time
|
|
#[no_mangle]
|
|
pub extern "C" fn sixtyfps_mock_elapsed_time(time_in_ms: u64) {
|
|
crate::animations::CURRENT_ANIMATION_DRIVER.with(|driver| {
|
|
let mut tick = driver.current_tick();
|
|
tick += instant::Duration::from_millis(time_in_ms);
|
|
driver.update_animations(tick)
|
|
})
|
|
}
|