@@ -44,7 +44,7 @@ class ComposeView_ClippingTests: XCTestCase {
4444 }
4545 contentView. refresh ( animated: false )
4646
47- // should not clip
47+ // should not clip by default (auto mode)
4848 expect ( contentView. clipsToBounds) == false
4949 #if canImport(AppKit)
5050 expect ( contentView. contentView. clipsToBounds) == false
@@ -53,6 +53,7 @@ class ComposeView_ClippingTests: XCTestCase {
5353 // when set to always clipping
5454 contentView. clippingBehavior = . always
5555 contentView. refresh ( animated: false )
56+ // then it should clip
5657 expect ( contentView. clipsToBounds) == true
5758 #if canImport(AppKit)
5859 expect ( contentView. contentView. clipsToBounds) == true
@@ -61,12 +62,41 @@ class ComposeView_ClippingTests: XCTestCase {
6162 // when set to never clipping
6263 contentView. clippingBehavior = . never
6364 contentView. refresh ( animated: false )
65+ // then it should not clip
66+ expect ( contentView. clipsToBounds) == false
67+ #if canImport(AppKit)
68+ expect ( contentView. contentView. clipsToBounds) == false
69+ #endif
70+
71+ // when set to manual mode
72+ contentView. clippingBehavior = . manual
73+ contentView. refresh ( animated: false )
74+ // then it should not change
75+ expect ( contentView. clipsToBounds) == false
76+ #if canImport(AppKit)
77+ expect ( contentView. contentView. clipsToBounds) == false
78+ #endif
79+
80+ // when manually flip the clipsToBounds value
81+ contentView. clipsToBounds = true
82+ contentView. refresh ( animated: false )
83+ // then it should follow the manual setting
84+ expect ( contentView. clipsToBounds) == true
85+ #if canImport(AppKit)
86+ expect ( contentView. contentView. clipsToBounds) == true
87+ #endif
88+
89+ // when manually set the clipsToBounds again
90+ contentView. clipsToBounds = false
91+ contentView. refresh ( animated: false )
92+ // then it should follow the manual setting
6493 expect ( contentView. clipsToBounds) == false
6594 #if canImport(AppKit)
6695 expect ( contentView. contentView. clipsToBounds) == false
6796 #endif
6897 }
6998
99+ // when content size is equal to bounds size
70100 do {
71101 let contentView = ComposeView ( frame: CGRect ( x: 0 , y: 0 , width: 100 , height: 100 ) )
72102 contentView. setContent {
@@ -75,7 +105,7 @@ class ComposeView_ClippingTests: XCTestCase {
75105 }
76106 contentView. refresh ( animated: false )
77107
78- // should not clip
108+ // should not clip by default (auto mode)
79109 expect ( contentView. clipsToBounds) == false
80110 #if canImport(AppKit)
81111 expect ( contentView. contentView. clipsToBounds) == false
@@ -84,6 +114,7 @@ class ComposeView_ClippingTests: XCTestCase {
84114 // when set to always clipping
85115 contentView. clippingBehavior = . always
86116 contentView. refresh ( animated: false )
117+ // then it should clip
87118 expect ( contentView. clipsToBounds) == true
88119 #if canImport(AppKit)
89120 expect ( contentView. contentView. clipsToBounds) == true
@@ -92,6 +123,34 @@ class ComposeView_ClippingTests: XCTestCase {
92123 // when set to never clipping
93124 contentView. clippingBehavior = . never
94125 contentView. refresh ( animated: false )
126+ // then it should not clip
127+ expect ( contentView. clipsToBounds) == false
128+ #if canImport(AppKit)
129+ expect ( contentView. contentView. clipsToBounds) == false
130+ #endif
131+
132+ // when set to manual mode
133+ contentView. clippingBehavior = . manual
134+ contentView. refresh ( animated: false )
135+ // then it should not change
136+ expect ( contentView. clipsToBounds) == false
137+ #if canImport(AppKit)
138+ expect ( contentView. contentView. clipsToBounds) == false
139+ #endif
140+
141+ // when manually flip the clipsToBounds value
142+ contentView. clipsToBounds = true
143+ contentView. refresh ( animated: false )
144+ // then it should follow the manual setting
145+ expect ( contentView. clipsToBounds) == true
146+ #if canImport(AppKit)
147+ expect ( contentView. contentView. clipsToBounds) == true
148+ #endif
149+
150+ // when manually set the clipsToBounds again
151+ contentView. clipsToBounds = false
152+ contentView. refresh ( animated: false )
153+ // then it should follow the manual setting
95154 expect ( contentView. clipsToBounds) == false
96155 #if canImport(AppKit)
97156 expect ( contentView. contentView. clipsToBounds) == false
@@ -107,7 +166,7 @@ class ComposeView_ClippingTests: XCTestCase {
107166 }
108167 contentView. refresh ( animated: false )
109168
110- // should clip
169+ // should clip by default (auto mode)
111170 expect ( contentView. clipsToBounds) == true
112171 #if canImport(AppKit)
113172 expect ( contentView. contentView. clipsToBounds) == true
@@ -116,6 +175,7 @@ class ComposeView_ClippingTests: XCTestCase {
116175 // when set to always clipping
117176 contentView. clippingBehavior = . always
118177 contentView. refresh ( animated: false )
178+ // then it should clip
119179 expect ( contentView. clipsToBounds) == true
120180 #if canImport(AppKit)
121181 expect ( contentView. contentView. clipsToBounds) == true
@@ -124,6 +184,34 @@ class ComposeView_ClippingTests: XCTestCase {
124184 // when set to never clipping
125185 contentView. clippingBehavior = . never
126186 contentView. refresh ( animated: false )
187+ // then it should not clip
188+ expect ( contentView. clipsToBounds) == false
189+ #if canImport(AppKit)
190+ expect ( contentView. contentView. clipsToBounds) == false
191+ #endif
192+
193+ // when set to manual mode
194+ contentView. clippingBehavior = . manual
195+ contentView. refresh ( animated: false )
196+ // then it should not change
197+ expect ( contentView. clipsToBounds) == false
198+ #if canImport(AppKit)
199+ expect ( contentView. contentView. clipsToBounds) == false
200+ #endif
201+
202+ // when manually flip the clipsToBounds value
203+ contentView. clipsToBounds = true
204+ contentView. refresh ( animated: false )
205+ // then it should follow the manual setting
206+ expect ( contentView. clipsToBounds) == true
207+ #if canImport(AppKit)
208+ expect ( contentView. contentView. clipsToBounds) == true
209+ #endif
210+
211+ // when manually set the clipsToBounds again
212+ contentView. clipsToBounds = false
213+ contentView. refresh ( animated: false )
214+ // then it should follow the manual setting
127215 expect ( contentView. clipsToBounds) == false
128216 #if canImport(AppKit)
129217 expect ( contentView. contentView. clipsToBounds) == false
0 commit comments