Skip to content

Commit 16f8c29

Browse files
committed
Updated unit tests
1 parent b40e786 commit 16f8c29

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Tests/SilicaTests/StyleKitTests.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,22 @@ final class StyleKitTests: XCTestCase {
6868

6969
draw(TestStyleKit.drawMultiLineText(), "multilineText", CGSize(width: 240, height: 180))
7070
}
71+
72+
func testContentMode() {
73+
74+
let bounds = CGRect(origin: .zero, size: CGSize(width: 320, height: 240))
75+
let testData: [((CGRect) -> (), CGSize)] = [
76+
(TestStyleKit.drawSwiftLogo, CGSize(width: 32, height: 32)),
77+
(TestStyleKit.drawSwiftLogoWithText, CGSize(width: 32 * (41 / 12), height: 32))
78+
]
79+
for (index, (drawingFunction, intrinsicContentSize)) in testData.enumerated() {
80+
let imageNumber = index + 1
81+
for contentMode in UIViewContentMode.allCases {
82+
let frame = CGRect(contentMode: contentMode, bounds: bounds, size: intrinsicContentSize)
83+
print("Draw image \(imageNumber) with content mode \(contentMode). \(frame)")
84+
draw(drawingFunction(frame), "testContentMode_\(imageNumber)_\(contentMode)", bounds.size)
85+
}
86+
}
87+
88+
}
7189
}

0 commit comments

Comments
 (0)