@@ -131,6 +131,37 @@ void main() {
131
131
check (itemCount (tester)).equals (301 );
132
132
}, skip: true ); // TODO this still reproduces manually, still needs debugging,
133
133
// but has become harder to reproduce in a test.
134
+
135
+ testWidgets ("avoid getting distracted by nested viewports' metrics" , (tester) async {
136
+ // Regression test for: https://github.com/zulip/zulip-flutter/issues/507
137
+ await setupMessageListPage (tester, foundOldest: false , messages: [
138
+ ...List .generate (300 , (i) => eg.streamMessage (id: 1000 + i)),
139
+ eg.streamMessage (id: 1301 , content: '<div class="codehilite"><pre><span></span><code>verb\n atim\n </code></pre></div>' ),
140
+ ...List .generate (100 , (i) => eg.streamMessage (id: 1302 + i)),
141
+ ]);
142
+ final lastRequest = connection.lastRequest;
143
+ check (itemCount (tester)).equals (404 );
144
+
145
+ // Fling-scroll upward...
146
+ await tester.fling (find.byType (MessageListPage ), const Offset (0 , 300 ), 8000 );
147
+ await tester.pump ();
148
+
149
+ // ... in particular past the message with a [CodeBlockNode]...
150
+ bool sawCodeBlock = false ;
151
+ for (int i = 0 ; i < 30 ; i++ ) {
152
+ await tester.pump (const Duration (milliseconds: 100 ));
153
+ if (tester.widgetList (find.byType (CodeBlock )).isNotEmpty) {
154
+ sawCodeBlock = true ;
155
+ break ;
156
+ }
157
+ }
158
+ check (sawCodeBlock).isTrue ();
159
+
160
+ // ... and we should attempt no fetches. (This check isn't strictly
161
+ // necessary; a request would have thrown, as we prepared no response.)
162
+ await tester.pump ();
163
+ check (connection.lastRequest).identicalTo (lastRequest);
164
+ });
134
165
});
135
166
136
167
group ('ScrollToBottomButton interactions' , () {
0 commit comments