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// issue #422
5
6export TestCase := Window {
7 width: 100phx;
8 height: 100phx;
9
10 property<bool> combo_has_focus;
11
12 if (true): combo := FocusScope {
13 if (true): TouchArea {
14 clicked => {
15 combo.focus();
16 root.combo_has_focus = combo.has-focus;
17 }
18 }
19 }
20}
21
22/*
23
24```cpp
25auto handle = TestCase::create();
26const TestCase &instance = *handle;
27assert(!instance.get_combo_has_focus());
28slint_testing::send_mouse_click(&instance, 5., 5.);
29assert(instance.get_combo_has_focus());
30```
31
32```rust
33let instance = TestCase::new().unwrap();
34assert!(!instance.get_combo_has_focus());
35slint_testing::send_mouse_click(&instance, 5., 5.);
36assert!(instance.get_combo_has_focus());
37```
38
39```js
40var instance = new slint.TestCase();
41assert(!instance.combo_has_focus);
42slintlib.private_api.send_mouse_click(instance, 5., 5.);
43assert(instance.combo_has_focus);
44```
45*/
46