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
61 changes: 61 additions & 0 deletions Sources/CustomDump/Conformances/CoreImage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#if canImport(CoreImage)
import CoreImage

@available(watchOS, unavailable)
extension CIQRCodeDescriptor.ErrorCorrectionLevel: CustomDumpStringConvertible {
public var customDumpDescription: String {
switch self {
case .levelL:
return "CIQRCodeDescriptor.ErrorCorrectionLevel.levelL"
case .levelM:
return "CIQRCodeDescriptor.ErrorCorrectionLevel.levelM"
case .levelQ:
return "CIQRCodeDescriptor.ErrorCorrectionLevel.levelQ"
case .levelH:
return "CIQRCodeDescriptor.ErrorCorrectionLevel.levelH"
@unknown default:
return "CIQRCodeDescriptor.ErrorCorrectionLevel.(@unknown default, rawValue: \(self.rawValue))"
}
}
}


extension CIDataMatrixCodeDescriptor.ECCVersion: CustomDumpStringConvertible {
public var customDumpDescription: String {
switch self {

case .v000:
return "CIDataMatrixCodeDescriptor.ECCVersion.v000"
case .v050:
return "CIDataMatrixCodeDescriptor.ECCVersion.v050"
case .v080:
return "CIDataMatrixCodeDescriptor.ECCVersion.v080"
case .v100:
return "CIDataMatrixCodeDescriptor.ECCVersion.v100"
case .v140:
return "CIDataMatrixCodeDescriptor.ECCVersion.v140"
case .v200:
return "CIDataMatrixCodeDescriptor.ECCVersion.v200"
@unknown default:
return "CIDataMatrixCodeDescriptor.ECCVersion.(@unknown default, rawValue: \(self.rawValue))"
}
}
}


extension CIRenderDestinationAlphaMode: CustomDumpStringConvertible {
public var customDumpDescription: String {
switch self {
case .none:
return "CIRenderDestinationAlphaMode.none"
case .premultiplied:
return "CIRenderDestinationAlphaMode.premultiplied"
case .unpremultiplied:
return "CIRenderDestinationAlphaMode.unpremultiplied"
@unknown default:
return "CIRenderDestinationAlphaMode.(@unknown default, rawValue: \(self.rawValue)"
}
}
}

#endif
40 changes: 40 additions & 0 deletions Tests/CustomDumpTests/Conformances/CoreImageTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#if canImport(CoreImage)
import CoreImage
import CustomDump
import XCTest


final class CoreImageTests: XCTestCase {
func testCIQRCodeDescriptor() {
var dump = ""
customDump(
[.levelH, .levelL, .levelM, .levelQ] as [CIQRCodeDescriptor.ErrorCorrectionLevel],
to: &dump
)

XCTAssertEqual(
dump,
"""
[
[0]: CIQRCodeDescriptor.ErrorCorrectionLevel.levelH,
[1]: CIQRCodeDescriptor.ErrorCorrectionLevel.levelL,
[2]: CIQRCodeDescriptor.ErrorCorrectionLevel.levelM,
[3]: CIQRCodeDescriptor.ErrorCorrectionLevel.levelQ
]
"""
)

dump = ""
customDump(
CIQRCodeDescriptor.ErrorCorrectionLevel.levelH,
to: &dump
)
XCTAssertEqual(
dump,
"""
CIQRCodeDescriptor.ErrorCorrectionLevel.levelH
"""
)
}
}
#endif