@@ -70,9 +70,8 @@ class UIKitBehavioralTests: XCTestCase {
70
70
// MARK: Each animatable property needs to be added to exactly one of the following three tests
71
71
72
72
func testSomePropertiesImplicitlyAnimateAdditively( ) {
73
- let properties : [ AnimatableKeyPath : Any ] = [
73
+ let baselineProperties : [ AnimatableKeyPath : Any ] = [
74
74
. bounds: CGRect ( x: 0 , y: 0 , width: 123 , height: 456 ) ,
75
- . cornerRadius: 3 ,
76
75
. height: 100 ,
77
76
. position: CGPoint ( x: 50 , y: 20 ) ,
78
77
. rotation: 42 ,
@@ -82,6 +81,15 @@ class UIKitBehavioralTests: XCTestCase {
82
81
. x: 12 ,
83
82
. y: 23 ,
84
83
]
84
+ let properties : [ AnimatableKeyPath : Any ]
85
+ if #available( iOS 11 . 0 , * ) {
86
+ // Corner radius became implicitly animatable in iOS 11.
87
+ var baselineWithCornerRadiusProperties = baselineProperties
88
+ baselineWithCornerRadiusProperties [ . cornerRadius] = 3
89
+ properties = baselineWithCornerRadiusProperties
90
+ } else {
91
+ properties = baselineProperties
92
+ }
85
93
for (keyPath, value) in properties {
86
94
rebuildView ( )
87
95
@@ -103,11 +111,11 @@ class UIKitBehavioralTests: XCTestCase {
103
111
}
104
112
105
113
func testSomePropertiesImplicitlyAnimateButNotAdditively( ) {
106
- let properties : [ AnimatableKeyPath : Any ] = [
114
+ let baselineProperties : [ AnimatableKeyPath : Any ] = [
107
115
. backgroundColor: UIColor . blue,
108
116
. opacity: 0.5 ,
109
117
]
110
- for (keyPath, value) in properties {
118
+ for (keyPath, value) in baselineProperties {
111
119
rebuildView ( )
112
120
113
121
UIView . animate ( withDuration: 0.01 ) {
@@ -128,13 +136,26 @@ class UIKitBehavioralTests: XCTestCase {
128
136
}
129
137
130
138
func testSomePropertiesDoNotImplicitlyAnimate( ) {
131
- let properties : [ AnimatableKeyPath : Any ] = [
139
+ let baselineProperties : [ AnimatableKeyPath : Any ] = [
140
+ . cornerRadius: 3 ,
132
141
. shadowOffset: CGSize ( width: 1 , height: 1 ) ,
133
142
. shadowOpacity: 0.3 ,
134
143
. shadowRadius: 5 ,
135
144
. strokeStart: 0.2 ,
136
145
. strokeEnd: 0.5 ,
137
146
]
147
+
148
+ let properties : [ AnimatableKeyPath : Any ]
149
+ if #available( iOS 11 . 0 , * ) {
150
+ // Corner radius became implicitly animatable in iOS 11.
151
+ var baselineWithOutCornerRadius = baselineProperties
152
+ baselineWithOutCornerRadius. removeValue ( forKey: . cornerRadius)
153
+ properties = baselineWithOutCornerRadius
154
+
155
+ } else {
156
+ properties = baselineProperties
157
+ }
158
+
138
159
for (keyPath, value) in properties {
139
160
rebuildView ( )
140
161
0 commit comments