Unverified Commit e72b4717 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Use Material3 in the 2D viewport tests (#128155)

Set `useMaterial3: true' for the MaterialApp used in the 2D tests to enable making  `useMaterial3: true' the default for ThemeData in a future PR.
parent d095f10b
...@@ -283,6 +283,7 @@ Widget simpleListTest({ ...@@ -283,6 +283,7 @@ Widget simpleListTest({
Clip? clipBehavior, Clip? clipBehavior,
}) { }) {
return MaterialApp( return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold( home: Scaffold(
body: SimpleListTableView( body: SimpleListTableView(
mainAxis: mainAxis, mainAxis: mainAxis,
......
...@@ -161,14 +161,27 @@ void main() { ...@@ -161,14 +161,27 @@ void main() {
)); ));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
// In the tests below the number of RepaintBoundary widgets depends on:
// ModalRoute - builds 2
// GlowingOverscrollIndicator - builds 2
// TwoDimensionalChildListDelegate - builds 1 unless addRepaintBoundaries is false
void expectModalRoute() {
expect(ModalRoute.of(tester.element(find.byType(SimpleListTableViewport))), isA<MaterialPageRoute<void>>());
}
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
expectModalRoute();
expect(find.byType(GlowingOverscrollIndicator), findsNWidgets(2));
expect(find.byType(RepaintBoundary), findsNWidgets(7)); expect(find.byType(RepaintBoundary), findsNWidgets(7));
case TargetPlatform.android:
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.linux: case TargetPlatform.linux:
case TargetPlatform.macOS: case TargetPlatform.macOS:
case TargetPlatform.windows: case TargetPlatform.windows:
expectModalRoute();
expect(find.byType(RepaintBoundary), findsNWidgets(3)); expect(find.byType(RepaintBoundary), findsNWidgets(3));
} }
...@@ -183,13 +196,17 @@ void main() { ...@@ -183,13 +196,17 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
expectModalRoute();
expect(find.byType(GlowingOverscrollIndicator), findsNWidgets(2));
expect(find.byType(RepaintBoundary), findsNWidgets(6)); expect(find.byType(RepaintBoundary), findsNWidgets(6));
case TargetPlatform.android:
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.linux: case TargetPlatform.linux:
case TargetPlatform.macOS: case TargetPlatform.macOS:
case TargetPlatform.windows: case TargetPlatform.windows:
expectModalRoute();
expect(find.byType(RepaintBoundary), findsNWidgets(2)); expect(find.byType(RepaintBoundary), findsNWidgets(2));
} }
}, variant: TargetPlatformVariant.all()); }, variant: TargetPlatformVariant.all());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment