@@ -114,6 +114,24 @@ class AdjustSizeSpec: QuickSpec {
114114 aView. pin. width ( of: aViewChild)
115115 expect ( aView. frame) . to ( equal ( CGRect ( x: 140.0 , y: 100.0 , width: 50.0 , height: 60.0 ) ) )
116116 }
117+
118+ it ( " should warn about negative width value " ) {
119+ aView. pin. width ( - 2 )
120+ expect ( Pin . lastWarningText) . to ( contain ( [ " width " , " won't be applied " , " the width " , " must be greater than or equal to zero " ] ) )
121+ expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 60.0 ) ) )
122+ }
123+
124+ it ( " should warn about NaN width value " ) {
125+ aView. pin. width ( CGFloat . nan)
126+ expect ( Pin . lastWarningText) . to ( contain ( [ " width " , " nan " , " won't be applied " , " the width " , " must be greater than or equal to zero " ] ) )
127+ expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 60.0 ) ) )
128+ }
129+
130+ it ( " should warn about infinity width value " ) {
131+ aView. pin. width ( CGFloat . infinity)
132+ expect ( Pin . lastWarningText) . to ( contain ( [ " width " , " inf " , " won't be applied " , " the width " , " must be greater than or equal to zero " ] ) )
133+ expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 60.0 ) ) )
134+ }
117135 }
118136
119137 describe ( " the result of the height(...) methods " ) {
@@ -147,6 +165,24 @@ class AdjustSizeSpec: QuickSpec {
147165 aView. pin. height ( of: aViewChild)
148166 expect ( aView. frame) . to ( equal ( CGRect ( x: 140.0 , y: 100.0 , width: 100.0 , height: 30.0 ) ) )
149167 }
168+
169+ it ( " should warn about negative height value " ) {
170+ aView. pin. height ( - 2 )
171+ expect ( Pin . lastWarningText) . to ( contain ( [ " height " , " won't be applied " , " the height " , " must be greater than or equal to zero " ] ) )
172+ expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 60.0 ) ) )
173+ }
174+
175+ it ( " should warn about NaN height value " ) {
176+ aView. pin. height ( CGFloat . nan)
177+ expect ( Pin . lastWarningText) . to ( contain ( [ " height " , " nan " , " won't be applied " , " the height " , " must be greater than or equal to zero " ] ) )
178+ expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 60.0 ) ) )
179+ }
180+
181+ it ( " should warn about infinity height value " ) {
182+ aView. pin. height ( CGFloat . infinity)
183+ expect ( Pin . lastWarningText) . to ( contain ( [ " height " , " inf " , " won't be applied " , " the height " , " must be greater than or equal to zero " ] ) )
184+ expect ( aView. frame) . to ( equal ( CGRect ( x: 140 , y: 100.0 , width: 100.0 , height: 60.0 ) ) )
185+ }
150186 }
151187
152188 describe ( " the result of the size(...) methods " ) {
0 commit comments