Skip to content

Commit 825ea07

Browse files
Extend CoreImage conformance (#10)
* Add CoreImage conformance * Update Sources/CustomDump/Conformances/CoreImage.swift Co-authored-by: Stephen Celis <[email protected]> * Update CoreImage.swift Co-authored-by: Stephen Celis <[email protected]>
1 parent 56d70aa commit 825ea07

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#if canImport(CoreImage)
2+
import CoreImage
3+
4+
@available(watchOS, unavailable)
5+
extension CIQRCodeDescriptor.ErrorCorrectionLevel: CustomDumpStringConvertible {
6+
public var customDumpDescription: String {
7+
switch self {
8+
case .levelL:
9+
return "CIQRCodeDescriptor.ErrorCorrectionLevel.levelL"
10+
case .levelM:
11+
return "CIQRCodeDescriptor.ErrorCorrectionLevel.levelM"
12+
case .levelQ:
13+
return "CIQRCodeDescriptor.ErrorCorrectionLevel.levelQ"
14+
case .levelH:
15+
return "CIQRCodeDescriptor.ErrorCorrectionLevel.levelH"
16+
@unknown default:
17+
return "CIQRCodeDescriptor.ErrorCorrectionLevel.(@unknown default, rawValue: \(self.rawValue))"
18+
}
19+
}
20+
}
21+
22+
23+
extension CIDataMatrixCodeDescriptor.ECCVersion: CustomDumpStringConvertible {
24+
public var customDumpDescription: String {
25+
switch self {
26+
27+
case .v000:
28+
return "CIDataMatrixCodeDescriptor.ECCVersion.v000"
29+
case .v050:
30+
return "CIDataMatrixCodeDescriptor.ECCVersion.v050"
31+
case .v080:
32+
return "CIDataMatrixCodeDescriptor.ECCVersion.v080"
33+
case .v100:
34+
return "CIDataMatrixCodeDescriptor.ECCVersion.v100"
35+
case .v140:
36+
return "CIDataMatrixCodeDescriptor.ECCVersion.v140"
37+
case .v200:
38+
return "CIDataMatrixCodeDescriptor.ECCVersion.v200"
39+
@unknown default:
40+
return "CIDataMatrixCodeDescriptor.ECCVersion.(@unknown default, rawValue: \(self.rawValue))"
41+
}
42+
}
43+
}
44+
45+
46+
extension CIRenderDestinationAlphaMode: CustomDumpStringConvertible {
47+
public var customDumpDescription: String {
48+
switch self {
49+
case .none:
50+
return "CIRenderDestinationAlphaMode.none"
51+
case .premultiplied:
52+
return "CIRenderDestinationAlphaMode.premultiplied"
53+
case .unpremultiplied:
54+
return "CIRenderDestinationAlphaMode.unpremultiplied"
55+
@unknown default:
56+
return "CIRenderDestinationAlphaMode.(@unknown default, rawValue: \(self.rawValue)"
57+
}
58+
}
59+
}
60+
61+
#endif
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#if canImport(CoreImage)
2+
import CoreImage
3+
import CustomDump
4+
import XCTest
5+
6+
7+
final class CoreImageTests: XCTestCase {
8+
func testCIQRCodeDescriptor() {
9+
var dump = ""
10+
customDump(
11+
[.levelH, .levelL, .levelM, .levelQ] as [CIQRCodeDescriptor.ErrorCorrectionLevel],
12+
to: &dump
13+
)
14+
15+
XCTAssertEqual(
16+
dump,
17+
"""
18+
[
19+
[0]: CIQRCodeDescriptor.ErrorCorrectionLevel.levelH,
20+
[1]: CIQRCodeDescriptor.ErrorCorrectionLevel.levelL,
21+
[2]: CIQRCodeDescriptor.ErrorCorrectionLevel.levelM,
22+
[3]: CIQRCodeDescriptor.ErrorCorrectionLevel.levelQ
23+
]
24+
"""
25+
)
26+
27+
dump = ""
28+
customDump(
29+
CIQRCodeDescriptor.ErrorCorrectionLevel.levelH,
30+
to: &dump
31+
)
32+
XCTAssertEqual(
33+
dump,
34+
"""
35+
CIQRCodeDescriptor.ErrorCorrectionLevel.levelH
36+
"""
37+
)
38+
}
39+
}
40+
#endif

0 commit comments

Comments
 (0)