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

Commit

Permalink
Anchor point became animatable on iOS 11.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Verkoeyen committed Dec 16, 2017
1 parent e48cc45 commit a56cd92
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/unit/UIKitBehavioralTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,19 @@ class UIKitBehavioralTests: XCTestCase {

func testSomePropertiesImplicitlyAnimateButNotAdditively() {
let baselineProperties: [AnimatableKeyPath: Any] = [
.anchorPoint: CGPoint(x: 0.2, y: 0.4),
.backgroundColor: UIColor.blue,
.opacity: 0.5,
]
for (keyPath, value) in baselineProperties {
let properties: [AnimatableKeyPath: Any]
if #available(iOS 11.0, *) {
// Anchor point became implicitly animatable in iOS 11.
var baselineWithCornerRadiusProperties = baselineProperties
baselineWithCornerRadiusProperties[.anchorPoint] = CGPoint(x: 0.2, y: 0.4)
properties = baselineWithCornerRadiusProperties
} else {
properties = baselineProperties
}
for (keyPath, value) in properties {
rebuildView()

UIView.animate(withDuration: 0.01) {
Expand All @@ -139,6 +147,7 @@ class UIKitBehavioralTests: XCTestCase {

func testSomePropertiesDoNotImplicitlyAnimate() {
let baselineProperties: [AnimatableKeyPath: Any] = [
.anchorPoint: CGPoint(x: 0.2, y: 0.4),
.borderWidth: 5,
.borderColor: UIColor.red,
.cornerRadius: 3,
Expand All @@ -155,6 +164,7 @@ class UIKitBehavioralTests: XCTestCase {
if #available(iOS 11.0, *) {
// Corner radius became implicitly animatable in iOS 11.
var baselineWithOutCornerRadius = baselineProperties
baselineWithOutCornerRadius.removeValue(forKey: .anchorPoint)
baselineWithOutCornerRadius.removeValue(forKey: .cornerRadius)
properties = baselineWithOutCornerRadius

Expand Down

0 comments on commit a56cd92

Please sign in to comment.