| 1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
| 2 | // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 |
| 3 | |
| 4 | TestCase := Rectangle { |
| 5 | width: 300phx; |
| 6 | height: 300phx; |
| 7 | |
| 8 | GridLayout { |
| 9 | padding: 0phx; |
| 10 | spacing: 0phx; |
| 11 | |
| 12 | Row { |
| 13 | Rectangle { |
| 14 | background: orange; |
| 15 | } |
| 16 | } |
| 17 | Row { |
| 18 | rect1 := Rectangle { |
| 19 | background: red; |
| 20 | GridLayout { |
| 21 | padding: 0phx; |
| 22 | spacing: 10px; |
| 23 | Row { |
| 24 | rect2 := Rectangle { |
| 25 | background: green; |
| 26 | max_width: 50phx; |
| 27 | max_height: 50phx; |
| 28 | } |
| 29 | rect3 := Rectangle { |
| 30 | background: black; |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | rect4 := Rectangle { |
| 36 | background: blue; |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | property <bool> rect1_pos_ok: rect1.x == 0phx && rect1.y == 250phx && rect1.width == 155phx && rect1.height == 50phx; |
| 42 | property <bool> rect2_pos_ok: rect2.x == 0phx && rect2.y == 0phx && rect2.width == 50phx && rect2.height == 50phx; |
| 43 | property <bool> rect3_pos_ok: rect3.x == 60phx && rect3.y == 0phx && rect3.width == 95phx && rect3.height == 50phx; |
| 44 | property <bool> rect4_pos_ok: rect4.x == 155phx && rect4.y == 250phx && rect4.width == 145phx && rect4.height == 50phx; |
| 45 | |
| 46 | property <bool> test: rect1_pos_ok && rect2_pos_ok && rect3_pos_ok && rect4_pos_ok; |
| 47 | } |
| 48 | |
| 49 | /* |
| 50 | |
| 51 | ```cpp |
| 52 | auto handle = TestCase::create(); |
| 53 | const TestCase &instance = *handle; |
| 54 | assert(instance.get_rect1_pos_ok()); |
| 55 | assert(instance.get_rect2_pos_ok()); |
| 56 | assert(instance.get_rect3_pos_ok()); |
| 57 | assert(instance.get_rect4_pos_ok()); |
| 58 | ``` |
| 59 | |
| 60 | |
| 61 | ```rust |
| 62 | let instance = TestCase::new().unwrap(); |
| 63 | assert!(instance.get_rect1_pos_ok()); |
| 64 | assert!(instance.get_rect2_pos_ok()); |
| 65 | assert!(instance.get_rect3_pos_ok()); |
| 66 | assert!(instance.get_rect4_pos_ok()); |
| 67 | ``` |
| 68 | |
| 69 | */ |
| 70 | |