This repository has been archived by the owner on Nov 21, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reviewers: O4 Material Motion Apple platform reviewers, O2 Material Motion, markwei Reviewed By: O4 Material Motion Apple platform reviewers, O2 Material Motion, markwei Tags: #material_motion Maniphest Tasks: T85 Differential Revision: http://codereview.cc/D1949
- Loading branch information
Jeff Verkoeyen
committed
Nov 17, 2016
1 parent
944deab
commit 85ef3ab
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
Copyright 2016-present The Material Motion Authors. All Rights Reserved. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import XCTest | ||
import MaterialMotionTransitions | ||
import MaterialMotionCoreAnimationTransitions | ||
|
||
class TransitionTweenTests: XCTestCase { | ||
|
||
var window: UIWindow! = nil | ||
|
||
override func setUp() { | ||
super.setUp() | ||
|
||
window = UIWindow() | ||
window.rootViewController = UIViewController() | ||
window.rootViewController!.view.backgroundColor = .blue | ||
window.makeKeyAndVisible() | ||
window.layer.speed = 100 | ||
} | ||
|
||
class TransitionTweenDirector: NSObject, TransitionDirector { | ||
let transition: Transition | ||
required init(transition: Transition) { | ||
self.transition = transition | ||
} | ||
|
||
func setUp() { | ||
let fadeIn = TransitionTween("opacity", | ||
transition: transition, | ||
segment: .init(position: 0, length: 1), | ||
back: NSNumber(value: 0), | ||
fore: NSNumber(value: 1)) | ||
transition.runtime.addPlan(fadeIn, to: transition.foreViewController.view.layer) | ||
} | ||
} | ||
|
||
func testTransitionTweenTransitionDoesTerminate() { | ||
let toPresent = UIViewController() | ||
toPresent.view.backgroundColor = .red | ||
|
||
toPresent.mdm_transitionController.directorClass = TransitionTweenDirector.self | ||
|
||
let expect = expectation(description: "Did present") | ||
window.rootViewController!.present(toPresent, animated: true) { | ||
expect.fulfill() | ||
} | ||
waitForExpectations(timeout: 1) | ||
|
||
let expectDismiss = expectation(description: "Did dismiss") | ||
toPresent.dismiss(animated: true) { | ||
expectDismiss.fulfill() | ||
} | ||
waitForExpectations(timeout: 1) | ||
} | ||
|
||
} |