1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/expr"#]
2// Copyright © SixtyFPS GmbH <info@slint.dev>
3// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
4
5TestCase := Rectangle {
6 property <int> xx: animation-tick() / 1ms;
7}
8
9/*
10
11```rust
12let instance = TestCase::new().unwrap();
13let begin = instance.get_xx();
14assert_eq!(begin, instance.get_xx());
15slint_testing::mock_elapsed_time(600);
16assert_eq!(begin + 600, instance.get_xx());
17```
18
19
20```cpp
21auto handle = TestCase::create();
22const TestCase &instance = *handle;
23
24auto begin = instance.get_xx();
25assert_eq(begin, instance.get_xx());
26slint_testing::mock_elapsed_time(600);
27assert_eq(begin + 600, instance.get_xx());
28```
29
30```js
31var instance = new slint.TestCase({});
32
33let begin = instance.xx;
34assert.equal(begin, instance.xx);
35slintlib.private_api.mock_elapsed_time(600);
36assert.equal(begin + 600, instance.xx);
37```
38*/
39}
40
41#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
42 use i_slint_backend_testing as slint_testing;
43 slint_testing::init();
44 let instance = TestCase::new().unwrap();
45 let begin = instance.get_xx();
46 assert_eq!(begin, instance.get_xx());
47 slint_testing::mock_elapsed_time(time_in_ms:600);
48 assert_eq!(begin + 600, instance.get_xx());
49 Ok(())
50}