| 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 | // Make sure that we generate the correct code to call a built-in member function through a parent. |
| 5 | |
| 6 | export component TestCase inherits Window { |
| 7 | width: 100phx; |
| 8 | height: 100phx; |
| 9 | |
| 10 | out property<bool> selection-set; |
| 11 | |
| 12 | input := TextInput { |
| 13 | text: "Hello World" ; |
| 14 | if (true): TouchArea { |
| 15 | clicked => { |
| 16 | input.select-all(); |
| 17 | root.selection-set = input.anchor-position-byte-offset == 0 && input.cursor-position-byte-offset == 11; |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | /* |
| 24 | |
| 25 | ```cpp |
| 26 | auto handle = TestCase::create(); |
| 27 | const TestCase &instance = *handle; |
| 28 | assert(!instance.get_selection_set()); |
| 29 | slint_testing::send_mouse_click(&instance, 5., 5.); |
| 30 | assert(instance.get_selection_set()); |
| 31 | ``` |
| 32 | |
| 33 | ```rust |
| 34 | let instance = TestCase::new().unwrap(); |
| 35 | assert!(!instance.get_selection_set()); |
| 36 | slint_testing::send_mouse_click(&instance, 5., 5.); |
| 37 | assert!(instance.get_selection_set()); |
| 38 | ``` |
| 39 | |
| 40 | ```js |
| 41 | var instance = new slint.TestCase(); |
| 42 | assert(!instance.selection_set); |
| 43 | slintlib.private_api.send_mouse_click(instance, 5., 5.); |
| 44 | assert(instance.selection_set); |
| 45 | ``` |
| 46 | */ |
| 47 | |