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
4TestCase := Window {
5 width: 100phx;
6 height: 100phx;
7 ti := TextInput {
8 }
9
10 property <bool> input_focused: ti.has_focus;
11 property <string> text <=> ti.text;
12}
13
14/*
15```rust
16use slint::platform::Key;
17
18let instance = TestCase::new().unwrap();
19slint_testing::send_mouse_click(&instance, 5., 5.);
20assert!(instance.get_input_focused());
21assert!(instance.get_text().is_empty());
22
23for code in [Key::Shift, Key::ShiftR, Key::Alt, Key::AltGr, Key::Control, Key::ControlR, Key::Meta, Key::MetaR] {
24 slint_testing::send_keyboard_char(&instance, code.into(), true);
25 assert!(instance.get_text().is_empty());
26 slint_testing::send_keyboard_char(&instance, code.into(), false);
27 assert!(instance.get_text().is_empty());
28}
29
30slint_testing::send_keyboard_char(&instance, 'a', true);
31assert_eq!(instance.get_text(), "a");
32```
33*/
34