From 88ff2f79d5e80ea152bcdda95b0b23b98c9988d2 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 14 Dec 2025 01:57:59 +0000 Subject: [PATCH] test(macos): cover camera snap defaults --- .../CameraCaptureServiceTests.swift | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 apps/macos/Tests/ClawdisIPCTests/CameraCaptureServiceTests.swift diff --git a/apps/macos/Tests/ClawdisIPCTests/CameraCaptureServiceTests.swift b/apps/macos/Tests/ClawdisIPCTests/CameraCaptureServiceTests.swift new file mode 100644 index 000000000..bc1f1a76b --- /dev/null +++ b/apps/macos/Tests/ClawdisIPCTests/CameraCaptureServiceTests.swift @@ -0,0 +1,22 @@ +import Testing + +@testable import Clawdis + +@Suite struct CameraCaptureServiceTests { + @Test func normalizeSnapDefaults() { + let res = CameraCaptureService.normalizeSnap(maxWidth: nil, quality: nil) + #expect(res.maxWidth == 1600) + #expect(res.quality == 0.9) + } + + @Test func normalizeSnapClampsValues() { + let low = CameraCaptureService.normalizeSnap(maxWidth: -1, quality: -10) + #expect(low.maxWidth == 1600) + #expect(low.quality == 0.05) + + let high = CameraCaptureService.normalizeSnap(maxWidth: 9999, quality: 10) + #expect(high.maxWidth == 9999) + #expect(high.quality == 1.0) + } +} +