slint/tests/cases/models/negative_intmodel.slint
Aurindam Jana 3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00

63 lines
1.5 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
TestCase := Rectangle {
width: 100phx;
height: 100phx;
property <int> creation-count: 0;
property <length> test-height: preferred-height;
property <int> repeater-count: -10;
VerticalLayout {
for _ in repeater-count: Rectangle {
preferred-height: 10px;
init => {
creation-count += 1;
}
}
}
}
/*
```cpp
auto handle = TestCase::create();
const TestCase &instance = *handle;
assert_eq(instance.get_creation_count(), 0);
assert_eq(instance.get_test_height(), 0.);
assert_eq(instance.get_creation_count(), 0);
instance.set_repeater_count(2);
assert_eq(instance.get_test_height(), 20.);
assert_eq(instance.get_creation_count(), 2);
```
```rust
let instance = TestCase::new().unwrap();
assert_eq!(instance.get_creation_count(), 0);
assert_eq!(instance.get_test_height(), 0.);
assert_eq!(instance.get_creation_count(), 0);
instance.set_repeater_count(2);
assert_eq!(instance.get_test_height(), 20.);
assert_eq!(instance.get_creation_count(), 2);
```
```js
var instance = new slint.TestCase();
assert.equal(instance.creation_count, 0);
assert.equal(instance.test_height, 0.);
assert.equal(instance.creation_count, 0);
instance.repeater_count = 2;
assert.equal(instance.test_height, 20.);
assert.equal(instance.creation_count, 2);
```
*/