mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +00:00

Always use a Pin<Rc> for the component. (This is required to support repeater within repeater as well anyway) Do not use the context within the binding. We can get along by simply capturing a weak pointer to the component
38 lines
1.1 KiB
Text
38 lines
1.1 KiB
Text
TestCase := Rectangle {
|
|
property<int32> a;
|
|
property<int32> t1: 4 + 3 * 2 + 2 - 50 - 2;
|
|
property<int32> t2: 500 / 2 * 30 - 1;
|
|
property<int32> t3: a - (3 + 2 * (a + 2));
|
|
property<int32> t4: 3 + - 5 - 8 - -9 * --- 120;
|
|
|
|
}
|
|
/*
|
|
```cpp
|
|
TestCase instance;
|
|
assert(instance.get_t1() == 4 + 3 * 2 + 2 - 50 - 2);
|
|
assert(instance.get_t2() == 500 / 2 * 30 - 1);
|
|
instance.set_a(42);
|
|
assert(instance.get_t3() == 42 - (3 + 2 * (42 + 2)));
|
|
assert(instance.get_t4() == 3 + - 5 - 8 - -9 * - - - 120);
|
|
```
|
|
|
|
|
|
```rust
|
|
let instance = TestCase::new();
|
|
let instance = instance.as_ref();
|
|
assert_eq!(instance.get_t1(), 4 + 3 * 2 + 2 - 50 - 2);
|
|
assert_eq!(instance.get_t2(), 500 / 2 * 30 - 1);
|
|
instance.set_a(42);
|
|
assert_eq!(instance.get_t3(), 42 - (3 + 2 * (42 + 2)));
|
|
assert_eq!(instance.get_t4(), 3 + - 5 - 8 - -9 * --- 120);
|
|
```
|
|
|
|
```js
|
|
var instance = new sixtyfps.TestCase({});
|
|
assert.equal(instance.t1, 4 + 3 * 2 + 2 - 50 - 2);
|
|
assert.equal(instance.t2, 500 / 2 * 30 - 1);
|
|
instance.a = 42;
|
|
assert.equal(instance.t3, 42 - (3 + 2 * (42 + 2)));
|
|
assert.equal(instance.t4, 3 + - 5 - 8 - -9 * - - - 120);
|
|
```
|
|
*/
|