Skip to content

Commit

Permalink
[flutter_markdown] Change the way tests get screen size (flutter#4514)
Browse files Browse the repository at this point in the history
As of flutter#125003 the current method these tests use to get the screen width throws an exception, since it assumes that the first widget in the tree has certain properties. To make the test more robust, this get the width of the outmost Column, which is part of the test setup, rather than whatever the first widget is.

Unblocks the flutter->packgaes roller.
  • Loading branch information
stuartmorgan authored Jul 19, 2023
1 parent 7f07f66 commit f16ba32
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/flutter_markdown/test/list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ void defineTests() {
),
);

final double screenWidth = tester.allElements.first.size!.width;
final double screenWidth =
find.byType(Column).evaluate().first.size!.width;
final double markdownBodyWidth =
find.byType(MarkdownBody).evaluate().single.size!.width;

Expand All @@ -225,7 +226,8 @@ void defineTests() {
),
);

final double screenWidth = tester.allElements.first.size!.width;
final double screenWidth =
find.byType(Column).evaluate().first.size!.width;
final double markdownBodyWidth =
find.byType(MarkdownBody).evaluate().single.size!.width;

Expand Down

0 comments on commit f16ba32

Please sign in to comment.