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// Allow for accessing built-in functions on root elements even with an injected window item
5
6export component TestCase inherits TextInput {
7 width: 100phx;
8 height: 100phx;
9
10 out property<bool> selection-set;
11
12 text: "Hello World";
13 if (true): TouchArea {
14 clicked => {
15 root.select-all();
16 root.selection-set = root.anchor-position-byte-offset == 0 && root.cursor-position-byte-offset == 11;
17 }
18 }
19}
20
21/*
22
23```cpp
24auto handle = TestCase::create();
25const TestCase &instance = *handle;
26assert(!instance.get_selection_set());
27slint_testing::send_mouse_click(&instance, 5., 5.);
28assert(instance.get_selection_set());
29```
30
31```rust
32let instance = TestCase::new().unwrap();
33assert!(!instance.get_selection_set());
34slint_testing::send_mouse_click(&instance, 5., 5.);
35assert!(instance.get_selection_set());
36```
37
38```js
39var instance = new slint.TestCase();
40assert(!instance.selection_set);
41slintlib.private_api.send_mouse_click(instance, 5., 5.);
42assert(instance.selection_set);
43```
44*/
45