1#![allow(deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/text"#]
2// Copyright © SixtyFPS GmbH <info@slint.dev>
3// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
4
5// Test that the
6
7global SomeGlobal := {
8 property <string> intermediate_alias <=> intermediate_prop;
9 property <string> intermediate_prop;
10 property <string> text: intermediate_prop;
11}
12
13TestCase := Window {
14 width: 100phx;
15 height: 100phx;
16 VerticalLayout {
17 padding: 0;
18 spacing: 0;
19 ti := TextInput {
20 property <string> foo <=> SomeGlobal.intermediate_alias;
21 text <=> foo;
22 property <bool> bar <=> has_focus;
23
24 }
25 t := Text {
26 text <=> SomeGlobal.text;
27 }
28 Rectangle { }
29 }
30
31 property <string> text <=> t.text;
32 property <bool> input_focused: ti.bar;
33}
34
35/*
36```rust
37let instance = TestCase::new().unwrap();
38slint_testing::send_mouse_click(&instance, 5., 5.);
39assert!(instance.get_input_focused());
40assert_eq!(instance.get_text(), "");
41slint_testing::send_keyboard_string_sequence(&instance, "Hallo");
42assert_eq!(instance.get_text(), "Hallo");
43```
44*/
45}
46
47#[test] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> {
48 use i_slint_backend_testing as slint_testing;
49 slint_testing::init();
50 let instance = TestCase::new().unwrap();
51 slint_testing::send_mouse_click(&instance, x:5., y:5.);
52 assert!(instance.get_input_focused());
53 assert_eq!(instance.get_text(), "");
54 slint_testing::send_keyboard_string_sequence(&instance, sequence:"Hallo");
55 assert_eq!(instance.get_text(), "Hallo");
56 Ok(())
57}