Slice 2 (Phase 1a) of the M9 Monterey retarget. Converts all pure Core suites (argv builders, CGATS/CUPS/profcheck/gamut-mesh parsers, colour math, file/artefact helpers, classifiers) to XCTestCase, and adds the shared assertAsyncThrows helper for the async-throws sites that Slice 3 will convert. Deferred to Slice 3 (kept on Swift Testing in mixed files): ProcessManagerTests, ArgyllRunner*Tests, ProcessRunSupportTests, store/UI suites, and the runner suites embedded in TargenTests / PrinttargTests / ProcessManagerTests. Also qualifies six bare `throw .case` expressions in CGATSParser with CGATSParseError — they only compiled under typed throws, which Slice 1 demoted to untyped `throws`; without this the ICCeryCore target fails to build and no test gate can run. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
53 lines
1.7 KiB
Swift
53 lines
1.7 KiB
Swift
import Foundation
|
|
import XCTest
|
|
@testable import ICCeryCore
|
|
|
|
final class CalibrationTargenArgsTests: XCTestCase {
|
|
|
|
func testRgbBaseline() throws {
|
|
let config = CalibrationTargenConfig(
|
|
colourSpace: .rgb,
|
|
steps: 21,
|
|
whitePatches: 4,
|
|
basename: "demo",
|
|
workingDirectory: URL(fileURLWithPath: "/tmp")
|
|
)
|
|
let args = try CalibrationTargenArgs.build(config: config)
|
|
XCTAssertEqual(args, ["-v", "-d", "2", "-s", "21", "-g", "21", "-e", "4", "-f", "0", "CAL_demo"])
|
|
}
|
|
|
|
func testCmykWithOptions() throws {
|
|
let config = CalibrationTargenConfig(
|
|
colourSpace: .cmyk,
|
|
steps: 25,
|
|
whitePatches: 4,
|
|
includeNeutralEmphasis: true,
|
|
inkLimit: 320,
|
|
basename: "printer",
|
|
workingDirectory: URL(fileURLWithPath: "/tmp")
|
|
)
|
|
let args = try CalibrationTargenArgs.build(config: config)
|
|
XCTAssertEqual(args, ["-v", "-d", "4", "-s", "25", "-g", "25", "-e", "4", "-f", "0", "-n", "25", "-l", "320", "CAL_printer"])
|
|
}
|
|
|
|
func testRejectsBadSteps() {
|
|
let config = CalibrationTargenConfig(steps: 5, basename: "demo")
|
|
XCTAssertThrowsError(try CalibrationTargenArgs.build(config: config))
|
|
}
|
|
|
|
func testRejectsBadInkLimit() {
|
|
let config = CalibrationTargenConfig(
|
|
colourSpace: .cmyk,
|
|
inkLimit: 500,
|
|
basename: "demo"
|
|
)
|
|
XCTAssertThrowsError(try CalibrationTargenArgs.build(config: config))
|
|
}
|
|
|
|
func testNoDoublePrefix() throws {
|
|
let config = CalibrationTargenConfig(basename: "CAL_test")
|
|
let args = try CalibrationTargenArgs.build(config: config)
|
|
XCTAssertEqual(args.last, "CAL_test")
|
|
}
|
|
}
|