Skip to content

Commit d4478fb

Browse files
committed
Add static position inset tests
1 parent f842df5 commit d4478fb

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

Tests/FlexLayoutTests/InsetTests.swift

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,52 @@ final class InsetTests: XCTestCase {
116116
rootFlexContainer.flex.layout()
117117
XCTAssertEqual(aView.frame, CGRect(x: 45.0, y: 45.0, width: 310.0, height: 310.0))
118118
}
119+
120+
func test_adjust_the_aView_size_and_relative_static_with_left() {
121+
rootFlexContainer.flex.define { flex in
122+
flex.addItem(aView).position(.static).grow(1).left(10)
123+
}
124+
rootFlexContainer.flex.layout()
125+
XCTAssertEqual(aView.frame, CGRect(x: 0.0, y: 0.0, width: 400.0, height: 400.0))
126+
}
127+
128+
func test_adjust_the_aView_size_and_static_position_with_top() {
129+
rootFlexContainer.flex.define { flex in
130+
flex.addItem(aView).position(.static).grow(1).top(10)
131+
}
132+
rootFlexContainer.flex.layout()
133+
XCTAssertEqual(aView.frame, CGRect(x: 0.0, y: 0.0, width: 400.0, height: 400.0))
134+
}
135+
136+
func test_adjust_the_aView_size_and_static_position_with_right() {
137+
rootFlexContainer.flex.define { flex in
138+
flex.addItem(aView).position(.static).grow(1).right(10)
139+
}
140+
rootFlexContainer.flex.layout()
141+
XCTAssertEqual(aView.frame, CGRect(x: 0.0, y: 0.0, width: 400.0, height: 400.0))
142+
}
143+
144+
func test_adjust_the_aView_size_and_static_position_with_bottom() {
145+
rootFlexContainer.flex.define { flex in
146+
flex.addItem(aView).position(.static).grow(1).bottom(10)
147+
}
148+
rootFlexContainer.flex.layout()
149+
XCTAssertEqual(aView.frame, CGRect(x: 0.0, y: 0.0, width: 400.0, height: 400.0))
150+
}
151+
152+
func test_adjust_the_aView_size_and_static_position_with_horizontally() {
153+
rootFlexContainer.flex.define { flex in
154+
flex.addItem(aView).position(.static).grow(1).horizontally(10)
155+
}
156+
rootFlexContainer.flex.layout()
157+
XCTAssertEqual(aView.frame, CGRect(x: 0.0, y: 0.0, width: 400.0, height: 400.0))
158+
}
159+
160+
func test_adjust_the_aView_size_and_static_position_with_vertically() {
161+
rootFlexContainer.flex.define { flex in
162+
flex.addItem(aView).position(.static).grow(1).vertically(10)
163+
}
164+
rootFlexContainer.flex.layout()
165+
XCTAssertEqual(aView.frame, CGRect(x: 0.0, y: 0.0, width: 400.0, height: 400.0))
166+
}
119167
}

0 commit comments

Comments
 (0)