From d4bd58183286cbec9bd1cd0a5ab1455ce0574fc4 Mon Sep 17 00:00:00 2001 From: Jeff Verkoeyen Date: Tue, 14 Nov 2017 14:16:02 -0500 Subject: [PATCH] Cleanup. --- .../unit/TransitionWithPresentationTests.swift | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/unit/TransitionWithPresentationTests.swift b/tests/unit/TransitionWithPresentationTests.swift index 7d815c3..f9e72c5 100644 --- a/tests/unit/TransitionWithPresentationTests.swift +++ b/tests/unit/TransitionWithPresentationTests.swift @@ -32,7 +32,7 @@ class TransitionWithPresentationTests: XCTestCase { func testPresentationControllerIsQueriedAndCompletesWithoutAnimation() { let presentedViewController = UIViewController() - presentedViewController.transitionController.transition = PresentationTransition() + presentedViewController.transitionController.transition = TestingPresentationTransition() let didComplete = expectation(description: "Did complete") window.rootViewController!.present(presentedViewController, animated: false) { @@ -46,7 +46,7 @@ class TransitionWithPresentationTests: XCTestCase { func testPresentationControllerIsQueriedAndCompletesWithAnimation() { let presentedViewController = UIViewController() - presentedViewController.transitionController.transition = PresentationTransition() + presentedViewController.transitionController.transition = TestingPresentationTransition() let didComplete = expectation(description: "Did complete") window.rootViewController!.present(presentedViewController, animated: true) { @@ -72,12 +72,13 @@ class TransitionWithPresentationTests: XCTestCase { waitForExpectations(timeout: 0.1) XCTAssertEqual(window.rootViewController!.presentedViewController, presentedViewController) - XCTAssertEqual(window.rootViewController!.presentedViewController?.view.bounds, window.bounds) + XCTAssertEqual(window.rootViewController!.presentedViewController?.view.bounds, + window.rootViewController!.view.bounds) } func testPresentedFrameMatchesPresentationFrame() { let presentedViewController = UIViewController() - let transition = PresentationTransition() + let transition = TestingPresentationTransition() transition.presentationFrame = CGRect(x: 100, y: 30, width: 50, height: 70) presentedViewController.transitionController.transition = transition @@ -96,8 +97,9 @@ class TransitionWithPresentationTests: XCTestCase { func testNoFramesModifiedWhenThereIsAPresentationView() { let presentedViewController = UIViewController() - let transition = PresentationTransition() - let presentationView = UIView() + let transition = TestingPresentationTransition() + let presentationFrame = CGRect(x: 0, y: 0, width: 100, height: 100) + let presentationView = UIView(frame: presentationFrame) transition.presentationView = presentationView presentedViewController.transitionController.transition = transition @@ -110,7 +112,7 @@ class TransitionWithPresentationTests: XCTestCase { waitForExpectations(timeout: 0.1) XCTAssertEqual(window.rootViewController!.presentedViewController, presentedViewController) - XCTAssertEqual(presentationView.frame, .zero) + XCTAssertEqual(presentationView.frame, presentationFrame) XCTAssertEqual(presentedViewController.view.frame, UIScreen.main.bounds) } } @@ -138,7 +140,7 @@ final class TestingPresentationController: UIPresentationController { } } -final class PresentationTransition: NSObject, TransitionWithPresentation { +final class TestingPresentationTransition: NSObject, TransitionWithPresentation { var presentationFrame: CGRect? var presentationView: UIView?