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