Unverified Commit 7d950864 authored by Qun Cheng's avatar Qun Cheng Committed by GitHub

Update golden tests for material (#128839)

parent ed3d4630
......@@ -842,6 +842,7 @@ class _SnackbarDefaultsM2 extends SnackBarThemeData {
@override
TextStyle? get contentTextStyle => ThemeData(
useMaterial3: _theme.useMaterial3,
brightness: _theme.brightness == Brightness.light
? Brightness.dark
: Brightness.light)
......
......@@ -112,7 +112,7 @@ void main() {
testWidgets('The width of the text field should always be the same as the menu view',
(WidgetTester tester) async {
final ThemeData themeData = ThemeData();
final ThemeData themeData = ThemeData(useMaterial3: false);
final bool useMaterial3 = themeData.useMaterial3;
await tester.pumpWidget(
MaterialApp(
......
......@@ -789,7 +789,7 @@ void main() {
await tester.pumpWidget(
wrap(
useMaterial3: theme.useMaterial3,
useMaterial3: false,
child: Column(
children: <Widget>[
IconButton(
......
......@@ -116,6 +116,7 @@ Future<void> _runTest(WidgetTester tester, String positionName, double distanceF
final Key buttonKey = UniqueKey();
await tester.pumpWidget(MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold(
body: Center(
child: RepaintBoundary(
......
......@@ -4488,6 +4488,7 @@ void main() {
// This is a regression test for https://github.com/flutter/flutter/issues/82321
Widget buildFrame(TextDirection textDirection) {
return MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold(
body: Container(
padding: const EdgeInsets.all(16.0),
......@@ -4536,6 +4537,7 @@ void main() {
Widget buildFrame(TextDirection textDirection) {
return MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold(
body: Container(
padding: const EdgeInsets.all(16.0),
......
......@@ -924,6 +924,7 @@ void main() {
final Key painterKey = UniqueKey();
await tester.pumpWidget(MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold(
body: RepaintBoundary(
key: painterKey,
......@@ -962,6 +963,7 @@ void main() {
final Key painterKey = UniqueKey();
await tester.pumpWidget(MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold(
body: RepaintBoundary(
key: painterKey,
......
......@@ -252,6 +252,7 @@ void main() {
RepaintBoundary(
key: key,
child: MaterialApp(
theme: ThemeData(useMaterial3: false),
onGenerateRoute: (RouteSettings settings) {
return MaterialPageRoute<void>(
builder: (BuildContext context) {
......
......@@ -723,7 +723,10 @@ void main() {
final AnimationSheetBuilder animationSheet = AnimationSheetBuilder(frameSize: const Size(50, 50));
await tester.pumpFrames(animationSheet.record(
const _RefreshProgressIndicatorGolden(),
Theme(
data: ThemeData(useMaterial3: false),
child: const _RefreshProgressIndicatorGolden()
),
), const Duration(seconds: 3));
await expectLater(
......@@ -1001,13 +1004,16 @@ void main() {
final AnimationSheetBuilder animationSheet = AnimationSheetBuilder(frameSize: const Size(40, 40));
await tester.pumpFrames(animationSheet.record(
const Directionality(
Theme(
data: ThemeData(useMaterial3: false),
child: const Directionality(
textDirection: TextDirection.ltr,
child: Padding(
padding: EdgeInsets.all(4),
child: CircularProgressIndicator(),
),
),
),
), const Duration(seconds: 2));
await expectLater(
......
......@@ -1101,7 +1101,7 @@ void main() {
return null;
}
final ThemeData theme = ThemeData();
final ThemeData theme = ThemeData(useMaterial3: false);
final bool material3 = theme.useMaterial3;
Widget buildRadio({bool active = false, bool useOverlay = true}) {
return wrap(
......
......@@ -2155,8 +2155,9 @@ void main() {
});
testWidgets('SnackBars should be shown above the bottomSheet', (WidgetTester tester) async {
await tester.pumpWidget(const MaterialApp(
home: Scaffold(
await tester.pumpWidget(MaterialApp(
theme: ThemeData(useMaterial3: false),
home: const Scaffold(
bottomSheet: SizedBox(
width: 200,
height: 50,
......@@ -2238,6 +2239,7 @@ void main() {
testWidgets('ScaffoldMessenger presents SnackBars to only the root Scaffold when Scaffolds are nested.', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold(
body: const Scaffold(),
floatingActionButton: FloatingActionButton(onPressed: () {}),
......@@ -2439,6 +2441,7 @@ void main() {
testWidgets('Snackbar by default clips BackdropFilter', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/98205
await tester.pumpWidget(MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Scaffold(
body: const Scaffold(),
floatingActionButton: FloatingActionButton(onPressed: () {}),
......@@ -2469,8 +2472,9 @@ void main() {
});
testWidgets('Floating snackbar can display optional icon', (WidgetTester tester) async {
await tester.pumpWidget(const MaterialApp(
home: Scaffold(
await tester.pumpWidget(MaterialApp(
theme: ThemeData(useMaterial3: false),
home: const Scaffold(
bottomSheet: SizedBox(
width: 200,
height: 50,
......@@ -2500,8 +2504,9 @@ void main() {
});
testWidgets('Fixed width snackbar can display optional icon', (WidgetTester tester) async {
await tester.pumpWidget(const MaterialApp(
home: Scaffold(
await tester.pumpWidget(MaterialApp(
theme: ThemeData(useMaterial3: false),
home: const Scaffold(
bottomSheet: SizedBox(
width: 200,
height: 50,
......@@ -2526,8 +2531,9 @@ void main() {
});
testWidgets('Fixed snackbar can display optional icon without action', (WidgetTester tester) async {
await tester.pumpWidget(const MaterialApp(
home: Scaffold(
await tester.pumpWidget(MaterialApp(
theme: ThemeData(useMaterial3: false),
home: const Scaffold(
bottomSheet: SizedBox(
width: 200,
height: 50,
......@@ -2554,8 +2560,9 @@ void main() {
testWidgets(
'Floating width snackbar can display optional icon without action', (WidgetTester tester) async {
await tester.pumpWidget(const MaterialApp(
home: Scaffold(
await tester.pumpWidget(MaterialApp(
theme: ThemeData(useMaterial3: false),
home: const Scaffold(
bottomSheet: SizedBox(
width: 200,
height: 50,
......@@ -2580,8 +2587,9 @@ void main() {
});
testWidgets('Floating multi-line snackbar with icon is aligned correctly', (WidgetTester tester) async {
await tester.pumpWidget(const MaterialApp(
home: Scaffold(
await tester.pumpWidget(MaterialApp(
theme: ThemeData(useMaterial3: false),
home: const Scaffold(
bottomSheet: SizedBox(
width: 200,
height: 50,
......@@ -2607,8 +2615,9 @@ void main() {
});
testWidgets('Floating multi-line snackbar with icon and actionOverflowThreshold=1 is aligned correctly', (WidgetTester tester) async {
await tester.pumpWidget(const MaterialApp(
home: Scaffold(
await tester.pumpWidget(MaterialApp(
theme: ThemeData(useMaterial3: false),
home: const Scaffold(
bottomSheet: SizedBox(
width: 200,
height: 50,
......@@ -2627,7 +2636,7 @@ void main() {
behavior: SnackBarBehavior.floating,
actionOverflowThreshold: 1,
));
await tester.pumpAndSettle(); // Have the SnackBar fully animate out.
await tester.pumpAndSettle(); // Have the SnackBar fully animate in.
await expectLater(find.byType(MaterialApp),
matchesGoldenFile('snack_bar.goldenTest.multiLineWithIconWithZeroActionOverflowThreshold.png'));
......
......@@ -918,7 +918,9 @@ void main() {
});
testWidgets('Material cursor golden', (WidgetTester tester) async {
final Widget widget = overlay(
final Widget widget = Theme(
data: ThemeData(useMaterial3: false),
child: overlay(
child: const RepaintBoundary(
key: ValueKey<int>(1),
child: TextField(
......@@ -927,6 +929,7 @@ void main() {
cursorRadius: Radius.circular(3.0),
),
),
),
);
await tester.pumpWidget(widget);
......@@ -1095,6 +1098,7 @@ void main() {
);
await tester.pumpWidget(
MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Material(
child: Center(
child: RepaintBoundary(
......@@ -1143,6 +1147,7 @@ void main() {
);
await tester.pumpWidget(
MaterialApp(
theme: ThemeData(useMaterial3: false),
home: Material(
child: Center(
child: RepaintBoundary(
......
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