@@ -115,6 +115,12 @@ class AdjustSizeSpec: QuickSpec {
115115 expect ( aView. frame) . to ( equal ( CGRect ( x: 140.0 , y: 100.0 , width: 50.0 , height: 60.0 ) ) )
116116 }
117117
118+ it ( " should accept a width of 0 " ) {
119+ aView. pin. width ( 0 )
120+ expect ( Pin . lastWarningText) . to ( beNil ( ) )
121+ expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 0.0 , height: 60.0 ) ) )
122+ }
123+
118124 it ( " should warn about negative width value " ) {
119125 aView. pin. width ( - 2 )
120126 expect ( Pin . lastWarningText) . to ( contain ( [ " width " , " won't be applied " , " the width " , " must be greater than or equal to zero " ] ) )
@@ -127,11 +133,23 @@ class AdjustSizeSpec: QuickSpec {
127133 expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 60.0 ) ) )
128134 }
129135
136+ it ( " should warn about -NaN width value " ) {
137+ aView. pin. width ( - CGFloat. nan)
138+ expect ( Pin . lastWarningText) . to ( contain ( [ " width " , " nan " , " won't be applied " , " the width " , " must be greater than or equal to zero " ] ) )
139+ expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 60.0 ) ) )
140+ }
141+
130142 it ( " should warn about infinity width value " ) {
131143 aView. pin. width ( CGFloat . infinity)
132144 expect ( Pin . lastWarningText) . to ( contain ( [ " width " , " inf " , " won't be applied " , " the width " , " must be greater than or equal to zero " ] ) )
133145 expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 60.0 ) ) )
134146 }
147+
148+ it ( " should warn about -infinity width value " ) {
149+ aView. pin. width ( - CGFloat. infinity)
150+ expect ( Pin . lastWarningText) . to ( contain ( [ " width " , " inf " , " won't be applied " , " the width " , " must be greater than or equal to zero " ] ) )
151+ expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 60.0 ) ) )
152+ }
135153 }
136154
137155 describe ( " the result of the height(...) methods " ) {
@@ -166,6 +184,12 @@ class AdjustSizeSpec: QuickSpec {
166184 expect ( aView. frame) . to ( equal ( CGRect ( x: 140.0 , y: 100.0 , width: 100.0 , height: 30.0 ) ) )
167185 }
168186
187+ it ( " should accept a height of 0 " ) {
188+ aView. pin. height ( 0 )
189+ expect ( Pin . lastWarningText) . to ( beNil ( ) )
190+ expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 0.0 ) ) )
191+ }
192+
169193 it ( " should warn about negative height value " ) {
170194 aView. pin. height ( - 2 )
171195 expect ( Pin . lastWarningText) . to ( contain ( [ " height " , " won't be applied " , " the height " , " must be greater than or equal to zero " ] ) )
@@ -178,11 +202,23 @@ class AdjustSizeSpec: QuickSpec {
178202 expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 60.0 ) ) )
179203 }
180204
205+ it ( " should warn about -NaN height value " ) {
206+ aView. pin. height ( - CGFloat. nan)
207+ expect ( Pin . lastWarningText) . to ( contain ( [ " height " , " nan " , " won't be applied " , " the height " , " must be greater than or equal to zero " ] ) )
208+ expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 60.0 ) ) )
209+ }
210+
181211 it ( " should warn about infinity height value " ) {
182212 aView. pin. height ( CGFloat . infinity)
183213 expect ( Pin . lastWarningText) . to ( contain ( [ " height " , " inf " , " won't be applied " , " the height " , " must be greater than or equal to zero " ] ) )
184214 expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 60.0 ) ) )
185215 }
216+
217+ it ( " should warn about -infinity height value " ) {
218+ aView. pin. height ( - CGFloat. infinity)
219+ expect ( Pin . lastWarningText) . to ( contain ( [ " height " , " inf " , " won't be applied " , " the height " , " must be greater than or equal to zero " ] ) )
220+ expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 60.0 ) ) )
221+ }
186222 }
187223
188224 describe ( " the result of the size(...) methods " ) {
0 commit comments