From 3f8f339a7be547aaf142e053e5beff6b33a7950d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Sat, 16 May 2026 22:43:28 +0200 Subject: [PATCH] cloudcompare.tests: Add VLM screenshot analysis --- nixos/tests/all-tests.nix | 1 + nixos/tests/cloudcompare.nix | 55 ++++++++++++++++++++++++ pkgs/by-name/cl/cloudcompare/package.nix | 3 ++ 3 files changed, 59 insertions(+) create mode 100644 nixos/tests/cloudcompare.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index d5e9eefc83dd..48566863b223 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -364,6 +364,7 @@ in }; cloud-init = runTest ./cloud-init.nix; cloud-init-hostname = runTest ./cloud-init-hostname.nix; + cloudcompare = import ./cloudcompare.nix { inherit pkgs runTest; }; cloudlog = runTest ./cloudlog.nix; cntr = import ./cntr.nix { inherit (pkgs) lib; diff --git a/nixos/tests/cloudcompare.nix b/nixos/tests/cloudcompare.nix new file mode 100644 index 000000000000..0e9b72da3a41 --- /dev/null +++ b/nixos/tests/cloudcompare.nix @@ -0,0 +1,55 @@ +{ pkgs, runTest }: +let + testFile = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/asmaloney/libE57Format-test-data/bbcacec05d60f923869545c5eab33d94c390d50e/self/ColouredCubeFloat.e57"; + hash = "sha256-bb95crNYvX3Qhkx4k6Sqe2GjOf1u4nxxswMfdjyXfTM="; + }; + + vmTest = runTest { + name = "cloudcompare-vm"; + meta.maintainers = with pkgs.lib.maintainers; [ + nh2 + ]; + + enableOCR = true; + + nodes.machine = + { ... }: + { + imports = [ + ./common/x11.nix + ]; + + services.xserver.enable = true; + environment.systemPackages = [ + pkgs.cloudcompare + ]; + }; + + testScript = '' + start_all() + machine.wait_for_x() + + machine.execute("CloudCompare ${testFile} >&2 &") + machine.wait_for_window("CloudCompare") + + # Wait for the file to be loaded; CloudCompare shows "loaded successfully" in its log panel at the bottom. + machine.wait_for_text("loaded successfully") + + machine.screenshot("screen.png") + ''; + }; +in +{ + vm = vmTest; + + screenshot-analysis = pkgs.callPackage ./vlm-screenshot-question.nix { + name = "cloudcompare-screenshot-analysis"; + screenshot = "${vmTest}/screen.png"; + question = '' + Look at this screenshot of a desktop application. + Answer: Does the application show a 3D point cloud viewer (CloudCompare) that has successfully loaded and is displaying a coloured point cloud? + Evidence of success: a 3D viewport with coloured points is visible AND there are no error dialogs or error messages. + ''; + }; +} diff --git a/pkgs/by-name/cl/cloudcompare/package.nix b/pkgs/by-name/cl/cloudcompare/package.nix index a736269cf28a..28b69ee1ecee 100644 --- a/pkgs/by-name/cl/cloudcompare/package.nix +++ b/pkgs/by-name/cl/cloudcompare/package.nix @@ -16,6 +16,7 @@ mpfr, pcl, libsForQt5, + nixosTests, onetbb, xercesc, wrapGAppsHook3, @@ -162,6 +163,8 @@ stdenv.mkDerivation (finalAttrs: { }) ]; + passthru.tests = nixosTests.cloudcompare; + meta = { description = "3D point cloud and mesh processing software"; homepage = "https://cloudcompare.org";