in CyborgTests/AspectRatioTests.swift [24:59]
func test_scale_aspect_fit() {
func assertTransformed(from: CGSize,
in container: CGSize,
to result: CGSize,
file: StaticString = #file,
line: UInt = #line) {
XCTAssertEqual(from.scaleAspectFit(in: container),
result,
file: file,
line: line)
}
assertTransformed(from: .init(width: 1,
height: 5),
in: .init(width: 100,
height: 200),
to: .init(width: 40,
height: 200))
assertTransformed(from: .init(width: 10,
height: 10),
in: .init(width: 100,
height: 200),
to: .init(width: 100,
height: 100))
assertTransformed(from: .init(width: 1000,
height: 1000),
in: .init(width: 100,
height: 200),
to: .init(width: 100,
height: 100))
assertTransformed(from: .init(width: 1000,
height: 10),
in: .init(width: 100,
height: 200),
to: .init(width: 100,
height: 1))
}