| 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 | |
| 5 | import { Button, TextEdit } from "std-widgets.slint" ; |
| 6 | export component TestCase inherits Window { |
| 7 | preferred-height: 768px; |
| 8 | preferred-width: 1024px; |
| 9 | forward-focus: te; |
| 10 | VerticalLayout { |
| 11 | y: -1 * root.height; |
| 12 | width: root.width; |
| 13 | Rectangle { |
| 14 | height: root.height; |
| 15 | } |
| 16 | te := TextEdit { |
| 17 | height: root.height; |
| 18 | |
| 19 | } |
| 20 | } |
| 21 | out property <string> text <=> te.text; |
| 22 | out property <bool> has-focus <=> te.has-focus; |
| 23 | } |
| 24 | |
| 25 | |
| 26 | /* |
| 27 | |
| 28 | |
| 29 | ```rust |
| 30 | let instance = TestCase::new().unwrap(); |
| 31 | |
| 32 | assert_eq!(instance.get_has_focus(), true); |
| 33 | slint_testing::send_keyboard_string_sequence(&instance, "X"); |
| 34 | slint_testing::send_keyboard_string_sequence(&instance, "Y"); |
| 35 | slint_testing::send_keyboard_string_sequence(&instance, "Z"); |
| 36 | assert_eq!(instance.get_text(), "XYZ"); |
| 37 | assert_eq!(instance.get_has_focus(), true); |
| 38 | ``` |
| 39 | |
| 40 | */ |
| 41 | |