Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Verkoeyen committed Nov 14, 2017
1 parent e70c512 commit d4bd581
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/unit/TransitionWithPresentationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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)
}
}
Expand Down Expand Up @@ -138,7 +140,7 @@ final class TestingPresentationController: UIPresentationController {
}
}

final class PresentationTransition: NSObject, TransitionWithPresentation {
final class TestingPresentationTransition: NSObject, TransitionWithPresentation {
var presentationFrame: CGRect?
var presentationView: UIView?

Expand Down

0 comments on commit d4bd581

Please sign in to comment.