Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ SVG tests avoid raw string literals (`#"..."#`) when the expected string contain
**Drawing-scenario golden tests.** `Tests/TortoiseTestSupport/` (a non-product target) defines `DrawingScenario.all` — feature-grouped tortoise programs that together cover every `TortoiseCommand` case. Both renderers are verified against the same scenarios via pointfreeco/swift-snapshot-testing:

- `TortoiseSVGTests/DrawingScenarioSVGTests` compares full SVG strings against goldens in `Tests/TortoiseSVGTests/__Snapshots__/`.
- `TortoiseUITests/DrawingScenarioCanvasTests` (macOS-only, `#if os(macOS)`) renders `TortoiseCanvas` via `ImageRenderer` (`scale = 2`, instant mode forced by prepending `speed = 0`) and compares PNGs in `Tests/TortoiseUITests/__Snapshots__/` with `.canvasGolden` (byte-wise `precision: 0.995`, defined in `CanvasGoldenSnapshotting.swift`) to absorb OS-level antialiasing drift. **Do not add `perceptualPrecision`**: swift-snapshot-testing's perceptual path passes a bare `CGRect` to `CIAreaAverage`, which Core Image on macOS 27 rejects with an uncaught exception that kills the whole test process. It only triggers when bytes differ, so it passes on the recording macOS and crashes on the CI runner's. Tracked in #49 (still reproduces on Xcode 27.0 GA; re-check once the runner image ships a GA macOS 27).
- `TortoiseUITests/DrawingScenarioCanvasTests` (macOS-only, `#if os(macOS)`) renders `TortoiseCanvas` via `ImageRenderer` (`scale = 2`, instant mode forced by prepending `speed = 0`) and compares PNGs in `Tests/TortoiseUITests/__Snapshots__/` with `.canvasGolden` (`precision: 0.995, perceptualPrecision: 0.98`, defined in `CanvasGoldenSnapshotting.swift`) to absorb OS-level antialiasing drift. `perceptualPrecision` requires **swift-snapshot-testing 1.19.6 or newer**, which is why `Package.swift` floors the dependency there rather than at the version SwiftPM would otherwise pick: through 1.19.5 the perceptual path passed a bare `CGRect` to `CIAreaAverage`, which Core Image on macOS 27 rejected with an uncaught exception that killed the whole test process (#49, fixed upstream in pointfreeco/swift-snapshot-testing#1120). That path is only reached when bytes differ, so a byte-identical run never exercises it — don't read a green local suite as proof the floor can be lowered.

After intentionally changing scenario programs or renderer output, re-record **both** golden sets in the same commit and visually inspect them:

Expand Down
6 changes: 3 additions & 3 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ let package = Package(
products: products,
dependencies: [
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.4.0"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.18.0"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.19.6"),
],
targets: targets
)
18 changes: 8 additions & 10 deletions Tests/TortoiseUITests/CanvasGoldenSnapshotting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@
extension Snapshotting where Value == NSImage, Format == NSImage {
/// The comparison every canvas PNG golden uses.
///
/// Byte-wise with a small tolerance, deliberately *without*
/// `perceptualPrecision`. swift-snapshot-testing's perceptual path passes a
/// `perceptualPrecision` absorbs the OS-level antialiasing drift that makes
/// byte-wise comparison of rendered text and curves brittle across machines.
///
/// It was removed for a while: swift-snapshot-testing through 1.19.5 passed a
/// bare `CGRect` as `CIAreaAverage`'s `inputExtent`, which Core Image on
/// macOS 27 rejects with an uncaught `-[NSConcreteValue CGRectValue]`
/// exception — crashing the whole test process rather than failing one
/// test. An exact match never reaches that path, which is why the goldens
/// still pass on the macOS they were recorded on.
///
/// Still reproduces on Xcode 27.0 GA (27A266a); the CI runner's macOS 27 is
/// itself still a beta build, so whether `perceptualPrecision` can ever come
/// back is tracked in #49.
/// exception — crashing the whole test process rather than failing one test.
/// Fixed upstream in 1.19.6 (pointfreeco/swift-snapshot-testing#1120), which
/// is why `Package.swift` floors the dependency there. See #49.
static var canvasGolden: Snapshotting {
.image(precision: 0.995)
.image(precision: 0.995, perceptualPrecision: 0.98)
}
}
#endif
Loading