mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 13:51:13 +00:00
Add missing files
This commit is contained in:
parent
05c5f7c53d
commit
1d7effd030
2 changed files with 34 additions and 0 deletions
9
api/sixtyfps-cpp/include/sixtyfps_testing.h
Normal file
9
api/sixtyfps-cpp/include/sixtyfps_testing.h
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "sixtyfps.h"
|
||||||
|
|
||||||
|
namespace sixtyfps::testing {
|
||||||
|
inline void ellapse_time(int64_t time_in_ms) {
|
||||||
|
internal::sixtyfps_test_ellapse_time(time_in_ms);
|
||||||
|
}
|
||||||
|
} // namespace sixtyfps
|
25
sixtyfps_runtime/corelib/abi/tests.rs
Normal file
25
sixtyfps_runtime/corelib/abi/tests.rs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
//! 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_test_ellapse_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)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Somehow this is required for the extern "C" things to be exported in a dependent dynlib
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub fn dummy() {
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct Foo;
|
||||||
|
foo(Foo);
|
||||||
|
fn foo(f: impl Clone) {
|
||||||
|
let _ = f.clone();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue