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.
Math postfix member functions on numbers
Closes slint-ui#5328
- Loading branch information
Showing
12 changed files
with
226 additions
and
25 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
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
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,35 +1,38 @@ | ||
// 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 { | ||
property <int> a; | ||
property <float> t1: max(41, 12, min(100, 12), max(-10000, 0+98.5), -4) + min(a, 0.5); | ||
property <bool> t2: round(10/4) == 3 && floor(10/4) == 2 && ceil(10/4) == 3; | ||
component TestCase inherits Window { | ||
in property <int> a; | ||
out property <float> t1: max(41, 12, min(100, 12), max(-10000, 0+98.5), -4) + min(a, 0.5); | ||
out property <bool> t2: round(10/4) == 3 && floor(10/4) == 2 && ceil(10/4) == 3; | ||
|
||
r := Rectangle { | ||
property <int> max: 42; | ||
property <int> xx: Math.max(1, 2, 3) + max; | ||
} | ||
property <bool> test: t2 && r.xx == 42 + 3; | ||
out property <bool> test: t2 && r.xx == 42 + 3 && 88px.max(5px, 45px) == 88px && 88ms.min(5ms, 45ms) == 5ms; | ||
} | ||
/* | ||
```cpp | ||
auto handle = TestCase::create(); | ||
const TestCase &instance = *handle; | ||
assert_eq(instance.get_t1(), 98.5); | ||
assert_eq(instance.get_t2(), true); | ||
assert(instance.get_test()); | ||
``` | ||
```rust | ||
let instance = TestCase::new().unwrap(); | ||
assert_eq!(instance.get_t1(), 98.5); | ||
assert_eq!(instance.get_t2(), true); | ||
assert!(instance.get_test()); | ||
``` | ||
```js | ||
var instance = new slint.TestCase({}); | ||
assert.equal(instance.t1, 98.5); | ||
assert(instance.t2); | ||
assert(instance.test); | ||
``` | ||
*/ |
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
Oops, something went wrong.