Achieve Color Contrast Accessibility for Menu Demo (#49099)

This commit is contained in:
Tianguang
2020-01-24 03:43:01 +01:00
committed by Flutter GitHub Bot
parent adc8680645
commit e2aa9e13ce
4 changed files with 507 additions and 142 deletions

View File

@@ -0,0 +1,32 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_gallery/demo/material/menu_demo.dart';
import 'package:flutter_gallery/gallery/themes.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Menu icon satisfies accessibility contrast ratio guidelines, light mode', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
theme: kLightGalleryTheme,
home: const MenuDemo(),
));
await expectLater(tester, meetsGuideline(textContrastGuideline));
await expectLater(tester, meetsGuideline(CustomMinimumContrastGuideline(finder: find.byWidgetPredicate((Widget widget) => widget is Icon))));
});
testWidgets('Menu icon satisfies accessibility contrast ratio guidelines, dark mode', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
theme: kDarkGalleryTheme,
home: const MenuDemo(),
));
await expectLater(tester, meetsGuideline(textContrastGuideline));
await expectLater(tester, meetsGuideline(CustomMinimumContrastGuideline(finder: find.byWidgetPredicate((Widget widget) => widget is Icon))));
});
}