1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
3
4
5export component SpinBoxBase {
6 in-out property <int> value;
7}
8
9
10export component SpinBox {
11 in-out property <int> value <=> i-base.value;
12 i-base := SpinBoxBase {
13 width: 100%;
14 }
15 TouchArea {
16 clicked => {
17 i-base.value += 1;
18 }
19 }
20}
21
22
23export component TestCase {
24 width: 100px;
25 height: 100px;
26 trials:=SpinBox {
27 value: 5;
28 width: 100%;
29 height: 100%;
30 }
31 t:=Text {
32 text: "Value: "+ trials.value;
33 }
34 out property <string> val: t.text;
35}
36
37/*
38```cpp
39auto handle = TestCase::create();
40const TestCase &instance = *handle;
41
42assert_eq(instance.get_val(), "Value: 5");
43slint_testing::send_mouse_click(&instance, 5., 5.);
44assert_eq(instance.get_val(), "Value: 6");
45```
46
47```rust
48let instance = TestCase::new().unwrap();
49
50assert_eq!(instance.get_val(), "Value: 5");
51slint_testing::send_mouse_click(&instance, 5., 5.);
52assert_eq!(instance.get_val(), "Value: 6");
53```
54
55```js
56var instance = new slint.TestCase();
57
58assert.equal(instance.val, "Value: 5");
59slintlib.private_api.send_mouse_click(instance, 5., 5.);
60assert.equal(instance.val, "Value: 6");
61```
62*/
63