1 | #![allow (deprecated)]slint::slint!{#[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/types/../../../examples/printerdemo/ui/images/"# ] |
2 | #[include_path=r#"/input/slint/tests/driver/driverlib/../../cases/types"# ] |
3 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
4 | // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial |
5 | |
6 | //include_path: ../../../examples/printerdemo/ui/images/ |
7 | TestCase := Rectangle { |
8 | property <image> empty_image: @image-url("" ); |
9 | property <image> cat: @image-url("cat.jpg" ); |
10 | |
11 | property <int> empty_width: empty_image.width; |
12 | property <int> empty_height: empty_image.height; |
13 | property <int> cat_width: cat.width; |
14 | property <int> cat_height: cat.height; |
15 | |
16 | property <bool> test: empty_width == 0 && empty_height == 0 && cat_width == 320 && cat_height == 480; |
17 | } |
18 | |
19 | /* |
20 | |
21 | ```cpp |
22 | auto handle = TestCase::create(); |
23 | const TestCase &instance = *handle; |
24 | assert_eq(instance.get_empty_width(), 0); |
25 | assert_eq(instance.get_empty_height(), 0); |
26 | assert_eq(instance.get_cat_width(), 320); |
27 | assert_eq(instance.get_cat_height(), 480); |
28 | ``` |
29 | |
30 | |
31 | ```rust |
32 | let instance = TestCase::new().unwrap(); |
33 | assert_eq!(instance.get_empty_width(), 0); |
34 | assert_eq!(instance.get_empty_height(), 0); |
35 | assert_eq!(instance.get_cat_width(), 320); |
36 | assert_eq!(instance.get_cat_height(), 480); |
37 | ``` |
38 | |
39 | ```js |
40 | var instance = new slint.TestCase(); |
41 | assert.equal(instance.empty_width, 0); |
42 | assert.equal(instance.empty_height, 0); |
43 | assert.equal(instance.cat_width, 320); |
44 | assert.equal(instance.cat_height, 480); |
45 | ``` |
46 | |
47 | */ |
48 | } |
49 | |
50 | #[test ] fn t_0() -> std::result::Result<(), std::boxed::Box<dyn std::error::Error>> { |
51 | use i_slint_backend_testing as slint_testing; |
52 | slint_testing::init(); |
53 | let instance = TestCase::new().unwrap(); |
54 | assert_eq!(instance.get_empty_width(), 0); |
55 | assert_eq!(instance.get_empty_height(), 0); |
56 | assert_eq!(instance.get_cat_width(), 320); |
57 | assert_eq!(instance.get_cat_height(), 480); |
58 | Ok(()) |
59 | } |