Merged
Conversation
Detect opaque images and encode without alpha to suppress "opaque image with AlphaLast" warnings and reduce file size. - Add OpaqueMode enum with auto/opaque/transparent options - Add isOpaqueImage property to UIImage and NSImage - Set kCGImagePropertyHasAlpha based on opaque detection - Thread opaqueMode parameter through all snapshotting APIs - Add test coverage for opaque and transparent image handling - Name XCTest attachments and set lifetime to keepAlways
Extract common pixel comparison logic and CGContext creation into ImageComparisonHelpers.swift for code reuse across UIImage and NSImage. - Add comparePixelBytes() with early exit optimization for faster failure - Add createImageContext() for consistent sRGB color space handling - Update UIImage.swift and NSImage.swift to use shared helpers - Change UIImage+HEIC.swift to accept CompressionQuality instead of CGFloat - Add unit tests for CompressionQuality, OpaqueMode, and comparison helpers - Update CLAUDE.md with architecture documentation and device requirements
b4d8a17 to
fd96c4e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements to the SnapshotTestingHEIC Swift library, focusing on CI/CD modernization, enhanced documentation, and better control over HEIC image encoding. The most significant changes are the addition of a release workflow, updates to the CI pipeline, expanded README documentation, and new options for handling alpha channels during image encoding to suppress common XCTest warnings.
CI/CD Improvements
.github/workflows/release.yml).github/workflows/ci.yml,Scripts/build.sh) [1] [2] [3]Documentation Enhancements
README.md) [1] [2]CLAUDE.mdto provide project overview, build/test instructions, architecture, and platform/testing notes for AI code assistants. (CLAUDE.md)HEIC Encoding & API Improvements
OpaqueModeenum to control alpha channel handling during HEIC encoding, with.auto,.opaque, and.transparentoptions. This helps prevent "opaque image with AlphaLast" XCTest warnings and can reduce file size. (Sources/SnapshotTestingHEIC/HEIC/CompressionQuality.swift)UIImageandNSImageHEIC encoding extensions to supportOpaqueMode, and improved logic for determining image opacity and encoding options. (Sources/SnapshotTestingHEIC/HEIC/UIImage+HEIC.swift,Sources/SnapshotTestingHEIC/HEIC/NSImage+HEIC.swift) [1] [2] [3] [4]opaqueModefor snapshot comparisons, and improved attachment naming in test failures. (Sources/SnapshotTestingHEIC/NSImage.swift)Utilities
ImageComparisonHelpers.swiftwith shared utilities for pixel comparison and consistent image context creation across platforms. (Sources/SnapshotTestingHEIC/ImageComparisonHelpers.swift)Dependency Update
swift-snapshot-testingdependency to version 1.18.7 for improved compatibility. (Package.swift)