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
4export component TestCase {
5
6 property <float> float-var: 26.7;
7 // Going through a private property of type int should really cast to int
8 private property <int> tens-digit-var: float-var / 10;
9
10 // test that it rounds
11 out property <int> int-val: -7.6;
12
13 out property <string> text: tens-digit-var;
14 out property <bool> test: tens-digit-var == 2 && text == "2" && int-val == -7;
15}
16
17
18/*
19
20```cpp
21auto handle = TestCase::create();
22const TestCase &instance = *handle;
23assert_eq(instance.get_text(), "2");
24assert_eq(instance.get_int_val(), -7);
25assert(instance.get_test());
26```
27
28```rust
29let instance = TestCase::new().unwrap();
30assert_eq!(instance.get_text(), "2");
31assert_eq!(instance.get_int_val(), -7);
32assert!(instance.get_test());
33```
34
35```js
36var instance = new slint.TestCase({});
37assert.equal(instance.text, "2");
38assert.equal(instance.int_val, -7);
39assert(instance.test);
40```
41
42*/
43