From feeb9378cc5916d756e848d1043c03c8c2437299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Thu, 20 Nov 2025 16:19:50 +0100 Subject: [PATCH 1/2] test: Add a minimal test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This ensures that at least some things work Signed-off-by: Guido Günther Part-of: --- tests/api.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/api.rs diff --git a/tests/api.rs b/tests/api.rs new file mode 100644 index 0000000..39f4b48 --- /dev/null +++ b/tests/api.rs @@ -0,0 +1,23 @@ +use gtk::prelude::*; +use gtk::{gio, glib}; + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_new() { + assert_eq!(gtk::init().is_ok(), true); + pfs::init::init(); + + let file_selector = glib::Object::builder::() + .property("accept_label", "Done") + .property("title", "Select a File") + .property("current-folder", gio::File::for_path("/tmp")) + .build(); + + assert_eq!(file_selector.selected_choices().is_none(), true); + assert_eq!(file_selector.current_folder().is_some(), true); + assert_eq!(file_selector.current_folder().unwrap().uri(), "file:///tmp"); + } +} -- GitLab From eca05717e411b92cd70020ecb71aff5afa1d23ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Thu, 20 Nov 2025 18:18:00 +0100 Subject: [PATCH 2/2] ci: Run tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This ensures we can create the dialog and don't throw any criticals. Signed-off-by: Guido Günther Part-of: --- .gitlab-ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b685ee6..8126d21 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,7 +45,7 @@ variables: DEPS: | git build-essential ca-certificates meson curl rustup meson libgtk-4-dev libadwaita-1-dev libglib2.0-dev gettext - patchelf desktop-file-utils + patchelf desktop-file-utils xauth xvfb GIT_SUBMODULE_STRATEGY: recursive .common_before_script: &common_before_script @@ -74,6 +74,13 @@ build-lib: - meson install -C _build - meson test -C _build +test: + stage: test+docs + needs: [build] + <<: *common_before_script + script: + - CARGO_HOME=_build/cargo PFS_RESOURCE_DIR=$PWD/_build/src xvfb-run cargo test + check-po: stage: test+docs extends: .phosh-check-po -- GitLab