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
4export component TestCase {
5 in-out property<string> p1: "hello";
6 in-out property<string> p2: "fox:🦊";
7 in-out property<string> p3: "with\"quote\\\"\u{8}";
8 in-out property<bool> e1: p2 == "fox:🦊";
9 in-out property<bool> e2: p2 == "fox:🦍";
10
11 // conversion from float
12 in property<float> value: 98.7654321;
13 out property <string> converted_value: round(value * 100)/100;
14 out property <bool> test: e1 && !e2 && converted_value == "98.77";
15}
16
17
18/*
19
20```cpp
21auto handle = TestCase::create();
22const TestCase &instance = *handle;
23assert_eq(instance.get_p1(), "hello");
24assert_eq(instance.get_p2(), "fox:🦊");
25assert_eq(instance.get_p3(), "with\"quote\\\"\x08");
26assert(instance.get_e1());
27assert(!instance.get_e2());
28assert(instance.get_test());
29```
30
31```rust
32let instance = TestCase::new().unwrap();
33assert_eq!(instance.get_p1(), "hello");
34assert_eq!(instance.get_p2(), "fox:🦊");
35assert_eq!(instance.get_p3(), "with\"quote\\\"\u{8}");
36assert!(instance.get_e1());
37assert!(!instance.get_e2());
38assert!(instance.get_test());
39```
40
41```js
42var instance = new slint.TestCase({});
43assert.equal(instance.p1, "hello");
44assert.equal(instance.p2, "fox:🦊");
45assert.equal(instance.p3, "with\"quote\\\"\u0008");
46assert(instance.e1);
47assert(!instance.e2);
48assert(instance.test);
49```
50
51*/
52