@@ -19,6 +19,7 @@ final class WidthSizeContentTests: XCTestCase {
19
19
var rootFlexContainer : UIView !
20
20
var aView : UIView !
21
21
var bView : UIView !
22
+ var cView : UIView !
22
23
23
24
override func setUp( ) {
24
25
super. setUp ( )
@@ -31,6 +32,7 @@ final class WidthSizeContentTests: XCTestCase {
31
32
32
33
aView = UIView ( )
33
34
bView = UIView ( )
35
+ cView = UIView ( )
34
36
}
35
37
36
38
func test_basis_adjust_aView_size_and_position( ) {
@@ -162,7 +164,7 @@ final class WidthSizeContentTests: XCTestCase {
162
164
XCTAssertEqual ( aView. frame, CGRect ( x: 0.0 , y: 0.0 , width: 400.0 , height: 200.0 ) )
163
165
}
164
166
165
- func test_gap ( ) {
167
+ func test_gap_in_row_direction ( ) {
166
168
rootFlexContainer. flex. direction ( . row) . define { flex in
167
169
flex. addItem ( aView) . height ( 100 ) . width ( 100 )
168
170
flex. addItem ( bView) . height ( 100 ) . width ( 100 )
@@ -174,4 +176,35 @@ final class WidthSizeContentTests: XCTestCase {
174
176
rootFlexContainer. flex. layout ( )
175
177
XCTAssertEqual ( bView. frame, CGRect ( x: 150.0 , y: 0.0 , width: 100.0 , height: 100.0 ) )
176
178
}
179
+
180
+ func test_gap_in_column_direction( ) {
181
+ rootFlexContainer. flex. direction ( . column) . define { flex in
182
+ flex. addItem ( aView) . height ( 100 ) . width ( 100 )
183
+ flex. addItem ( bView) . height ( 100 ) . width ( 100 )
184
+ flex. alignItems ( . start)
185
+
186
+ flex. setGap ( . column, 50 )
187
+ }
188
+
189
+ rootFlexContainer. flex. layout ( )
190
+ XCTAssertEqual ( bView. frame, CGRect ( x: 0.0 , y: 150.0 , width: 100.0 , height: 100.0 ) )
191
+ }
192
+
193
+ func test_gap_in_all_direction( ) {
194
+ rootFlexContainer. flex. direction ( . column) . define { flex in
195
+ flex. addItem ( aView) . height ( 100 ) . width ( 100 )
196
+ flex. addItem ( bView) . height ( 100 ) . width ( 100 )
197
+ flex. addItem ( ) . direction ( . row) . define { flex in
198
+ flex. addItem ( cView) . height ( 100 ) . width ( 100 )
199
+ }
200
+ flex. alignItems ( . start)
201
+
202
+ flex. setGap ( . all, 50 )
203
+ }
204
+
205
+ rootFlexContainer. flex. layout ( )
206
+
207
+ XCTAssertEqual ( bView. frame, CGRect ( x: 0.0 , y: 150.0 , width: 100.0 , height: 100.0 ) )
208
+ XCTAssertEqual ( cView. frame, CGRect ( x: 150.0 , y: 0.0 , width: 100.0 , height: 100.0 ) )
209
+ }
177
210
}
0 commit comments