|
| 1 | +// Copyright © SixtyFPS GmbH <[email protected]> |
| 2 | +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 |
| 3 | + |
| 4 | +export component TestCase inherits Window { |
| 5 | + width: 300phx; |
| 6 | + height: 300phx; |
| 7 | + |
| 8 | + empty1 := Rectangle { HorizontalLayout { } } |
| 9 | + empty2 := Rectangle { VerticalLayout { spacing: 80px; padding: 2px; } } |
| 10 | + empty3 := Rectangle { HorizontalLayout { alignment: center; } } |
| 11 | + empty4 := Rectangle { VerticalLayout { alignment: end; padding-left: 10phx; padding-top: 50phx; } } |
| 12 | + empty5 := Rectangle { |
| 13 | + VerticalLayout { |
| 14 | + alignment: end; padding-left: 10phx; padding-top: 50phx; |
| 15 | + for _ in 0 : Text { text: "Hello World!"; } |
| 16 | + } |
| 17 | + } |
| 18 | + empty6 := Rectangle { |
| 19 | + HorizontalLayout { |
| 20 | + if false: Rectangle { background: red; min-height: 10px; min-width: 10px; } |
| 21 | + padding-right: 80phx; padding-bottom: 70phx; |
| 22 | + } |
| 23 | + } |
| 24 | + |
| 25 | + out property <bool> t1: empty1.min-height == 0 && empty1.min-width == 0 && empty1.preferred-height == 0 && empty1.preferred-width == 0 && empty1.max-height > 10000px && empty1.max-width == 0; |
| 26 | + out property <bool> t2: empty2.min-height == 4px && empty2.min-width == 4px && empty2.preferred-height == 4px && empty2.preferred-width == 4px && empty2.max-height == 4px && empty2.max-width > 100000px; |
| 27 | + out property <bool> t3: empty3.min-height == 0 && empty3.min-width == 0 && empty3.preferred-height == 0 && empty3.preferred-width == 0 && empty3.max-height > 10000px && empty3.max-width > 10000px; |
| 28 | + out property <bool> t4: empty4.min-height == 50phx && empty4.min-width == 10phx && empty4.preferred-height == 50phx && empty4.preferred-width == 10phx && empty4.max-height > 10000px && empty4.max-width > 10000px; |
| 29 | + out property <bool> t5: empty5.min-height == 50phx && empty5.min-width == 10phx && empty5.preferred-height == 50phx && empty5.preferred-width == 10phx && empty5.max-height > 10000px && empty5.max-width > 10000px; |
| 30 | + out property <bool> t6: empty6.min-height == 70phx && empty6.min-width == 80phx && empty6.preferred-height == 70phx && empty6.preferred-width == 80phx && empty6.max-height > 10000px && empty6.max-width == 80phx; |
| 31 | + out property <bool> test: t1 && t2 && t3 && t4 && t5 && t6; |
| 32 | +} |
| 33 | + |
| 34 | +/* |
| 35 | +
|
| 36 | +```cpp |
| 37 | +auto handle = TestCase::create(); |
| 38 | +const TestCase &instance = *handle; |
| 39 | +assert(instance.get_test()); |
| 40 | +``` |
| 41 | +
|
| 42 | +
|
| 43 | +```rust |
| 44 | +let instance = TestCase::new().unwrap(); |
| 45 | +assert!(instance.get_test()); |
| 46 | +``` |
| 47 | +
|
| 48 | +```js |
| 49 | +var instance = new slint.TestCase(); |
| 50 | +assert(instance.test); |
| 51 | +``` |
| 52 | +
|
| 53 | +*/ |
0 commit comments