1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
3
4//include_path: ../../../examples/printerdemo/ui/images/
5
6TestCase := Rectangle {
7 property <image> img1: @image-url("cat.jpg");
8 property <image> img2: @image-url("../images/cat.jpg");
9}
10
11/*
12```rust
13let instance = TestCase::new().unwrap();
14
15use slint::private_unstable_api::re_exports::{ImageInner, ImageCacheKey};
16
17let img1 = instance.get_img1();
18let img2 = instance.get_img2();
19let img1_inner: &ImageInner = (&img1).into();
20let img2_inner: &ImageInner = (&img2).into();
21
22match (img1_inner, img2_inner) {
23 (ImageInner::EmbeddedImage { cache_key: ImageCacheKey::Path(img1_path), .. }, ImageInner::EmbeddedImage { cache_key: ImageCacheKey::Path(img2_path), .. }) => {
24 assert_eq!(img1_path, img2_path)
25 },
26 (ImageInner::EmbeddedImage { cache_key: ImageCacheKey::EmbeddedData(img1_addr), .. }, ImageInner::EmbeddedImage { cache_key: ImageCacheKey::EmbeddedData(img2_addr), .. }) => {
27 assert_eq!(img1_addr, img2_addr)
28 },
29 _ => todo!("adjust this test to new image comparison"),
30}
31```
32*/
33