Skip to content

mackoj/swift-snapshot-testing-plugin-jxl

Repository files navigation

Important

  • This is a prototype implementation to test the ImagePluginAPI of swift-snapshot-testing.

swift-snapshot-testing-plugin-jxl

This repo is an experimental use of this branch(pointfreeco/swift-snapshot-testing#904) that contains a PluginAPI for swift-snapshot-testing.

The goal of this is to show how easy it is to build a plugin.

Usage

To utilize the JXL image serializer in your tests, follow these steps:

  1. Add the Dependency: Include this project as a dependency in your Package.swift file:

    .package(url: "https://github.com/mackoj/swift-snapshot-testing-plugin-jxl.git", revision: "0.0.1"),
  2. Link to Your Test Target: Add the JXLImageSerializer to your test target's dependencies:

    .product(name: "JXLImageSerializer", package: "swift-snapshot-testing-plugin-jxl"),
  3. Import and Set Up: In your test file, import the serializer and set the image format in the setUp() method:

    import JXLImageSerializer

    override class func setUp() {
        SnapshotTesting.imageFormat = JXLImageSerializer.imageFormat
    }

Important

On non Apple platform use this instead.

    import HEICImageSerializer

    override class func setUp() {
        SnapshotTesting.imageFormat = JXLImageSerializer.imageFormat
        PluginRegistry.registerPlugin(JXLImageSerializer.init())
    }

TODO

  • use libjxl directly
  • make the API ready for Swift 6 and async/throwing functions
  • create a tests suite
  • add documentations
  • add tutorials

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages