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 TestCase := Rectangle {
5 property<int> a:12;
6 property<string> s1: "hello" + a + a;
7 property<string> s2: 10 + "hello" + 5.1;
8 property<string> s3: "x";
9 property<{ a: string }> obj: { a: "a" };
10 property<string> s4: obj.a + "xxx";
11 callback foo;
12 foo => {
13 s3 += a;
14 s3 += s3;
15 obj.a += "yo";
16 }
17
18 property <bool> test: (s1 + s1 + obj.a + obj.a) == "hello1212hello1212aa";
19}
20/*
21```cpp
22auto handle = TestCase::create();
23const TestCase &instance = *handle;
24assert_eq(instance.get_s1(), slint::SharedString("hello1212"));
25assert_eq(instance.get_s2(), slint::SharedString("10hello5.1"));
26instance.set_a(42);
27assert_eq(instance.get_s1(), slint::SharedString("hello4242"));
28instance.invoke_foo();
29assert_eq(instance.get_s3(), slint::SharedString("x42x42"));
30assert_eq(instance.get_s4(), slint::SharedString("ayoxxx"));
31```
32
33
34```rust
35let instance = TestCase::new().unwrap();
36assert_eq!(instance.get_s1(), slint::SharedString::from("hello1212"));
37assert_eq!(instance.get_s2(), slint::SharedString::from("10hello5.1"));
38instance.set_a(42);
39assert_eq!(instance.get_s1(), slint::SharedString::from("hello4242"));
40instance.invoke_foo();
41assert_eq!(instance.get_s3(), slint::SharedString::from("x42x42"));
42assert_eq!(instance.get_s4(), slint::SharedString::from("ayoxxx"));
43```
44
45```js
46var instance = new slint.TestCase({});
47assert.equal(instance.s1, "hello1212");
48assert.equal(instance.s2, "10hello5.1");
49instance.a = 42;
50assert.equal(instance.s1, "hello4242");
51instance.foo();
52assert.equal(instance.s3, "x42x42");
53assert.equal(instance.s4, "ayoxxx");
54```
55*/
56