Skip to content

Commit

Permalink
Ignore the SpinBox test from the widget style tests with Qt
Browse files Browse the repository at this point in the history
The test requires the spinbox to be editable, which isn't implemented for the Qt style yet.
  • Loading branch information
tronical committed Feb 23, 2024
1 parent d4a6c57 commit b4983c9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
3 changes: 3 additions & 0 deletions tests/cases/widgets/spinbox_basic.slint
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial


// FIXME: Ignore the SpinBox test with the Qt style because it doesn't support editing
//ignore: style-qt

import { SpinBox } from "std-widgets.slint";
export component TestCase inherits Window {
width: 100px;
Expand Down
24 changes: 21 additions & 3 deletions tests/driver/driverlib/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,27 @@ pub fn collect_test_cases(sub_folders: &str) -> std::io::Result<Vec<TestCase>> {
}
if let Some(ext) = absolute_path.extension() {
if ext == "60" || ext == "slint" {
let styles_to_test: &[&'static str] =
if relative_path.starts_with("widgets") { &all_styles } else { &[""] };
results.extend(styles_to_test.iter().map(|style| TestCase {
let styles_to_test: Vec<&'static str> = if relative_path.starts_with("widgets") {
let style_ignores =
extract_ignores(&std::fs::read_to_string(&absolute_path).unwrap())
.filter_map(|ignore| {
ignore.strip_prefix("style-").map(ToString::to_string)
})
.collect::<Vec<_>>();

all_styles
.iter()
.filter(|available_style| {
!style_ignores
.iter()
.any(|ignored_style| *available_style == ignored_style)
})
.cloned()
.collect::<Vec<_>>()
} else {
vec![""]
};
results.extend(styles_to_test.into_iter().map(|style| TestCase {
absolute_path: absolute_path.clone(),
relative_path: relative_path.clone(),
requested_style: if style.is_empty() { None } else { Some(style) },
Expand Down

0 comments on commit b4983c9

Please sign in to comment.