@@ -405,7 +405,31 @@ void main() {
405405 });
406406
407407 group ('presents message content appropriately' , () {
408- testWidgets ('content not asked to consume insets (including bottom), even without compose box' , (tester) async {
408+ testWidgets ('content not asked to consume insets (including bottom), even without compose box, in top sliver' , (tester) async {
409+ // Regression test for: https://github.com/zulip/zulip-flutter/issues/1523
410+ const fakePadding = FakeViewPadding (left: 10 , top: 10 , right: 10 , bottom: 10 );
411+ tester.view.viewInsets = fakePadding;
412+ tester.view.padding = fakePadding;
413+
414+ await setupMessageListPage (tester, narrow: const CombinedFeedNarrow (),
415+ messages: [
416+ eg.streamMessage (content: ContentExample .codeBlockPlain.html),
417+ eg.streamMessage (),
418+ ]);
419+
420+ // Verify this message list lacks a compose box.
421+ // (The original bug wouldn't reproduce with a compose box present.)
422+ final state = MessageListPage .ancestorOf (tester.element (find.text ("verb\n atim" )));
423+ check (state.composeBoxState).isNull ();
424+ // Also verify that the first message is in the top sliver.
425+ check (state.model! .middleMessage).equals (1 );
426+
427+ final element = tester.element (find.byType (CodeBlock ));
428+ final padding = MediaQuery .of (element).padding;
429+ check (padding).equals (EdgeInsets .zero);
430+ });
431+
432+ testWidgets ('content not asked to consume insets (including bottom), even without compose box, in bottom sliver' , (tester) async {
409433 // Regression test for: https://github.com/zulip/zulip-flutter/issues/736
410434 const fakePadding = FakeViewPadding (left: 10 , top: 10 , right: 10 , bottom: 10 );
411435 tester.view.viewInsets = fakePadding;
@@ -418,6 +442,8 @@ void main() {
418442 // (The original bug wouldn't reproduce with a compose box present.)
419443 final state = MessageListPage .ancestorOf (tester.element (find.text ("verb\n atim" )));
420444 check (state.composeBoxState).isNull ();
445+ // Also verify that the message is in the bottom sliver.
446+ check (state.model! .middleMessage).equals (0 );
421447
422448 final element = tester.element (find.byType (CodeBlock ));
423449 final padding = MediaQuery .of (element).padding;
0 commit comments