forked from slint-ui/slint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* LICENSE BEGIN | ||
This file is part of the SixtyFPS Project -- https://sixtyfps.io | ||
Copyright (c) 2020 Olivier Goffart <olivier.goffart@sixtyfps.io> | ||
Copyright (c) 2020 Simon Hausmann <simon.hausmann@sixtyfps.io> | ||
|
||
SPDX-License-Identifier: GPL-3.0-only | ||
This file is also available under commercial licensing terms. | ||
Please contact info@sixtyfps.io for more information. | ||
LICENSE END */ | ||
TestCase := Rectangle { | ||
property<int> a:12; | ||
property<string> s1: "hello" + a + a; | ||
property<string> s2: 10 + "hello" + 5.1; | ||
property<string> s3: "x"; | ||
property<{ a: string }> obj: { a: "a" }; | ||
property<string> s4: obj.a + "xxx"; | ||
signal foo; | ||
foo => { | ||
s3 += a; | ||
s3 += s3; | ||
obj.a += "yo"; | ||
} | ||
} | ||
/* | ||
```cpp | ||
TestCase instance; | ||
assert_eq(instance.get_s1(), sixtyfps::SharedString("hello1212")); | ||
assert_eq(instance.get_s2(), sixtyfps::SharedString("10hello5.1")); | ||
instance.set_a(42); | ||
assert_eq(instance.get_s1(), sixtyfps::SharedString("hello4242")); | ||
instance.emit_foo(); | ||
assert_eq(instance.get_s3(), sixtyfps::SharedString("x42x42")); | ||
assert_eq(instance.get_s4(), sixtyfps::SharedString("ayoxxx")); | ||
``` | ||
|
||
|
||
```rust | ||
let instance = TestCase::new(); | ||
let instance = instance.as_ref(); | ||
assert_eq!(instance.get_s1(), sixtyfps::SharedString::from("hello1212")); | ||
assert_eq!(instance.get_s2(), sixtyfps::SharedString::from("10hello5.1")); | ||
instance.set_a(42); | ||
assert_eq!(instance.get_s1(), sixtyfps::SharedString::from("hello4242")); | ||
instance.emit_foo(); | ||
assert_eq!(instance.get_s3(), sixtyfps::SharedString::from("x42x42")); | ||
assert_eq!(instance.get_s4(), sixtyfps::SharedString::from("ayoxxx")); | ||
``` | ||
|
||
```js | ||
var instance = new sixtyfps.TestCase({}); | ||
assert.equal(instance.s1, "hello1212"); | ||
assert.equal(instance.s2, "10hello5.1"); | ||
instance.a = 42; | ||
assert.equal(instance.s1, "hello4242"); | ||
instance.foo(); | ||
assert.equal(instance.s3, "x42x42"); | ||
assert.equal(instance.s4, "ayoxxx"); | ||
``` | ||
*/ |