Skip to content

Commit e74ab0a

Browse files
committed
Add start end all inset test cases
1 parent fd74198 commit e74ab0a

File tree

1 file changed

+50
-2
lines changed

1 file changed

+50
-2
lines changed

Tests/FlexLayoutTests/InsetTests.swift

+50-2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ final class InsetTests: XCTestCase {
6363
XCTAssertEqual(aView.frame, CGRect(x: 0.0, y: -10.0, width: 400.0, height: 400.0))
6464
}
6565

66+
func test_adjust_the_aView_size_and_relative_position_with_start() {
67+
rootFlexContainer.flex.define { flex in
68+
flex.addItem(aView).position(.relative).grow(1).start(10)
69+
}
70+
rootFlexContainer.flex.layout()
71+
XCTAssertEqual(aView.frame, CGRect(x: 10.0, y: 0.0, width: 400.0, height: 400.0))
72+
}
73+
74+
func test_adjust_the_aView_size_and_relative_position_with_end() {
75+
rootFlexContainer.flex.define { flex in
76+
flex.addItem(aView).position(.relative).grow(1).end(10)
77+
}
78+
rootFlexContainer.flex.layout()
79+
XCTAssertEqual(aView.frame, CGRect(x: -10.0, y: 0.0, width: 400.0, height: 400.0))
80+
}
81+
6682
func test_adjust_the_aView_size_and_relative_position_with_horizontally() {
6783
rootFlexContainer.flex.define { flex in
6884
flex.addItem(aView).position(.relative).grow(1).horizontally(10)
@@ -79,6 +95,14 @@ final class InsetTests: XCTestCase {
7995
XCTAssertEqual(aView.frame, CGRect(x: 0.0, y: 10.0, width: 400.0, height: 400.0))
8096
}
8197

98+
func test_adjust_the_aView_size_and_relative_position_with_all() {
99+
rootFlexContainer.flex.define { flex in
100+
flex.addItem(aView).position(.relative).grow(1).all(10)
101+
}
102+
rootFlexContainer.flex.layout()
103+
XCTAssertEqual(aView.frame, CGRect(x: 10.0, y: 10.0, width: 400.0, height: 400.0))
104+
}
105+
82106
func test_adjust_the_aView_size_absolute_position_with_left_right() {
83107
rootFlexContainer.flex.define { flex in
84108
flex.addItem(aView).position(.absolute).left(10).right(10).width(300).height(200)
@@ -88,7 +112,7 @@ final class InsetTests: XCTestCase {
88112
XCTAssertEqual(aView.frame, CGRect(x: 10.0, y: 0.0, width: 300.0, height: 200.0))
89113
}
90114

91-
func test_adjust_the_aView_size_absolute_position_with_right() {
115+
func test_adjust_the_aView_size_absolute_position_with_right_and_reset_left_later() {
92116
rootFlexContainer.flex.define { flex in
93117
flex.addItem(aView).position(.absolute).left(10).right(10).width(300).height(200)
94118
}
@@ -108,7 +132,7 @@ final class InsetTests: XCTestCase {
108132
XCTAssertEqual(aView.frame, CGRect(x: 15.0, y: 20.0, width: 370.0, height: 360.0))
109133
}
110134

111-
func test_adjust_the_aView_size_absolute_position_with_horizontally_all() {
135+
func test_adjust_the_aView_size_absolute_position_with_all() {
112136
rootFlexContainer.flex.define { flex in
113137
flex.addItem(aView).position(.absolute).all(45)
114138
}
@@ -149,6 +173,22 @@ final class InsetTests: XCTestCase {
149173
XCTAssertEqual(aView.frame, CGRect(x: 0.0, y: 0.0, width: 400.0, height: 400.0))
150174
}
151175

176+
func test_adjust_the_aView_size_and_static_position_with_start() {
177+
rootFlexContainer.flex.define { flex in
178+
flex.addItem(aView).position(.static).grow(1).start(10)
179+
}
180+
rootFlexContainer.flex.layout()
181+
XCTAssertEqual(aView.frame, CGRect(x: 0.0, y: 0.0, width: 400.0, height: 400.0))
182+
}
183+
184+
func test_adjust_the_aView_size_and_static_position_with_end() {
185+
rootFlexContainer.flex.define { flex in
186+
flex.addItem(aView).position(.static).grow(1).end(10)
187+
}
188+
rootFlexContainer.flex.layout()
189+
XCTAssertEqual(aView.frame, CGRect(x: 0.0, y: 0.0, width: 400.0, height: 400.0))
190+
}
191+
152192
func test_adjust_the_aView_size_and_static_position_with_horizontally() {
153193
rootFlexContainer.flex.define { flex in
154194
flex.addItem(aView).position(.static).grow(1).horizontally(10)
@@ -164,4 +204,12 @@ final class InsetTests: XCTestCase {
164204
rootFlexContainer.flex.layout()
165205
XCTAssertEqual(aView.frame, CGRect(x: 0.0, y: 0.0, width: 400.0, height: 400.0))
166206
}
207+
208+
func test_adjust_the_aView_size_and_static_position_with_all() {
209+
rootFlexContainer.flex.define { flex in
210+
flex.addItem(aView).position(.static).grow(1).all(10)
211+
}
212+
rootFlexContainer.flex.layout()
213+
XCTAssertEqual(aView.frame, CGRect(x: 0.0, y: 0.0, width: 400.0, height: 400.0))
214+
}
167215
}

0 commit comments

Comments
 (0)