| 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 | component Text2 inherits Text {} |
| 5 | |
| 6 | export component TestCase inherits Window { |
| 7 | width: 100phx; |
| 8 | height: 100phx; |
| 9 | simple-text := Text { } |
| 10 | |
| 11 | complex-text := Text { |
| 12 | stroke-width: 2px; |
| 13 | } |
| 14 | |
| 15 | inherit-text := Text2 {} |
| 16 | |
| 17 | text-input := TextInput { } |
| 18 | |
| 19 | out property <bool> test: simple-text.font-metrics.ascent == complex-text.font-metrics.ascent && complex-text.font-metrics.ascent == text-input.font-metrics.ascent |
| 20 | && inherit-text.font-metrics.ascent == simple-text.font-metrics.ascent && text-input.font-metrics.ascent == 7px; |
| 21 | } |
| 22 | |
| 23 | /* |
| 24 | ```rust |
| 25 | let instance = TestCase::new().unwrap(); |
| 26 | assert!(instance.get_test()); |
| 27 | ``` |
| 28 | |
| 29 | ```cpp |
| 30 | auto handle = TestCase::create(); |
| 31 | const TestCase &instance = *handle; |
| 32 | assert(instance.get_test()); |
| 33 | ``` |
| 34 | |
| 35 | ```js |
| 36 | let instance = new slint.TestCase({}); |
| 37 | assert(instance.test); |
| 38 | ``` |
| 39 | |
| 40 | */ |
| 41 | |