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 | |
5 | TestCase := Rectangle { |
6 | property <int> xx: animation-tick() / 1ms; |
7 | } |
8 | |
9 | /* |
10 | |
11 | ```rust |
12 | let instance = TestCase::new().unwrap(); |
13 | let begin = instance.get_xx(); |
14 | assert_eq!(begin, instance.get_xx()); |
15 | slint_testing::mock_elapsed_time(600); |
16 | assert_eq!(begin + 600, instance.get_xx()); |
17 | ``` |
18 | |
19 | |
20 | ```cpp |
21 | auto handle = TestCase::create(); |
22 | const TestCase &instance = *handle; |
23 | |
24 | auto begin = instance.get_xx(); |
25 | assert_eq(begin, instance.get_xx()); |
26 | slint_testing::mock_elapsed_time(600); |
27 | assert_eq(begin + 600, instance.get_xx()); |
28 | ``` |
29 | |
30 | ```js |
31 | var instance = new slint.TestCase({}); |
32 | |
33 | let begin = instance.xx; |
34 | assert.equal(begin, instance.xx); |
35 | slintlib.private_api.mock_elapsed_time(600); |
36 | assert.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 | } |