| 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 | |
| 4 | Sub := 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 | |
| 14 | TestCase := Rectangle { |
| 15 | property cond <=> s.cond; |
| 16 | property val <=> s.child_opacity; |
| 17 | s := Sub {} |
| 18 | } |
| 19 | |
| 20 | /* |
| 21 | |
| 22 | ```rust |
| 23 | let instance = TestCase::new().unwrap(); |
| 24 | assert_eq!(instance.get_val(), 1.); |
| 25 | instance.set_cond(true); |
| 26 | assert_eq!(instance.get_val(), 1.); |
| 27 | slint_testing::mock_elapsed_time(500); |
| 28 | assert_eq!(instance.get_val(), 0.5); |
| 29 | slint_testing::mock_elapsed_time(500); |
| 30 | assert_eq!(instance.get_val(), 0.); |
| 31 | |
| 32 | ``` |
| 33 | |
| 34 | */ |
| 35 | |