From b4983c9af28228a7a1a07186c3ad75992efa8f1d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 22 Feb 2024 16:52:38 +0100 Subject: [PATCH] Ignore the SpinBox test from the widget style tests with Qt The test requires the spinbox to be editable, which isn't implemented for the Qt style yet. --- tests/cases/widgets/spinbox_basic.slint | 3 +++ tests/driver/driverlib/lib.rs | 24 +++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/tests/cases/widgets/spinbox_basic.slint b/tests/cases/widgets/spinbox_basic.slint index 2ba880a3168..16393505e32 100644 --- a/tests/cases/widgets/spinbox_basic.slint +++ b/tests/cases/widgets/spinbox_basic.slint @@ -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; diff --git a/tests/driver/driverlib/lib.rs b/tests/driver/driverlib/lib.rs index bee12c1db6d..262ed194995 100644 --- a/tests/driver/driverlib/lib.rs +++ b/tests/driver/driverlib/lib.rs @@ -67,9 +67,27 @@ pub fn collect_test_cases(sub_folders: &str) -> std::io::Result> { } 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::>(); + + all_styles + .iter() + .filter(|available_style| { + !style_ignores + .iter() + .any(|ignored_style| *available_style == ignored_style) + }) + .cloned() + .collect::>() + } 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) },