1 | #![allow (deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/issues"# ] |
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 | |
6 | export component SpinBoxBase { |
7 | in-out property <int> value; |
8 | } |
9 | |
10 | |
11 | export component SpinBox { |
12 | in-out property <int> value <=> i-base.value; |
13 | i-base := SpinBoxBase { |
14 | width: 100%; |
15 | } |
16 | TouchArea { |
17 | clicked => { |
18 | i-base.value += 1; |
19 | } |
20 | } |
21 | } |
22 | |
23 | |
24 | export component TestCase { |
25 | width: 100px; |
26 | height: 100px; |
27 | trials:=SpinBox { |
28 | value: 5; |
29 | width: 100%; |
30 | height: 100%; |
31 | } |
32 | t:=Text { |
33 | text: "Value: " + trials.value; |
34 | } |
35 | out property <string> val: t.text; |
36 | } |
37 | |
38 | /* |
39 | ```cpp |
40 | auto handle = TestCase::create(); |
41 | const TestCase &instance = *handle; |
42 | |
43 | assert_eq(instance.get_val(), "Value: 5"); |
44 | slint_testing::send_mouse_click(&instance, 5., 5.); |
45 | assert_eq(instance.get_val(), "Value: 6"); |
46 | ``` |
47 | |
48 | ```rust |
49 | let instance = TestCase::new().unwrap(); |
50 | |
51 | assert_eq!(instance.get_val(), "Value: 5"); |
52 | slint_testing::send_mouse_click(&instance, 5., 5.); |
53 | assert_eq!(instance.get_val(), "Value: 6"); |
54 | ``` |
55 | |
56 | ```js |
57 | var instance = new slint.TestCase(); |
58 | |
59 | assert.equal(instance.val, "Value: 5"); |
60 | slintlib.private_api.send_mouse_click(instance, 5., 5.); |
61 | assert.equal(instance.val, "Value: 6"); |
62 | ``` |
63 | */ |
64 | } |
65 | |
66 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
67 | use i_slint_backend_testing as slint_testing; |
68 | slint_testing::init(); |
69 | let instance = TestCase::new().unwrap(); |
70 | |
71 | assert_eq!(instance.get_val(), "Value: 5" ); |
72 | slint_testing::send_mouse_click(&instance, x:5., y:5.); |
73 | assert_eq!(instance.get_val(), "Value: 6" ); |
74 | Ok(()) |
75 | } |