slint/tests/cases/expr/tan.slint
2023-07-10 10:12:11 +02:00

31 lines
957 B
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
TestCase := Rectangle {
property<float> t1: tan(0);
property<float> t2: tan(45deg);
property<float> t3: tan(75deg);
}
/*
```cpp
auto handle = TestCase::create();
const TestCase &instance = *handle;
assert(std::abs(instance.get_t1()) < 0.0001);
assert(std::abs(instance.get_t2() - 1.0) < 0.0001);
assert(std::abs(instance.get_t3() - (2.0 + std::sqrt(3.0))) < 0.0001);
```
```rust
let instance = TestCase::new().unwrap();
assert!(instance.get_t1().abs() < 0.0001);
assert!((instance.get_t2() - 1.0).abs() < 0.0001);
assert!((instance.get_t3() - (2.0 + 3.0_f32.sqrt())).abs() < 0.0001);
```
```js
var instance = new slint.TestCase({});
assert(Math.abs(instance.t1) < 0.0001);
assert(Math.abs(instance.t2 - 1) < 0.0001);
assert(Math.abs(instance.t3 - (2 + Math.sqrt(3))) < 0.0001);
```
*/