Skip to content

Commit 4dab235

Browse files
authored
Merge pull request #1416 from mattrajca/master
Add test for SR-3941.
2 parents 386f3a5 + 0056254 commit 4dab235

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

TestFoundation/TestAffineTransform.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class TestAffineTransform : XCTestCase {
4141
("test_hashing_identity", test_hashing_identity),
4242
("test_hashing_values", test_hashing_values),
4343
("test_rotation_compose", test_rotation_compose),
44+
("test_translation_and_rotation", test_translation_and_rotation),
4445
("test_Equal", test_Equal),
4546
("test_NSCoding", test_NSCoding),
4647
]
@@ -358,7 +359,14 @@ class TestAffineTransform : XCTestCase {
358359
XCTAssertEqual(0.0, Double(result.x), accuracy: accuracyThreshold)
359360
XCTAssertEqual(1.0, Double(result.y), accuracy: accuracyThreshold)
360361
}
361-
362+
363+
func test_translation_and_rotation() {
364+
let point = NSPoint(x: CGFloat(10), y: CGFloat(10))
365+
var translateThenRotate = AffineTransform(translationByX: 20, byY: -30)
366+
translateThenRotate.rotate(byRadians: .pi / 2)
367+
checkPointTransformation(NSAffineTransform(transform: translateThenRotate), point: point, expectedPoint: NSPoint(x: CGFloat(10), y: CGFloat(-20)))
368+
}
369+
362370
func test_Equal() {
363371
let transform = NSAffineTransform()
364372
let transform1 = NSAffineTransform()

0 commit comments

Comments
 (0)