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 | #[cfg (test)] |
5 | mod interpreter; |
6 | |
7 | include!(env!("TEST_FUNCTIONS" )); |
8 | |
9 | macro_rules! test_example { |
10 | ($id:ident, $path:literal) => { |
11 | #[test] |
12 | fn $id() { |
13 | let relative_path = std::path::PathBuf::from(concat!("../../../examples/" , $path)); |
14 | let mut absolute_path = |
15 | std::path::Path::new(env!("CARGO_MANIFEST_DIR" )).join(&relative_path); |
16 | if !absolute_path.exists() { |
17 | // Try with .60 instead (for the updater_test) |
18 | let legacy = absolute_path.to_string_lossy().replace(".slint" , ".60" ); |
19 | if std::path::Path::new(&legacy).exists() { |
20 | absolute_path = legacy.into(); |
21 | } |
22 | } |
23 | interpreter::test(&test_driver_lib::TestCase { |
24 | absolute_path, |
25 | relative_path, |
26 | requested_style: None, |
27 | }) |
28 | .unwrap(); |
29 | } |
30 | }; |
31 | } |
32 | |
33 | test_example!(example_printerdemo, "printerdemo/ui/printerdemo.slint" ); |
34 | test_example!(example_printerdemo_old, "printerdemo_old/ui/printerdemo.slint" ); |
35 | test_example!(example_memory, "memory/memory.slint" ); |
36 | test_example!(example_slide_puzzle, "slide_puzzle/slide_puzzle.slint" ); |
37 | test_example!(example_todo, "todo/ui/todo.slint" ); |
38 | test_example!(example_gallery, "gallery/gallery.slint" ); |
39 | test_example!(example_fancy_demo, "fancy_demo/main.slint" ); |
40 | test_example!(example_bash_sysinfo, "bash/sysinfo.slint" ); |
41 | test_example!(example_carousel, "carousel/ui/carousel_demo.slint" ); |
42 | test_example!(example_iot_dashboard, "iot-dashboard/main.slint" ); |
43 | |
44 | fn main() { |
45 | println!("Nothing to see here, please run me through cargo test :)" ); |
46 | } |
47 | |