Skip to content

Little update#15

Merged
alexey1312 merged 9 commits intomasterfrom
feature/update
Dec 1, 2025
Merged

Little update#15
alexey1312 merged 9 commits intomasterfrom
feature/update

Conversation

@alexey1312
Copy link
Owner

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

  • Added a dedicated GitHub Actions workflow for releases, which builds, tests, and automatically creates GitHub releases when a version tag is pushed. (.github/workflows/release.yml)
  • Refactored the CI workflow to support both macOS and Linux builds and tests, updated Xcode selection, and removed legacy build scripts. (.github/workflows/ci.yml, Scripts/build.sh) [1] [2] [3]

Documentation Enhancements

  • Major README update: Added real-world file size comparisons, detailed usage examples, compression and opaque mode options, and explanation of known XCTest warnings. (README.md) [1] [2]
  • Introduced CLAUDE.md to provide project overview, build/test instructions, architecture, and platform/testing notes for AI code assistants. (CLAUDE.md)

HEIC Encoding & API Improvements

  • Added OpaqueMode enum to control alpha channel handling during HEIC encoding, with .auto, .opaque, and .transparent options. This helps prevent "opaque image with AlphaLast" XCTest warnings and can reduce file size. (Sources/SnapshotTestingHEIC/HEIC/CompressionQuality.swift)
  • Updated UIImage and NSImage HEIC encoding extensions to support OpaqueMode, 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]
  • Extended public diffing API to allow specifying opaqueMode for snapshot comparisons, and improved attachment naming in test failures. (Sources/SnapshotTestingHEIC/NSImage.swift)

Utilities

  • Added ImageComparisonHelpers.swift with shared utilities for pixel comparison and consistent image context creation across platforms. (Sources/SnapshotTestingHEIC/ImageComparisonHelpers.swift)

Dependency Update

  • Updated swift-snapshot-testing dependency to version 1.18.7 for improved compatibility. (Package.swift)

Update CI
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
Fix tests
@alexey1312 alexey1312 merged commit ef2b0e0 into master Dec 1, 2025
2 checks passed
@alexey1312 alexey1312 deleted the feature/update branch December 1, 2025 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant