[Gallery] Fix text contrast ratio on homepage and contacts demo (#48752)

This commit is contained in:
MH Johnson
2020-01-15 01:23:02 -05:00
committed by Flutter GitHub Bot
parent 72561cd41b
commit 5d37de2685
3 changed files with 39 additions and 6 deletions

View File

@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_gallery/gallery/app.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_gallery/demo/all.dart';
import 'package:flutter_gallery/gallery/themes.dart';
@@ -756,4 +757,35 @@ void main() {
});
}
});
group('Gallery home page meets text contrast guidelines', () {
testWidgets('options menu', (WidgetTester tester) async {
await tester.pumpWidget(const GalleryApp(testMode: true));
await tester.tap(find.byTooltip('Toggle options page'));
await tester.pumpAndSettle();
await expectLater(tester, meetsGuideline(textContrastGuideline));
});
testWidgets('options menu - dark theme', (WidgetTester tester) async {
await tester.pumpWidget(const GalleryApp(testMode: true));
await tester.tap(find.byTooltip('Toggle options page'));
await tester.pumpAndSettle();
// Toggle dark mode.
final Finder themeToggleContainer = find.ancestor(
of: find.text('Theme'),
matching: find.byType(Container),
);
final Finder themeMenuButton = find.descendant(
of: themeToggleContainer,
matching: find.byIcon(Icons.arrow_drop_down),
);
await tester.tap(themeMenuButton);
await tester.pumpAndSettle();
await tester.tap(find.text('Dark'));
await tester.pumpAndSettle();
await expectLater(tester, meetsGuideline(textContrastGuideline));
});
});
}