slint/tests/cases/properties/dashes.slint
2023-07-10 10:12:11 +02:00

40 lines
1.1 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
Test-Case := Rectangle {
property<length> property-x1: xxx-foo.border-width;
property<length> property-x2: xxx_foo.border_width;
xxx-foo := Rectangle {
border-width: 42phx;
}
property<int> hello-42: 42;
property<int> hello--world: -hello-42 - 2; // -42 - 2 = -44
property<int> this--has-6-slashes--: 42-hello--world; // 42 - -44 = 86
}
/*
```cpp
auto handle = Test_Case::create();
const Test_Case &instance = *handle;
assert_eq(instance.get_property_x1(), 42);
assert_eq(instance.get_property_x2(), 42);
assert_eq(instance.get_this__has_6_slashes__(), 86);
```
```rust
let instance = Test_Case::new().unwrap();
assert_eq!(instance.get_property_x1(), 42.);
assert_eq!(instance.get_property_x2(), 42.);
assert_eq!(instance.get_this__has_6_slashes__(), 86);
```
```js
var instance = new slint.Test_Case({});
assert.equal(instance.property_x1, 42);
assert.equal(instance.property_x2, 42);
assert.equal(instance.this__has_6_slashes__, 86);
```
*/