Unverified Commit b8fa9233 authored by Zachary Anderson's avatar Zachary Anderson Committed by GitHub

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
parent a65e7394
......@@ -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,8 +246,9 @@ 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);
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(
icon: Icon(Icons.ac_unit),
actions: <Widget>[ ],
......@@ -305,12 +260,11 @@ void main() {
// first is Text('X')
final RichText text = tester.widget(find.byType(RichText).last);
expect(text.text.style!.color, theme.colorScheme.secondary);
expect(text.text.style!.color, iconThemeColor);
});
testWidgets('Material2 - 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));
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>[ ],
......@@ -322,7 +276,7 @@ void main() {
// first is Text('X')
final RichText text = tester.widget(find.byType(RichText).last);
expect(text.text.style!.color, iconThemeColor);
expect(text.text.style!.color, theme.colorScheme.secondary);
});
testWidgets('Custom Title Text Style - Constructor Param', (WidgetTester tester) async {
......@@ -359,24 +313,13 @@ void main() {
expect(title.text.style, titleTextStyle);
});
testWidgets('Material3 - 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 {
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));
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));
......
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