mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-22 16:22:17 +00:00

Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
53 lines
1.6 KiB
Text
53 lines
1.6 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
|
|
|
//include_path: ../../helper_components
|
|
|
|
global MyGlobal := {
|
|
property <int> hello: 42;
|
|
}
|
|
|
|
export { MyGlobal }
|
|
export { MyGlobal as GlobalAlias }
|
|
|
|
TestCase := Rectangle {
|
|
property <bool> test_global_prop_value: MyGlobal.hello == 100;
|
|
}
|
|
|
|
/*
|
|
```rust
|
|
let instance = TestCase::new().unwrap();
|
|
assert!(!instance.get_test_global_prop_value());
|
|
assert_eq!(MyGlobal::get(&instance).get_hello(), 42);
|
|
assert_eq!(GlobalAlias::get(&instance).get_hello(), 42);
|
|
instance.global::<MyGlobal<'_>>().set_hello(100);
|
|
assert!(instance.get_test_global_prop_value());
|
|
assert_eq!(MyGlobal::get(&instance).get_hello(), 100);
|
|
assert_eq!(GlobalAlias::get(&instance).get_hello(), 100);
|
|
```
|
|
|
|
```cpp
|
|
auto handle = TestCase::create();
|
|
const TestCase &instance = *handle;
|
|
assert(!instance.get_test_global_prop_value());
|
|
assert_eq(instance.global<MyGlobal>().get_hello(), 42);
|
|
assert_eq(instance.global<GlobalAlias>().get_hello(), 42);
|
|
instance.global<MyGlobal>().set_hello(100);
|
|
assert(instance.get_test_global_prop_value());
|
|
assert_eq(instance.global<MyGlobal>().get_hello(), 100);
|
|
assert_eq(instance.global<GlobalAlias>().get_hello(), 100);
|
|
|
|
```
|
|
|
|
```js
|
|
let instance = new slint.TestCase({});
|
|
assert(!instance.test_global_prop_value);
|
|
assert.equal(instance.MyGlobal.hello, 42);;
|
|
assert.equal(instance.GlobalAlias.hello, 42);;
|
|
instance.MyGlobal.hello = 100;
|
|
assert(instance.test_global_prop_value);
|
|
assert.equal(instance.MyGlobal.hello, 100);
|
|
assert.equal(instance.GlobalAlias.hello, 100);
|
|
```
|
|
|
|
*/
|