@@ -108,3 +108,150 @@ test('annotateAndroidScrollableContentHints marks bottomed-out scroll areas with
108108 assert . equal ( nodes [ 0 ] . hiddenContentAbove , true ) ;
109109 assert . equal ( nodes [ 0 ] . hiddenContentBelow , undefined ) ;
110110} ) ;
111+
112+ test ( 'annotateAndroidScrollableContentHints infers bottomed-out scroll areas from a single aligned block' , ( ) => {
113+ const nodes : RawSnapshotNode [ ] = [
114+ {
115+ index : 0 ,
116+ type : 'android.widget.ScrollView' ,
117+ label : 'Messages' ,
118+ rect : { x : 0 , y : 100 , width : 390 , height : 500 } ,
119+ depth : 0 ,
120+ } ,
121+ {
122+ index : 1 ,
123+ type : 'android.view.ViewGroup' ,
124+ rect : { x : 0 , y : 100 , width : 390 , height : 500 } ,
125+ depth : 1 ,
126+ parentIndex : 0 ,
127+ } ,
128+ {
129+ index : 2 ,
130+ type : 'android.view.ViewGroup' ,
131+ rect : { x : 0 , y : 432 , width : 390 , height : 168 } ,
132+ depth : 2 ,
133+ parentIndex : 1 ,
134+ } ,
135+ ] ;
136+
137+ const dump = [
138+ ' com.facebook.react.views.scroll.ReactScrollView{d32a800 VFED.V... ........ 0,0-390,500 #4b2}' ,
139+ ' com.facebook.react.views.view.ReactViewGroup{77d31ae V.E...... ........ 0,0-390,804 #4b0}' ,
140+ ' com.facebook.react.views.view.ReactViewGroup{c V.E...... ........ 0,636-390,804 #3}' ,
141+ ] . join ( '\n' ) ;
142+
143+ annotateAndroidScrollableContentHints ( nodes , dump ) ;
144+
145+ assert . equal ( nodes [ 0 ] . hiddenContentAbove , true ) ;
146+ assert . equal ( nodes [ 0 ] . hiddenContentBelow , undefined ) ;
147+ } ) ;
148+
149+ test ( 'annotateAndroidScrollableContentHints infers virtualized scroll coverage without a unique block offset' , ( ) => {
150+ const nodes : RawSnapshotNode [ ] = [
151+ {
152+ index : 0 ,
153+ type : 'android.widget.ScrollView' ,
154+ label : 'Messages' ,
155+ rect : { x : 0 , y : 100 , width : 390 , height : 500 } ,
156+ depth : 0 ,
157+ } ,
158+ {
159+ index : 1 ,
160+ type : 'android.view.ViewGroup' ,
161+ rect : { x : 0 , y : 100 , width : 390 , height : 500 } ,
162+ depth : 1 ,
163+ parentIndex : 0 ,
164+ } ,
165+ {
166+ index : 2 ,
167+ type : 'android.view.ViewGroup' ,
168+ rect : { x : 0 , y : 100 , width : 390 , height : 143 } ,
169+ depth : 2 ,
170+ parentIndex : 1 ,
171+ } ,
172+ ...Array . from ( { length : 11 } , ( _value , index ) => ( {
173+ index : index + 3 ,
174+ type : 'android.view.ViewGroup' ,
175+ rect : { x : 0 , y : 243 + index * 192 , width : 390 , height : 192 } ,
176+ depth : 2 ,
177+ parentIndex : 1 ,
178+ } ) ) ,
179+ ] ;
180+
181+ const dump = [
182+ ' com.facebook.react.views.scroll.ReactScrollView{d32a800 VFED.V... ........ 0,0-390,500 #4b2}' ,
183+ ' com.facebook.react.views.view.ReactViewGroup{77d31ae V.E...... ........ 0,0-390,853 #4b0}' ,
184+ ' com.facebook.react.views.view.ReactViewGroup{a V.E...... ........ 0,285-390,477 #1}' ,
185+ ' com.facebook.react.views.view.ReactViewGroup{b V.E...... ........ 0,477-390,669 #2}' ,
186+ ' com.facebook.react.views.view.ReactViewGroup{c V.E...... ........ 0,669-390,861 #3}' ,
187+ ' com.facebook.react.views.view.ReactViewGroup{d V.E...... ........ 0,861-390,1053 #4}' ,
188+ ' com.facebook.react.views.view.ReactViewGroup{e V.E...... ........ 0,1053-390,1245 #5}' ,
189+ ' com.facebook.react.views.view.ReactViewGroup{f V.E...... ........ 0,1245-390,1437 #6}' ,
190+ ] . join ( '\n' ) ;
191+
192+ annotateAndroidScrollableContentHints ( nodes , dump ) ;
193+
194+ assert . equal ( nodes [ 0 ] . hiddenContentAbove , true ) ;
195+ assert . equal ( nodes [ 0 ] . hiddenContentBelow , true ) ;
196+ } ) ;
197+
198+ test ( 'annotateAndroidScrollableContentHints keeps shallow offset matching for fully mounted content' , ( ) => {
199+ const nodes : RawSnapshotNode [ ] = [
200+ {
201+ index : 0 ,
202+ type : 'android.widget.ScrollView' ,
203+ label : 'Messages' ,
204+ rect : { x : 0 , y : 100 , width : 390 , height : 500 } ,
205+ depth : 0 ,
206+ } ,
207+ {
208+ index : 1 ,
209+ type : 'android.view.ViewGroup' ,
210+ rect : { x : 0 , y : 100 , width : 390 , height : 500 } ,
211+ depth : 1 ,
212+ parentIndex : 0 ,
213+ } ,
214+ {
215+ index : 2 ,
216+ type : 'android.view.ViewGroup' ,
217+ rect : { x : 0 , y : 100 , width : 390 , height : 100 } ,
218+ depth : 2 ,
219+ parentIndex : 1 ,
220+ } ,
221+ {
222+ index : 3 ,
223+ type : 'android.view.ViewGroup' ,
224+ rect : { x : 0 , y : 200 , width : 390 , height : 180 } ,
225+ depth : 2 ,
226+ parentIndex : 1 ,
227+ } ,
228+ {
229+ index : 4 ,
230+ type : 'android.view.ViewGroup' ,
231+ rect : { x : 0 , y : 380 , width : 390 , height : 120 } ,
232+ depth : 2 ,
233+ parentIndex : 1 ,
234+ } ,
235+ {
236+ index : 5 ,
237+ type : 'android.view.ViewGroup' ,
238+ rect : { x : 0 , y : 500 , width : 390 , height : 100 } ,
239+ depth : 2 ,
240+ parentIndex : 1 ,
241+ } ,
242+ ] ;
243+
244+ const dump = [
245+ ' com.facebook.react.views.scroll.ReactScrollView{d32a800 VFED.V... ........ 0,0-390,500 #4b2}' ,
246+ ' com.facebook.react.views.view.ReactViewGroup{77d31ae V.E...... ........ 0,0-390,520 #4b0}' ,
247+ ' com.facebook.react.views.view.ReactViewGroup{a V.E...... ........ 0,20-390,120 #1}' ,
248+ ' com.facebook.react.views.view.ReactViewGroup{b V.E...... ........ 0,120-390,300 #2}' ,
249+ ' com.facebook.react.views.view.ReactViewGroup{c V.E...... ........ 0,300-390,420 #3}' ,
250+ ' com.facebook.react.views.view.ReactViewGroup{d V.E...... ........ 0,420-390,520 #4}' ,
251+ ] . join ( '\n' ) ;
252+
253+ annotateAndroidScrollableContentHints ( nodes , dump ) ;
254+
255+ assert . equal ( nodes [ 0 ] . hiddenContentAbove , true ) ;
256+ assert . equal ( nodes [ 0 ] . hiddenContentBelow , undefined ) ;
257+ } ) ;
0 commit comments