| 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 | // Verify that two repeaters (if and for) are placed correctly in the item tree |
| 5 | // and matched in the dyn_visit closure. |
| 6 | // The two repeaters ended up being swapped and sub-component's repeater was |
| 7 | // visited when the Text's child's repeater should have been, resulting in |
| 8 | // wrong rendering order. This is tested by clicking into the left half and |
| 9 | // verifying that it did not hit the sub-component's repeater. |
| 10 | |
| 11 | component A inherits Rectangle { |
| 12 | } |
| 13 | component B inherits A { |
| 14 | } |
| 15 | |
| 16 | |
| 17 | export component TestCase { |
| 18 | width: 300phx; |
| 19 | height: 300phx; |
| 20 | out property <bool> clicked; |
| 21 | B { |
| 22 | TouchArea { clicked => {root.clicked = true;} } |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | /* |
| 27 | ```rust |
| 28 | let instance = TestCase::new().unwrap(); |
| 29 | |
| 30 | assert!(!instance.get_clicked()); |
| 31 | slint_testing::send_mouse_click(&instance, 20., 5.); |
| 32 | assert!(instance.get_clicked()); |
| 33 | ``` |
| 34 | |
| 35 | ```cpp |
| 36 | auto handle = TestCase::create(); |
| 37 | const TestCase &instance = *handle; |
| 38 | assert(!instance.get_clicked()); |
| 39 | slint_testing::send_mouse_click(&instance, 20., 5.); |
| 40 | assert(instance.get_clicked()); |
| 41 | ``` |
| 42 | |
| 43 | |
| 44 | ```js |
| 45 | var instance = new slint.TestCase({}); |
| 46 | assert(!instance.clicked); |
| 47 | slintlib.private_api.send_mouse_click(instance, 20., 5.); |
| 48 | assert(instance.clicked); |
| 49 | ``` |
| 50 | |
| 51 | |
| 52 | */ |
| 53 | |