1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
2 | // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial |
3 | |
4 | |
5 | export component TestCase { |
6 | width: 300px; |
7 | height: 300px; |
8 | r:= Rectangle { |
9 | property <bool> scrolling: false; |
10 | |
11 | states [ |
12 | active when scrolling : { |
13 | opacity: 1; |
14 | out { |
15 | animate opacity { duration: 800ms; } |
16 | } |
17 | } |
18 | inactive when !scrolling : { |
19 | opacity: 0; |
20 | } |
21 | ] |
22 | } |
23 | |
24 | out property rect_opacity <=> r.opacity; |
25 | } |
26 | |
27 | /* |
28 | ```rust |
29 | let instance = TestCase::new().unwrap(); |
30 | assert_eq!(instance.get_rect_opacity(), 0.0); |
31 | slint_testing::mock_elapsed_time(600); |
32 | assert_eq!(instance.get_rect_opacity(), 0.0); |
33 | ``` |
34 | |
35 | ```cpp |
36 | auto handle = TestCase::create(); |
37 | const TestCase &instance = *handle; |
38 | assert_eq(instance.get_rect_opacity(), 0.0); |
39 | slint_testing::mock_elapsed_time(600); |
40 | assert_eq(instance.get_rect_opacity(), 0.0); |
41 | ``` |
42 | |
43 | */ |
44 | |