Revert "Update DialogTheme tests for M2/M3" (#130578)

Reverts flutter/flutter#130414

Skia gold failures https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20framework_tests_libraries/11972/overview
This commit is contained in:
Zachary Anderson
2023-07-14 07:15:45 -07:00
committed by GitHub
parent a65e739483
commit b8fa923386

View File

@@ -165,31 +165,7 @@ void main() {
expect(bottomLeft.dy, 576.0);
});
testWidgets('Material3 - Dialog alignment takes priority over theme', (WidgetTester tester) async {
const AlertDialog dialog = AlertDialog(
title: Text('Title'),
actions: <Widget>[ ],
alignment: Alignment.topRight,
);
final ThemeData theme = ThemeData(
useMaterial3: true,
dialogTheme: const DialogTheme(alignment: Alignment.bottomLeft),
);
await tester.pumpWidget(
_appWithDialog(tester, dialog, theme: theme),
);
await tester.tap(find.text('X'));
await tester.pumpAndSettle();
final Offset bottomLeft = tester.getBottomLeft(
find.descendant(of: find.byType(Dialog), matching: find.byType(Material)),
);
expect(bottomLeft.dx, 480.0);
expect(bottomLeft.dy, 124.0);
});
testWidgets('Material2 - Dialog alignment takes priority over theme', (WidgetTester tester) async {
testWidgets('Dialog alignment takes priority over theme', (WidgetTester tester) async {
const AlertDialog dialog = AlertDialog(
title: Text('Title'),
actions: <Widget>[ ],
@@ -210,29 +186,7 @@ void main() {
expect(bottomLeft.dy, 104.0);
});
testWidgets('Material3 - Custom dialog shape matches golden', (WidgetTester tester) async {
const RoundedRectangleBorder customBorder =
RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16.0)));
const AlertDialog dialog = AlertDialog(
title: Text('Title'),
actions: <Widget>[ ],
);
final ThemeData theme = ThemeData(
useMaterial3: true,
dialogTheme: const DialogTheme(shape: customBorder),
);
await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme));
await tester.tap(find.text('X'));
await tester.pumpAndSettle();
await expectLater(
find.byKey(_painterKey),
matchesGoldenFile('m3_dialog_theme.dialog_with_custom_border.png'),
);
});
testWidgets('Material2 - Custom dialog shape matches golden', (WidgetTester tester) async {
testWidgets('Custom dialog shape matches golden', (WidgetTester tester) async {
const RoundedRectangleBorder customBorder =
RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16.0)));
const AlertDialog dialog = AlertDialog(
@@ -247,7 +201,7 @@ void main() {
await expectLater(
find.byKey(_painterKey),
matchesGoldenFile('m2_dialog_theme.dialog_with_custom_border.png'),
matchesGoldenFile('dialog_theme.dialog_with_custom_border.png'),
);
});
@@ -292,23 +246,7 @@ void main() {
expect(text.text.style!.color, dialogThemeColor);
});
testWidgets('Material3 - Custom Icon Color - Theme - lowest preference', (WidgetTester tester) async {
final ThemeData theme = ThemeData(useMaterial3: true);
const AlertDialog dialog = AlertDialog(
icon: Icon(Icons.ac_unit),
actions: <Widget>[ ],
);
await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme));
await tester.tap(find.text('X'));
await tester.pumpAndSettle();
// first is Text('X')
final RichText text = tester.widget(find.byType(RichText).last);
expect(text.text.style!.color, theme.colorScheme.secondary);
});
testWidgets('Material2 - Custom Icon Color - Theme - lowest preference', (WidgetTester tester) async {
testWidgets('Custom Icon Color - Theme - lowest preference', (WidgetTester tester) async {
const Color iconThemeColor = Colors.yellow;
final ThemeData theme = ThemeData(useMaterial3: false, iconTheme: const IconThemeData(color: iconThemeColor));
const AlertDialog dialog = AlertDialog(
@@ -325,6 +263,22 @@ void main() {
expect(text.text.style!.color, iconThemeColor);
});
testWidgets('Custom Icon Color - Theme - lowest preference for M3', (WidgetTester tester) async {
final ThemeData theme = ThemeData(useMaterial3: true);
const AlertDialog dialog = AlertDialog(
icon: Icon(Icons.ac_unit),
actions: <Widget>[ ],
);
await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme));
await tester.tap(find.text('X'));
await tester.pumpAndSettle();
// first is Text('X')
final RichText text = tester.widget(find.byType(RichText).last);
expect(text.text.style!.color, theme.colorScheme.secondary);
});
testWidgets('Custom Title Text Style - Constructor Param', (WidgetTester tester) async {
const String titleText = 'Title';
const TextStyle titleTextStyle = TextStyle(color: Colors.pink);
@@ -359,24 +313,13 @@ void main() {
expect(title.text.style, titleTextStyle);
});
testWidgets('Material3 - Custom Title Text Style - Theme', (WidgetTester tester) async {
testWidgets('Custom Title Text Style - Theme', (WidgetTester tester) async {
const String titleText = 'Title';
const TextStyle titleTextStyle = TextStyle(color: Colors.pink);
const AlertDialog dialog = AlertDialog(title: Text(titleText));
final ThemeData theme = ThemeData(useMaterial3: true, textTheme: const TextTheme(headlineSmall: titleTextStyle));
await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme));
await tester.tap(find.text('X'));
await tester.pumpAndSettle();
final RenderParagraph title = _getTextRenderObject(tester, titleText);
expect(title.text.style!.color, titleTextStyle.color);
});
testWidgets('Material2 - Custom Title Text Style - Theme', (WidgetTester tester) async {
const String titleText = 'Title';
const TextStyle titleTextStyle = TextStyle(color: Colors.pink);
const AlertDialog dialog = AlertDialog(title: Text(titleText));
const AlertDialog dialog = AlertDialog(
title: Text(titleText),
actions: <Widget>[ ],
);
final ThemeData theme = ThemeData(useMaterial3: false, textTheme: const TextTheme(titleLarge: titleTextStyle));
await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme));
@@ -469,24 +412,13 @@ void main() {
expect(content.text.style, contentTextStyle);
});
testWidgets('Material3 - Custom Content Text Style - Theme', (WidgetTester tester) async {
testWidgets('Custom Content Text Style - Theme', (WidgetTester tester) async {
const String contentText = 'Content';
const TextStyle contentTextStyle = TextStyle(color: Colors.pink);
const AlertDialog dialog = AlertDialog(content: Text(contentText),);
final ThemeData theme = ThemeData(useMaterial3: true, textTheme: const TextTheme(bodyMedium: contentTextStyle));
await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme));
await tester.tap(find.text('X'));
await tester.pumpAndSettle();
final RenderParagraph content = _getTextRenderObject(tester, contentText);
expect(content.text.style!.color, contentTextStyle.color);
});
testWidgets('Material2 - Custom Content Text Style - Theme', (WidgetTester tester) async {
const String contentText = 'Content';
const TextStyle contentTextStyle = TextStyle(color: Colors.pink);
const AlertDialog dialog = AlertDialog(content: Text(contentText));
const AlertDialog dialog = AlertDialog(
content: Text(contentText),
actions: <Widget>[ ],
);
final ThemeData theme = ThemeData(useMaterial3: false, textTheme: const TextTheme(titleMedium: contentTextStyle));
await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme));