@@ -21,13 +21,13 @@ final class InsetTests: XCTestCase {
21
21
22
22
override func setUp( ) {
23
23
super. setUp ( )
24
-
24
+
25
25
viewController = UIViewController ( )
26
-
26
+
27
27
rootFlexContainer = UIView ( )
28
28
rootFlexContainer. frame = CGRect ( x: 0 , y: 0 , width: 400 , height: 400 )
29
29
viewController. view. addSubview ( rootFlexContainer)
30
-
30
+
31
31
aView = UIView ( )
32
32
}
33
33
@@ -78,4 +78,42 @@ final class InsetTests: XCTestCase {
78
78
rootFlexContainer. flex. layout ( )
79
79
XCTAssertEqual ( aView. frame, CGRect ( x: 0.0 , y: 10.0 , width: 400.0 , height: 400.0 ) )
80
80
}
81
+
82
+ func test_adjust_the_aView_size_absolute_position_with_left_right( ) {
83
+ rootFlexContainer. flex. define { flex in
84
+ flex. addItem ( aView) . position ( . absolute) . left ( 10 ) . right ( 10 ) . width ( 300 ) . height ( 200 )
85
+ }
86
+
87
+ rootFlexContainer. flex. layout ( )
88
+ XCTAssertEqual ( aView. frame, CGRect ( x: 10.0 , y: 0.0 , width: 300.0 , height: 200.0 ) )
89
+ }
90
+
91
+ func test_adjust_the_aView_size_absolute_position_with_right( ) {
92
+ rootFlexContainer. flex. define { flex in
93
+ flex. addItem ( aView) . position ( . absolute) . left ( 10 ) . right ( 10 ) . width ( 300 ) . height ( 200 )
94
+ }
95
+
96
+ // Later reset the aspectRatio
97
+ aView. flex. left ( 0 )
98
+ rootFlexContainer. flex. layout ( )
99
+ XCTAssertEqual ( aView. frame, CGRect ( x: 0.0 , y: 0.0 , width: 300.0 , height: 200.0 ) )
100
+ }
101
+
102
+ func test_adjust_the_aView_size_absolute_position_with_horizontally_vertically( ) {
103
+ rootFlexContainer. flex. define { flex in
104
+ flex. addItem ( aView) . position ( . absolute) . horizontally ( 15 ) . vertically ( 20 )
105
+ }
106
+
107
+ rootFlexContainer. flex. layout ( )
108
+ XCTAssertEqual ( aView. frame, CGRect ( x: 15.0 , y: 20.0 , width: 370.0 , height: 360.0 ) )
109
+ }
110
+
111
+ func test_adjust_the_aView_size_absolute_position_with_horizontally_all( ) {
112
+ rootFlexContainer. flex. define { flex in
113
+ flex. addItem ( aView) . position ( . absolute) . all ( 45 )
114
+ }
115
+
116
+ rootFlexContainer. flex. layout ( )
117
+ XCTAssertEqual ( aView. frame, CGRect ( x: 45.0 , y: 45.0 , width: 310.0 , height: 310.0 ) )
118
+ }
81
119
}
0 commit comments