forked from firka/flutter
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.
This commit is contained in:
@@ -283,6 +283,7 @@ Widget simpleListTest({
|
||||
Clip? clipBehavior,
|
||||
}) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: Scaffold(
|
||||
body: SimpleListTableView(
|
||||
mainAxis: mainAxis,
|
||||
|
||||
@@ -161,14 +161,27 @@ void main() {
|
||||
));
|
||||
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) {
|
||||
case TargetPlatform.android:
|
||||
case TargetPlatform.fuchsia:
|
||||
expectModalRoute();
|
||||
expect(find.byType(GlowingOverscrollIndicator), findsNWidgets(2));
|
||||
expect(find.byType(RepaintBoundary), findsNWidgets(7));
|
||||
|
||||
case TargetPlatform.android:
|
||||
case TargetPlatform.iOS:
|
||||
case TargetPlatform.linux:
|
||||
case TargetPlatform.macOS:
|
||||
case TargetPlatform.windows:
|
||||
expectModalRoute();
|
||||
expect(find.byType(RepaintBoundary), findsNWidgets(3));
|
||||
}
|
||||
|
||||
@@ -183,13 +196,17 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
switch (defaultTargetPlatform) {
|
||||
case TargetPlatform.android:
|
||||
case TargetPlatform.fuchsia:
|
||||
expectModalRoute();
|
||||
expect(find.byType(GlowingOverscrollIndicator), findsNWidgets(2));
|
||||
expect(find.byType(RepaintBoundary), findsNWidgets(6));
|
||||
|
||||
case TargetPlatform.android:
|
||||
case TargetPlatform.iOS:
|
||||
case TargetPlatform.linux:
|
||||
case TargetPlatform.macOS:
|
||||
case TargetPlatform.windows:
|
||||
expectModalRoute();
|
||||
expect(find.byType(RepaintBoundary), findsNWidgets(2));
|
||||
}
|
||||
}, variant: TargetPlatformVariant.all());
|
||||
|
||||
Reference in New Issue
Block a user