1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3
4Sub := Rectangle {
5 property <bool> cond;
6 property <float> child_opacity: inner.opacity;
7 inner := Rectangle {
8 opacity: cond ? 0 : 1;
9 animate opacity { duration: 1s; }
10 background: green;
11 }
12}
13
14TestCase := Rectangle {
15 property cond <=> s.cond;
16 property val <=> s.child_opacity;
17 s := Sub {}
18}
19
20/*
21
22```rust
23let instance = TestCase::new().unwrap();
24assert_eq!(instance.get_val(), 1.);
25instance.set_cond(true);
26assert_eq!(instance.get_val(), 1.);
27slint_testing::mock_elapsed_time(500);
28assert_eq!(instance.get_val(), 0.5);
29slint_testing::mock_elapsed_time(500);
30assert_eq!(instance.get_val(), 0.);
31
32```
33
34*/
35