Skip to content

Commit 9dfd4c4

Browse files
committed
Add tests for setGap
1 parent 48f0644 commit 9dfd4c4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Tests/FlexLayoutTests/WidthSizeContentTests.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ final class WidthSizeContentTests: XCTestCase {
1818
var viewController: UIViewController!
1919
var rootFlexContainer: UIView!
2020
var aView: UIView!
21+
var bView: UIView!
2122

2223
override func setUp() {
2324
super.setUp()
@@ -29,6 +30,7 @@ final class WidthSizeContentTests: XCTestCase {
2930
viewController.view.addSubview(rootFlexContainer)
3031

3132
aView = UIView()
33+
bView = UIView()
3234
}
3335

3436
func test_basis_adjust_aView_size_and_position() {
@@ -159,4 +161,17 @@ final class WidthSizeContentTests: XCTestCase {
159161
rootFlexContainer.flex.layout()
160162
XCTAssertEqual(aView.frame, CGRect(x: 0.0, y: 0.0, width: 400.0, height: 200.0))
161163
}
164+
165+
func test_gap() {
166+
rootFlexContainer.flex.direction(.row).define { flex in
167+
flex.addItem(aView).height(100).width(100)
168+
flex.addItem(bView).height(100).width(100)
169+
flex.alignItems(.start)
170+
171+
flex.setGap(.row, 50)
172+
}
173+
174+
rootFlexContainer.flex.layout()
175+
XCTAssertEqual(bView.frame, CGRect(x: 150.0, y: 0.0, width: 100.0, height: 100.0))
176+
}
162177
}

0 commit comments

Comments
 (0)