@@ -31,6 +31,7 @@ class TestNSGeometry : XCTestCase {
31
31
( " test_CGSize_BasicConstruction " , test_CGSize_BasicConstruction) ,
32
32
( " test_CGSize_ExtendedConstruction " , test_CGSize_ExtendedConstruction) ,
33
33
( " test_CGRect_BasicConstruction " , test_CGRect_BasicConstruction) ,
34
+ ( " test_CGRect_ExtendedConstruction " , test_CGRect_ExtendedConstruction) ,
34
35
( " test_NSEdgeInsets_BasicConstruction " , test_NSEdgeInsets_BasicConstruction) ,
35
36
( " test_NSEdgeInsetsEqual " , test_NSEdgeInsetsEqual) ,
36
37
( " test_NSMakePoint " , test_NSMakePoint) ,
@@ -168,6 +169,32 @@ class TestNSGeometry : XCTestCase {
168
169
XCTAssertEqual ( r2. size. width, s. width)
169
170
XCTAssertEqual ( r2. size. height, s. height)
170
171
}
172
+
173
+ func test_CGRect_ExtendedConstruction( ) {
174
+ let r1 = CGRect . zero
175
+ XCTAssertEqual ( r1. origin. x, CGFloat ( 0.0 ) )
176
+ XCTAssertEqual ( r1. origin. y, CGFloat ( 0.0 ) )
177
+ XCTAssertEqual ( r1. size. width, CGFloat ( 0.0 ) )
178
+ XCTAssertEqual ( r1. size. height, CGFloat ( 0.0 ) )
179
+
180
+ let r2 = CGRect ( x: CGFloat ( 1.2 ) , y: CGFloat ( 2.3 ) , width: CGFloat ( 3.4 ) , height: CGFloat ( 4.5 ) )
181
+ XCTAssertEqual ( r2. origin. x, CGFloat ( 1.2 ) )
182
+ XCTAssertEqual ( r2. origin. y, CGFloat ( 2.3 ) )
183
+ XCTAssertEqual ( r2. size. width, CGFloat ( 3.4 ) )
184
+ XCTAssertEqual ( r2. size. height, CGFloat ( 4.5 ) )
185
+
186
+ let r3 = CGRect ( x: Double ( 1.2 ) , y: Double ( 2.3 ) , width: Double ( 3.4 ) , height: Double ( 4.5 ) )
187
+ XCTAssertEqual ( r3. origin. x, CGFloat ( 1.2 ) )
188
+ XCTAssertEqual ( r3. origin. y, CGFloat ( 2.3 ) )
189
+ XCTAssertEqual ( r3. size. width, CGFloat ( 3.4 ) )
190
+ XCTAssertEqual ( r3. size. height, CGFloat ( 4.5 ) )
191
+
192
+ let r4 = CGRect ( x: Int ( 1 ) , y: Int ( 2 ) , width: Int ( 3 ) , height: Int ( 4 ) )
193
+ XCTAssertEqual ( r4. origin. x, CGFloat ( 1 ) )
194
+ XCTAssertEqual ( r4. origin. y, CGFloat ( 2 ) )
195
+ XCTAssertEqual ( r4. size. width, CGFloat ( 3 ) )
196
+ XCTAssertEqual ( r4. size. height, CGFloat ( 4 ) )
197
+ }
171
198
172
199
func test_NSEdgeInsets_BasicConstruction( ) {
173
200
let i1 = NSEdgeInsets ( )
0 commit comments