From e9208ab85cf72c7dd396c72168e883e7f16471d7 Mon Sep 17 00:00:00 2001 From: aschumann-virtualcable Date: Tue, 10 Nov 2026 17:49:04 +0100 Subject: [PATCH 1/3] feat(config): show the AboutSlint attribution in the unmanaged config and gui-helper GUIs --- crates/config-unmanaged/src/config.slint | 13 +++++++++++- crates/gui-helper/src/gui.slint | 27 +++++++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/crates/config-unmanaged/src/config.slint b/crates/config-unmanaged/src/config.slint index ac334bc..4c9c32b 100644 --- a/crates/config-unmanaged/src/config.slint +++ b/crates/config-unmanaged/src/config.slint @@ -1,4 +1,4 @@ -import { Button, LineEdit, ComboBox, GroupBox, VerticalBox, HorizontalBox, TabWidget, TextEdit } from "std-widgets.slint"; +import { Button, LineEdit, ComboBox, GroupBox, VerticalBox, HorizontalBox, TabWidget, TextEdit, AboutSlint } from "std-widgets.slint"; export component AppWindow inherits Window { title: "UDS Actor Unmanaged Configuration"; @@ -153,6 +153,17 @@ export component AppWindow inherits Window { } } } + // The Slint royalty-free license requires visible attribution in the + // application UI (AboutSlint widget, license §2a). + Tab { + title: "About"; + VerticalLayout { + alignment: center; + AboutSlint { + width: 100%; + } + } + } } Text { diff --git a/crates/gui-helper/src/gui.slint b/crates/gui-helper/src/gui.slint index 52093c4..4a9daa9 100644 --- a/crates/gui-helper/src/gui.slint +++ b/crates/gui-helper/src/gui.slint @@ -1,13 +1,14 @@ -import { Button, VerticalBox } from "std-widgets.slint"; +import { Button, VerticalBox, HorizontalBox, AboutSlint } from "std-widgets.slint"; export component AppWindow inherits Window { title: root.title_text; min-width: 400px; min-height: 150px; - + in-out property title_text: "Message"; in-out property message_text: ""; - + property show_about: false; + callback ok_clicked(); VerticalBox { @@ -31,5 +32,25 @@ export component AppWindow inherits Window { clicked => { root.ok_clicked(); } } } + + // The Slint royalty-free license requires visible attribution in the + // application UI (AboutSlint widget in a dialog reachable from the + // top level, license §2a). This helper has no navigation, so the + // attribution shows in a toggleable section. + Text { + text: "About"; + color: #0055aa; + font-size: 11px; + horizontal-alignment: center; + + TouchArea { + width: 80px; + height: self.preferred-height; + clicked => { root.show_about = !root.show_about; } + } + } + if root.show_about: AboutSlint { + height: 120px; + } } } From 855ce2ba93c320aec0d34d903d85b73906b1dc52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janier=20Rodr=C3=ADguez?= Date: Tue, 10 Nov 2026 18:49:57 +0100 Subject: [PATCH 2/3] fix(gui-helper): make the About link clickable and test the AboutSlint attribution The About TouchArea used `height: self.preferred-height` with no children, which resolves to 0, so the link could never be clicked and AboutSlint was never shown. Drop the height so it fills the row. Add i-slint-backend-testing tests for gui-helper (link toggles AboutSlint) and config-unmanaged (About tab shows AboutSlint). Element lookup by id and type needs Slint debug info, so build.rs enables it for debug builds only. Also drop the leftover attribution comments in both .slint files and the whitespace-only hunks. --- Cargo.lock | 2 ++ Cargo.toml | 1 + crates/config-unmanaged/Cargo.toml | 3 +++ crates/config-unmanaged/build.rs | 5 ++++- crates/config-unmanaged/src/config.slint | 2 -- crates/config-unmanaged/src/main.rs | 27 ++++++++++++++++++++++++ crates/gui-helper/Cargo.toml | 3 +++ crates/gui-helper/build.rs | 5 ++++- crates/gui-helper/src/gui.slint | 13 ++++-------- crates/gui-helper/src/main.rs | 24 +++++++++++++++++++++ 10 files changed, 72 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d82b53..24770d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1971,6 +1971,7 @@ name = "gui-helper" version = "0.1.0" dependencies = [ "builder", + "i-slint-backend-testing", "slint", "slint-build", "tokio", @@ -6138,6 +6139,7 @@ version = "5.0.0" dependencies = [ "anyhow", "builder", + "i-slint-backend-testing", "reqwest", "rfd", "shared", diff --git a/Cargo.toml b/Cargo.toml index d073f50..85de08a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -108,6 +108,7 @@ socket2 = "0.6" # To disable dual stack on listening, make IPv4 and IPv6 listen # GUI slint = { version = "1.17", default-features = false, features=["compat-1-2", "log", "backend-winit", "renderer-winit-software"] } slint-build = "1.18.0" +i-slint-backend-testing = "1.18.1" rfd = "0.17" # Web services tokio-tungstenite = { version = "0.30", features = [ diff --git a/crates/config-unmanaged/Cargo.toml b/crates/config-unmanaged/Cargo.toml index f6bfa3a..68e3f61 100644 --- a/crates/config-unmanaged/Cargo.toml +++ b/crates/config-unmanaged/Cargo.toml @@ -17,6 +17,9 @@ rfd = { workspace = true } reqwest = { workspace = true } tokio = { workspace = true } +[dev-dependencies] +i-slint-backend-testing = { workspace = true } + [build-dependencies] builder = { path = "../builder" } slint-build = { workspace = true } diff --git a/crates/config-unmanaged/build.rs b/crates/config-unmanaged/build.rs index 49e2276..1e2b580 100644 --- a/crates/config-unmanaged/build.rs +++ b/crates/config-unmanaged/build.rs @@ -27,7 +27,10 @@ Author: Adolfo Gómez, dkmaster at dkmon dot com */ fn main() { - slint_build::compile("src/config.slint").unwrap(); + // Element lookup by type in i-slint-backend-testing needs the debug info. + let is_debug_build = std::env::var("PROFILE").as_deref() == Ok("debug"); + let config = slint_build::CompilerConfiguration::new().with_debug_info(is_debug_build); + slint_build::compile_with_config("src/config.slint", config).unwrap(); #[cfg(windows)] builder::build_windows(builder::BuildInfo { product_name: "UDS Actor Config Unmanaged", diff --git a/crates/config-unmanaged/src/config.slint b/crates/config-unmanaged/src/config.slint index 4c9c32b..951f137 100644 --- a/crates/config-unmanaged/src/config.slint +++ b/crates/config-unmanaged/src/config.slint @@ -153,8 +153,6 @@ export component AppWindow inherits Window { } } } - // The Slint royalty-free license requires visible attribution in the - // application UI (AboutSlint widget, license §2a). Tab { title: "About"; VerticalLayout { diff --git a/crates/config-unmanaged/src/main.rs b/crates/config-unmanaged/src/main.rs index 4489b27..f1c36a2 100644 --- a/crates/config-unmanaged/src/main.rs +++ b/crates/config-unmanaged/src/main.rs @@ -23,6 +23,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /*! Author: Adolfo Gómez, dkmaster at dkmon dot com +Author: Janier Rodríguez, jrodriguez at virtualcable dot es */ #![cfg_attr(not(test), windows_subsystem = "windows")] @@ -98,3 +99,29 @@ async fn main() { ui.run().unwrap(); } + +#[cfg(test)] +mod tests { + use super::*; + use i_slint_backend_testing::{AccessibleRole, ElementHandle}; + use slint::platform::PointerEventButton; + + fn about_widget_count(window: &AppWindow) -> usize { + ElementHandle::find_by_element_type_name(window, "AboutSlint").count() + } + + #[test] + fn about_tab_shows_slint_attribution() { + i_slint_backend_testing::init_no_event_loop(); + let window = AppWindow::new().unwrap(); + window.show().unwrap(); + let about_tab = ElementHandle::find_by_accessible_label(&window, "About") + .find(|element| element.accessible_role() == Some(AccessibleRole::Tab)) + .expect("About tab not found"); + assert_eq!(about_widget_count(&window), 0); + + about_tab.mock_single_click(PointerEventButton::Left); + + assert_eq!(about_widget_count(&window), 1); + } +} diff --git a/crates/gui-helper/Cargo.toml b/crates/gui-helper/Cargo.toml index 0e596b8..1197ee4 100644 --- a/crates/gui-helper/Cargo.toml +++ b/crates/gui-helper/Cargo.toml @@ -11,6 +11,9 @@ license = "BSD-3-Clause" slint = { workspace = true } tokio = { workspace = true } +[dev-dependencies] +i-slint-backend-testing = { workspace = true } + [build-dependencies] builder = { path = "../builder" } slint-build = { workspace = true } diff --git a/crates/gui-helper/build.rs b/crates/gui-helper/build.rs index 32714cc..6a6d4de 100644 --- a/crates/gui-helper/build.rs +++ b/crates/gui-helper/build.rs @@ -27,7 +27,10 @@ Author: Adolfo Gómez, dkmaster at dkmon dot com */ fn main() { - slint_build::compile("src/gui.slint").unwrap(); + // Element lookup by id in i-slint-backend-testing needs the debug info. + let is_debug_build = std::env::var("PROFILE").as_deref() == Ok("debug"); + let config = slint_build::CompilerConfiguration::new().with_debug_info(is_debug_build); + slint_build::compile_with_config("src/gui.slint", config).unwrap(); #[cfg(windows)] builder::build_windows(builder::BuildInfo { product_name: "UDS Actor Client", diff --git a/crates/gui-helper/src/gui.slint b/crates/gui-helper/src/gui.slint index 4a9daa9..126e5f5 100644 --- a/crates/gui-helper/src/gui.slint +++ b/crates/gui-helper/src/gui.slint @@ -1,14 +1,14 @@ -import { Button, VerticalBox, HorizontalBox, AboutSlint } from "std-widgets.slint"; +import { Button, VerticalBox, AboutSlint } from "std-widgets.slint"; export component AppWindow inherits Window { title: root.title_text; min-width: 400px; min-height: 150px; - + in-out property title_text: "Message"; in-out property message_text: ""; property show_about: false; - + callback ok_clicked(); VerticalBox { @@ -33,19 +33,14 @@ export component AppWindow inherits Window { } } - // The Slint royalty-free license requires visible attribution in the - // application UI (AboutSlint widget in a dialog reachable from the - // top level, license §2a). This helper has no navigation, so the - // attribution shows in a toggleable section. Text { text: "About"; color: #0055aa; font-size: 11px; horizontal-alignment: center; - TouchArea { + about-link := TouchArea { width: 80px; - height: self.preferred-height; clicked => { root.show_about = !root.show_about; } } } diff --git a/crates/gui-helper/src/main.rs b/crates/gui-helper/src/main.rs index 0d9d37c..fa5adf0 100644 --- a/crates/gui-helper/src/main.rs +++ b/crates/gui-helper/src/main.rs @@ -23,6 +23,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /*! Author: Adolfo Gómez, dkmaster at dkmon dot com +Author: Janier Rodríguez, jrodriguez at virtualcable dot es */ #![cfg_attr(not(test), windows_subsystem = "windows")] @@ -107,6 +108,29 @@ fn show_messagebox(title: &str, message: &str) { #[cfg(test)] mod tests { use super::*; + use i_slint_backend_testing::ElementHandle; + use slint::platform::PointerEventButton; + + fn about_widget_count(window: &AppWindow) -> usize { + ElementHandle::find_by_element_type_name(window, "AboutSlint").count() + } + + #[test] + fn about_link_toggles_slint_attribution() { + i_slint_backend_testing::init_no_event_loop(); + let window = AppWindow::new().unwrap(); + window.show().unwrap(); + let about_link = ElementHandle::find_by_element_id(&window, "AppWindow::about-link") + .next() + .expect("About link not found"); + assert_eq!(about_widget_count(&window), 0); + + about_link.mock_single_click(PointerEventButton::Left); + assert_eq!(about_widget_count(&window), 1); + + about_link.mock_single_click(PointerEventButton::Left); + assert_eq!(about_widget_count(&window), 0); + } #[test] #[ignore = "Requires GUI interaction"] From baad5c1a1b568b1d9b2e6230265468f54ae82364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janier=20Rodr=C3=ADguez?= Date: Tue, 10 Nov 2026 19:18:31 +0100 Subject: [PATCH 3/3] test(config): check About tab shows Slint attribution --- Cargo.lock | 1 + crates/config/Cargo.toml | 3 +++ crates/config/build.rs | 5 ++++- crates/config/src/main.rs | 27 +++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 24770d0..a9958d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6104,6 +6104,7 @@ version = "0.1.0" dependencies = [ "anyhow", "builder", + "i-slint-backend-testing", "reqwest", "rfd", "shared", diff --git a/crates/config/Cargo.toml b/crates/config/Cargo.toml index 0df044b..87f706a 100644 --- a/crates/config/Cargo.toml +++ b/crates/config/Cargo.toml @@ -17,6 +17,9 @@ rfd = { workspace = true } reqwest = { workspace = true } tokio = { workspace = true } +[dev-dependencies] +i-slint-backend-testing = { workspace = true } + [build-dependencies] builder = { path = "../builder" } slint-build = { workspace = true } diff --git a/crates/config/build.rs b/crates/config/build.rs index a8b67b6..74dfb55 100644 --- a/crates/config/build.rs +++ b/crates/config/build.rs @@ -27,7 +27,10 @@ Author: Adolfo Gómez, dkmaster at dkmon dot com */ fn main() { - slint_build::compile("src/config.slint").unwrap(); + // Element lookup by type in i-slint-backend-testing needs the debug info. + let is_debug_build = std::env::var("PROFILE").as_deref() == Ok("debug"); + let config = slint_build::CompilerConfiguration::new().with_debug_info(is_debug_build); + slint_build::compile_with_config("src/config.slint", config).unwrap(); #[cfg(windows)] builder::build_windows(builder::BuildInfo { product_name: "UDS Actor Config", diff --git a/crates/config/src/main.rs b/crates/config/src/main.rs index 87f28a2..10a96d6 100644 --- a/crates/config/src/main.rs +++ b/crates/config/src/main.rs @@ -23,6 +23,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /*! Author: Adolfo Gómez, dkmaster at dkmon dot com +Author: Janier Rodríguez, jrodriguez at virtualcable dot es */ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] @@ -162,3 +163,29 @@ async fn main() { ui.run().unwrap(); } + +#[cfg(test)] +mod tests { + use super::*; + use i_slint_backend_testing::{AccessibleRole, ElementHandle}; + use slint::platform::PointerEventButton; + + fn about_widget_count(window: &AppWindow) -> usize { + ElementHandle::find_by_element_type_name(window, "AboutSlint").count() + } + + #[test] + fn about_tab_shows_slint_attribution() { + i_slint_backend_testing::init_no_event_loop(); + let window = AppWindow::new().unwrap(); + window.show().unwrap(); + let about_tab = ElementHandle::find_by_accessible_label(&window, "About") + .find(|element| element.accessible_role() == Some(AccessibleRole::Tab)) + .expect("About tab not found"); + assert_eq!(about_widget_count(&window), 0); + + about_tab.mock_single_click(PointerEventButton::Left); + + assert_eq!(about_widget_count(&window), 1); + } +}