| 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 | component Wrapper inherits Rectangle { |
| 5 | border-color: blue; |
| 6 | border-width: 1px; |
| 7 | in-out property <string> text <=> text.text; |
| 8 | callback edited <=> text.edited; |
| 9 | text := TextInput {} |
| 10 | } |
| 11 | |
| 12 | |
| 13 | export component TestCase { |
| 14 | width: 50px; |
| 15 | height: 50px; |
| 16 | in-out property <int> text: 6; |
| 17 | callback edited(); |
| 18 | |
| 19 | VerticalLayout { |
| 20 | Wrapper { |
| 21 | text: root.text; |
| 22 | edited => { |
| 23 | root.text = self.text.to-float(); |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | |
| 30 | /* |
| 31 | ```rust |
| 32 | let instance = TestCase::new().unwrap(); |
| 33 | slint_testing::send_mouse_click(&instance, 25., 25.); |
| 34 | slint_testing::send_keyboard_char(&instance, '4', true); |
| 35 | assert_eq!(instance.get_text(), 64); |
| 36 | ``` |
| 37 | |
| 38 | */ |
| 39 | |