| 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 | |
| 5 | export component SpinBoxBase { |
| 6 | in-out property <int> value; |
| 7 | } |
| 8 | |
| 9 | |
| 10 | export 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 | |
| 23 | export 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 |
| 39 | auto handle = TestCase::create(); |
| 40 | const TestCase &instance = *handle; |
| 41 | |
| 42 | assert_eq(instance.get_val(), "Value: 5"); |
| 43 | slint_testing::send_mouse_click(&instance, 5., 5.); |
| 44 | assert_eq(instance.get_val(), "Value: 6"); |
| 45 | ``` |
| 46 | |
| 47 | ```rust |
| 48 | let instance = TestCase::new().unwrap(); |
| 49 | |
| 50 | assert_eq!(instance.get_val(), "Value: 5"); |
| 51 | slint_testing::send_mouse_click(&instance, 5., 5.); |
| 52 | assert_eq!(instance.get_val(), "Value: 6"); |
| 53 | ``` |
| 54 | |
| 55 | ```js |
| 56 | var instance = new slint.TestCase(); |
| 57 | |
| 58 | assert.equal(instance.val, "Value: 5"); |
| 59 | slintlib.private_api.send_mouse_click(instance, 5., 5.); |
| 60 | assert.equal(instance.val, "Value: 6"); |
| 61 | ``` |
| 62 | */ |
| 63 | |