Skip to content

Commit

Permalink
Updated unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Dec 15, 2024
1 parent b40e786 commit 16f8c29
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Tests/SilicaTests/StyleKitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,22 @@ final class StyleKitTests: XCTestCase {

draw(TestStyleKit.drawMultiLineText(), "multilineText", CGSize(width: 240, height: 180))
}

func testContentMode() {

let bounds = CGRect(origin: .zero, size: CGSize(width: 320, height: 240))
let testData: [((CGRect) -> (), CGSize)] = [
(TestStyleKit.drawSwiftLogo, CGSize(width: 32, height: 32)),
(TestStyleKit.drawSwiftLogoWithText, CGSize(width: 32 * (41 / 12), height: 32))
]
for (index, (drawingFunction, intrinsicContentSize)) in testData.enumerated() {
let imageNumber = index + 1
for contentMode in UIViewContentMode.allCases {
let frame = CGRect(contentMode: contentMode, bounds: bounds, size: intrinsicContentSize)
print("Draw image \(imageNumber) with content mode \(contentMode). \(frame)")
draw(drawingFunction(frame), "testContentMode_\(imageNumber)_\(contentMode)", bounds.size)
}
}

}
}

0 comments on commit 16f8c29

Please sign in to comment.