Files
iccery-v2-mac/Tests/ICCeryCoreTests/ArgyllRunnerCalibrationTests.swift
gronodandDevin <158243242+devin-ai-integration[bot]@users.noreply.github.com> 34bef9a78e fix(stage0): implement printer calibration workflow and stabilise M6 UI tests.
- Add CalibrationTargenArgs, PrintcalArgs, CalibrationStore (stage 0).
- Add ArgyllRunner.runCalibrationTargen and runPrintcal.
- Add CalibrationView + CalibrationViewModel to the app shell.
- Wire calibration into RootView, SidebarView, Stage1View, TargetWorkflowViewModel.
- Remove mutable _uiTestRoot from AppPaths; derive isolated test roots from
  ICCERY_TEST_WORKDIR / process id.
- Fix Milestone6CGATSUITests to assert stage4TargetBasename instead of a
  VStack accessibility identifier.
- Fix Milestone6CalibrationUITests fixture binary path.

Refs: #29

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-09 22:27:02 +01:00

82 lines
2.7 KiB
Swift

import Foundation
import Testing
@testable import ICCeryCore
@Suite("ArgyllRunner Calibration")
struct ArgyllRunnerCalibrationTests {
private func makeRunner() -> ArgyllRunner {
let binDir = URL(fileURLWithPath: #filePath)
.deletingLastPathComponent()
.deletingLastPathComponent()
.appendingPathComponent("ICCeryUITests/Fixtures/bin")
return ArgyllRunner(
processManager: .shared,
binaryResolver: BinaryResolver(overrideDir: binDir)
)
}
private func makeTestDir() throws -> URL {
let root = FileManager.default.temporaryDirectory
.appendingPathComponent("calibration-test-\(UUID().uuidString)")
try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)
return root
}
@Test("Calibration targen produces CAL_*.ti1")
func calibrationTargenProducesTi1() async throws {
let testRoot = try makeTestDir()
let runner = makeRunner()
let config = CalibrationTargenConfig(
colourSpace: .rgb,
steps: 21,
basename: "demo",
workingDirectory: testRoot
)
let url = try await runner.runCalibrationTargen(config: config)
#expect(url.lastPathComponent == "CAL_demo.ti1")
#expect(FileManager.default.fileExists(atPath: url.path))
try? FileManager.default.removeItem(at: testRoot)
}
@Test("printcal captured run creates .cal")
func printcalProducesCal() async throws {
let testRoot = try makeTestDir()
let runner = makeRunner()
let output = testRoot.appendingPathComponent("CAL_demo.cal")
let config = PrintcalConfig(
ti3Basename: "CAL_demo",
workingDirectory: testRoot,
outputURL: output
)
let url = try await runner.runPrintcal(config: config)
#expect(url.lastPathComponent == "CAL_demo.cal")
#expect(FileManager.default.fileExists(atPath: url.path))
try? FileManager.default.removeItem(at: testRoot)
}
@Test("printcal failure throws printcalFailed")
func printcalFailureThrows() async throws {
let testRoot = try makeTestDir()
let runner = makeRunner()
let output = testRoot.appendingPathComponent("CAL_demo.cal")
let config = PrintcalConfig(
ti3Basename: "CAL_demo",
workingDirectory: testRoot,
outputURL: output
)
setenv("ICCERY_MOCK_PRINTCAL_EXIT", "1", 1)
defer { unsetenv("ICCERY_MOCK_PRINTCAL_EXIT") }
await #expect(throws: (any Error).self) {
_ = try await runner.runPrintcal(config: config)
}
try? FileManager.default.removeItem(at: testRoot)
}
}