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 .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main", "next" ]
branches: [ "main", "next", "feature/image-manager-tests" ]

jobs:
coverage:
Expand Down
3 changes: 1 addition & 2 deletions Tests/SnappThemingTests/Mocks/MockExternalProcessor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import SnappTheming
import UniformTypeIdentifiers

final class MockExternalProcessor: SnappThemingExternalImageProcessorProtocol {
let dummyImage = SnappThemingImage(systemSymbolName: "pencil", accessibilityDescription: "test")
func process(_ object: SnappTheming.SnappThemingImageObject, of type: UTType) -> SnappThemingImage? {
dummyImage
SnappThemingImage(systemSymbolName: "pencil", accessibilityDescription: "test")
}
}
3 changes: 2 additions & 1 deletion Tests/SnappThemingTests/SnappThemingImageManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct SnappThemingImageManagerTests {

@Test func testPreparingImage_External() throws {
let mock = MockExternalProcessor()
let mockImage = SnappThemingImage(systemSymbolName: "pencil", accessibilityDescription: "test")
SnappThemingImageProcessorsRegistry.shared.register(mock)
let manager: SnappThemingImageManager = SnappThemingImageManagerDefault(
.withFileExistTrue,
Expand All @@ -66,7 +67,7 @@ struct SnappThemingImageManagerTests {
#expect(object.url == nil)
#expect(object.data == dataURI.data)
let image = try #require(manager.image(from: object, of: dataURI.type))
#expect(image.size == mock.dummyImage?.size)
#expect(image.size == mockImage?.size)

SnappThemingImageProcessorsRegistry.shared.unregister(MockExternalProcessor.self)
}
Expand Down