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#[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!("../../../", $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, "demos/printerdemo/ui/printerdemo.slint");
34test_example!(example_usecases, "demos/usecases/ui/app.slint");
35test_example!(example_memory, "examples/memory/memory.slint");
36test_example!(example_slide_puzzle, "examples/slide_puzzle/slide_puzzle.slint");
37test_example!(example_todo, "examples/todo/ui/todo.slint");
38test_example!(example_gallery, "examples/gallery/gallery.slint");
39test_example!(example_fancy_demo, "examples/fancy_demo/main.slint");
40test_example!(example_bash_sysinfo, "examples/bash/sysinfo.slint");
41test_example!(example_carousel, "examples/carousel/ui/carousel_demo.slint");
42test_example!(example_iot_dashboard, "examples/iot-dashboard/main.slint");
43test_example!(example_dial, "examples/dial/dial.slint");
44test_example!(example_sprite_sheet, "examples/sprite-sheet/demo.slint");
45test_example!(example_fancy_switches, "examples/fancy-switches/demo.slint");
46test_example!(example_home_automation, "demos/home-automation/ui/demo.slint");
47test_example!(example_energy_monitor, "demos/energy-monitor/ui/desktop_window.slint");
48test_example!(example_weather, "demos/weather-demo/ui/main.slint");
49
50fn main() {
51 println!("Nothing to see here, please run me through cargo test :)");
52}
53