slint/tests/driver/interpreter/main.rs
Tobias Hunger 4230ac2572
Update copyright information to reflect name change
Also run resue over the codebase and fix complaints from that tool.
2022-02-09 10:27:47 +01:00

37 lines
1.4 KiB
Rust

// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
#[cfg(test)]
mod interpreter;
include!(env!("TEST_FUNCTIONS"));
macro_rules! test_example {
($id:ident, $path:literal) => {
#[test]
fn $id() {
let relative_path = std::path::PathBuf::from(concat!("../../../examples/", $path));
let mut absolute_path =
std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join(&relative_path);
if !absolute_path.exists() {
// Try with .60 instead (for the updater_test)
let legacy = absolute_path.to_string_lossy().replace(".slint", ".60");
if std::path::Path::new(&legacy).exists() {
absolute_path = legacy.into();
}
}
interpreter::test(&test_driver_lib::TestCase { absolute_path, relative_path }).unwrap();
}
};
}
test_example!(example_printerdemo, "printerdemo/ui/printerdemo.slint");
test_example!(example_printerdemo_old, "printerdemo_old/ui/printerdemo.slint");
test_example!(example_memory, "memory/memory.slint");
test_example!(example_slide_puzzle, "slide_puzzle/slide_puzzle.slint");
test_example!(example_todo, "todo/ui/todo.slint");
test_example!(example_gallery, "gallery/gallery.slint");
fn main() {
println!("Nothing to see here, please run me through cargo test :)");
}