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
11component A inherits Rectangle {
12}
13component B inherits A {
14}
15
16
17export 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
28let instance = TestCase::new().unwrap();
29
30assert!(!instance.get_clicked());
31slint_testing::send_mouse_click(&instance, 20., 5.);
32assert!(instance.get_clicked());
33```
34
35```cpp
36auto handle = TestCase::create();
37const TestCase &instance = *handle;
38assert(!instance.get_clicked());
39slint_testing::send_mouse_click(&instance, 20., 5.);
40assert(instance.get_clicked());
41```
42
43
44```js
45var instance = new slint.TestCase({});
46assert(!instance.clicked);
47slintlib.private_api.send_mouse_click(instance, 20., 5.);
48assert(instance.clicked);
49```
50
51
52*/
53