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)]
5mod interpreter;
6
7include!(env!("TEST_FUNCTIONS"));
8
9macro_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
33test_example!(example_printerdemo, "printerdemo/ui/printerdemo.slint");
34test_example!(example_printerdemo_old, "printerdemo_old/ui/printerdemo.slint");
35test_example!(example_memory, "memory/memory.slint");
36test_example!(example_slide_puzzle, "slide_puzzle/slide_puzzle.slint");
37test_example!(example_todo, "todo/ui/todo.slint");
38test_example!(example_gallery, "gallery/gallery.slint");
39test_example!(example_fancy_demo, "fancy_demo/main.slint");
40test_example!(example_bash_sysinfo, "bash/sysinfo.slint");
41test_example!(example_carousel, "carousel/ui/carousel_demo.slint");
42test_example!(example_iot_dashboard, "iot-dashboard/main.slint");
43
44fn main() {
45 println!("Nothing to see here, please run me through cargo test :)");
46}
47