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
5export 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
29let instance = TestCase::new().unwrap();
30assert_eq!(instance.get_rect_opacity(), 0.0);
31slint_testing::mock_elapsed_time(600);
32assert_eq!(instance.get_rect_opacity(), 0.0);
33```
34
35```cpp
36auto handle = TestCase::create();
37const TestCase &instance = *handle;
38assert_eq(instance.get_rect_opacity(), 0.0);
39slint_testing::mock_elapsed_time(600);
40assert_eq(instance.get_rect_opacity(), 0.0);
41```
42
43*/
44