| 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 | // issue #422 |
| 5 | |
| 6 | export 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 |
| 25 | auto handle = TestCase::create(); |
| 26 | const TestCase &instance = *handle; |
| 27 | assert(!instance.get_combo_has_focus()); |
| 28 | slint_testing::send_mouse_click(&instance, 5., 5.); |
| 29 | assert(instance.get_combo_has_focus()); |
| 30 | ``` |
| 31 | |
| 32 | ```rust |
| 33 | let instance = TestCase::new().unwrap(); |
| 34 | assert!(!instance.get_combo_has_focus()); |
| 35 | slint_testing::send_mouse_click(&instance, 5., 5.); |
| 36 | assert!(instance.get_combo_has_focus()); |
| 37 | ``` |
| 38 | |
| 39 | ```js |
| 40 | var instance = new slint.TestCase(); |
| 41 | assert(!instance.combo_has_focus); |
| 42 | slintlib.private_api.send_mouse_click(instance, 5., 5.); |
| 43 | assert(instance.combo_has_focus); |
| 44 | ``` |
| 45 | */ |
| 46 | |