"Fossies" - the Fresh Open Source Software Archive

Member "flutter-3.7.1/dev/integration_tests/flutter_gallery/test/accessibility_test.dart" (1 Feb 2023, 34394 Bytes) of package /linux/misc/flutter-3.7.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Dart source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // Copyright 2014 The Flutter Authors. All rights reserved.
    2 // Use of this source code is governed by a BSD-style license that can be
    3 // found in the LICENSE file.
    4 
    5 import 'package:flutter/material.dart';
    6 import 'package:flutter_gallery/demo/all.dart';
    7 import 'package:flutter_gallery/gallery/app.dart';
    8 import 'package:flutter_gallery/gallery/themes.dart';
    9 import 'package:flutter_test/flutter_test.dart';
   10 
   11 void main() {
   12   group('All material demos meet recommended tap target sizes', () {
   13     testWidgets('backdrop_demo', (WidgetTester tester) async {
   14       final SemanticsHandle handle = tester.ensureSemantics();
   15       await tester.pumpWidget(const MaterialApp(home: BackdropDemo()));
   16       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
   17       handle.dispose();
   18     });
   19 
   20     testWidgets('bottom_app_bar_demo', (WidgetTester tester) async {
   21       final SemanticsHandle handle = tester.ensureSemantics();
   22       await tester.pumpWidget(const MaterialApp(home: BottomAppBarDemo()));
   23       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
   24       handle.dispose();
   25     });
   26 
   27     testWidgets('bottom_navigation_demo', (WidgetTester tester) async {
   28       final SemanticsHandle handle = tester.ensureSemantics();
   29       await tester.pumpWidget(const MaterialApp(home: BottomNavigationDemo()));
   30       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
   31       handle.dispose();
   32     });
   33 
   34     testWidgets('buttons_demo', (WidgetTester tester) async {
   35       final SemanticsHandle handle = tester.ensureSemantics();
   36       await tester.pumpWidget(const MaterialApp(home: ButtonsDemo()));
   37       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
   38       handle.dispose();
   39     });
   40 
   41     testWidgets('cards_demo', (WidgetTester tester) async {
   42       final SemanticsHandle handle = tester.ensureSemantics();
   43       await tester.pumpWidget(const MaterialApp(home: CardsDemo()));
   44       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
   45       handle.dispose();
   46     });
   47 
   48     testWidgets('chip_demo', (WidgetTester tester) async {
   49       final SemanticsHandle handle = tester.ensureSemantics();
   50       await tester.pumpWidget(const MaterialApp(home: ChipDemo()));
   51       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
   52       handle.dispose();
   53     }, skip: true); // https://github.com/flutter/flutter/issues/42455
   54 
   55     testWidgets('data_table_demo', (WidgetTester tester) async {
   56       final SemanticsHandle handle = tester.ensureSemantics();
   57       await tester.pumpWidget(const MaterialApp(home: DataTableDemo()));
   58       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
   59       handle.dispose();
   60     });
   61 
   62     testWidgets('date_and_time_picker_demo', (WidgetTester tester) async {
   63       final SemanticsHandle handle = tester.ensureSemantics();
   64       await tester.pumpWidget(const MaterialApp(home: DateAndTimePickerDemo()));
   65       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
   66       handle.dispose();
   67     });
   68 
   69     testWidgets('dialog_demo', (WidgetTester tester) async {
   70       final SemanticsHandle handle = tester.ensureSemantics();
   71       await tester.pumpWidget(const MaterialApp(home: DialogDemo()));
   72       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
   73       handle.dispose();
   74     });
   75 
   76     testWidgets('drawer_demo', (WidgetTester tester) async {
   77       final SemanticsHandle handle = tester.ensureSemantics();
   78       await tester.pumpWidget(const MaterialApp(home: DrawerDemo()));
   79       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
   80       handle.dispose();
   81     });
   82 
   83     testWidgets('elevation_demo', (WidgetTester tester) async {
   84       final SemanticsHandle handle = tester.ensureSemantics();
   85       await tester.pumpWidget(const MaterialApp(home: ElevationDemo()));
   86       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
   87       handle.dispose();
   88     });
   89 
   90     testWidgets('expansion_panels_demo', (WidgetTester tester) async {
   91       final SemanticsHandle handle = tester.ensureSemantics();
   92       await tester.pumpWidget(const MaterialApp(home: ExpansionPanelsDemo()));
   93       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
   94       handle.dispose();
   95     });
   96 
   97     testWidgets('grid_list_demo', (WidgetTester tester) async {
   98       final SemanticsHandle handle = tester.ensureSemantics();
   99       await tester.pumpWidget(const MaterialApp(home: GridListDemo()));
  100       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  101       handle.dispose();
  102     });
  103 
  104     testWidgets('icons_demo', (WidgetTester tester) async {
  105       final SemanticsHandle handle = tester.ensureSemantics();
  106       await tester.pumpWidget(const MaterialApp(home: IconsDemo()));
  107       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  108       handle.dispose();
  109     });
  110 
  111     testWidgets('leave_behind_demo', (WidgetTester tester) async {
  112       final SemanticsHandle handle = tester.ensureSemantics();
  113       await tester.pumpWidget(const MaterialApp(home: LeaveBehindDemo()));
  114       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  115       handle.dispose();
  116     });
  117 
  118     testWidgets('list_demo', (WidgetTester tester) async {
  119       final SemanticsHandle handle = tester.ensureSemantics();
  120       await tester.pumpWidget(const MaterialApp(home: ListDemo()));
  121       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  122       handle.dispose();
  123     });
  124 
  125     testWidgets('menu_demo', (WidgetTester tester) async {
  126       final SemanticsHandle handle = tester.ensureSemantics();
  127       await tester.pumpWidget(const MaterialApp(home: MenuDemo()));
  128       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  129       handle.dispose();
  130     });
  131 
  132     testWidgets('modal_bottom_sheet_demo', (WidgetTester tester) async {
  133       final SemanticsHandle handle = tester.ensureSemantics();
  134       await tester.pumpWidget(const MaterialApp(home: ModalBottomSheetDemo()));
  135       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  136       handle.dispose();
  137     });
  138 
  139     testWidgets('overscroll_demo', (WidgetTester tester) async {
  140       final SemanticsHandle handle = tester.ensureSemantics();
  141       await tester.pumpWidget(const MaterialApp(home: OverscrollDemo()));
  142       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  143       handle.dispose();
  144     });
  145 
  146     testWidgets('page_selector_demo', (WidgetTester tester) async {
  147       final SemanticsHandle handle = tester.ensureSemantics();
  148       await tester.pumpWidget(const MaterialApp(home: PageSelectorDemo()));
  149       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  150       handle.dispose();
  151     });
  152 
  153     testWidgets('persistent_bottom_sheet_demo', (WidgetTester tester) async {
  154       final SemanticsHandle handle = tester.ensureSemantics();
  155       await tester.pumpWidget(const MaterialApp(home: PersistentBottomSheetDemo()));
  156       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  157       handle.dispose();
  158     });
  159 
  160     testWidgets('progress_indicator_demo', (WidgetTester tester) async {
  161       final SemanticsHandle handle = tester.ensureSemantics();
  162       await tester.pumpWidget(const MaterialApp(home: ProgressIndicatorDemo()));
  163       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  164       handle.dispose();
  165     });
  166 
  167     testWidgets('reorderable_list_demo', (WidgetTester tester) async {
  168       final SemanticsHandle handle = tester.ensureSemantics();
  169       await tester.pumpWidget(const MaterialApp(home: ReorderableListDemo()));
  170       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  171       handle.dispose();
  172     });
  173 
  174     testWidgets('scrollable_tabs_demo', (WidgetTester tester) async {
  175       final SemanticsHandle handle = tester.ensureSemantics();
  176       await tester.pumpWidget(const MaterialApp(home: ScrollableTabsDemo()));
  177       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  178       handle.dispose();
  179     });
  180 
  181     testWidgets('search_demo', (WidgetTester tester) async {
  182       final SemanticsHandle handle = tester.ensureSemantics();
  183       await tester.pumpWidget(const MaterialApp(home: SearchDemo()));
  184       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  185       handle.dispose();
  186     });
  187 
  188     testWidgets('selection_controls_demo', (WidgetTester tester) async {
  189       final SemanticsHandle handle = tester.ensureSemantics();
  190       await tester.pumpWidget(const MaterialApp(home: SelectionControlsDemo()));
  191       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  192       handle.dispose();
  193     });
  194 
  195     testWidgets('slider_demo', (WidgetTester tester) async {
  196       final SemanticsHandle handle = tester.ensureSemantics();
  197       await tester.pumpWidget(const MaterialApp(home: SliderDemo()));
  198       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  199       handle.dispose();
  200     });
  201 
  202     testWidgets('snack_bar_demo', (WidgetTester tester) async {
  203       final SemanticsHandle handle = tester.ensureSemantics();
  204       await tester.pumpWidget(const MaterialApp(home: SnackBarDemo()));
  205       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  206       handle.dispose();
  207     });
  208 
  209     testWidgets('tabs_demo', (WidgetTester tester) async {
  210       final SemanticsHandle handle = tester.ensureSemantics();
  211       await tester.pumpWidget(const MaterialApp(home: TabsDemo()));
  212       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  213       handle.dispose();
  214     });
  215 
  216     testWidgets('tabs_fab_demo', (WidgetTester tester) async {
  217       final SemanticsHandle handle = tester.ensureSemantics();
  218       await tester.pumpWidget(const MaterialApp(home: TabsFabDemo()));
  219       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  220       handle.dispose();
  221     });
  222 
  223     testWidgets('text_form_field_demo', (WidgetTester tester) async {
  224       final SemanticsHandle handle = tester.ensureSemantics();
  225       await tester.pumpWidget(const MaterialApp(home: TextFormFieldDemo()));
  226       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  227       handle.dispose();
  228     });
  229 
  230     testWidgets('tooltip_demo', (WidgetTester tester) async {
  231       final SemanticsHandle handle = tester.ensureSemantics();
  232       await tester.pumpWidget(const MaterialApp(home: TooltipDemo()));
  233       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  234       handle.dispose();
  235     });
  236 
  237     testWidgets('expansion_tile_list_demo', (WidgetTester tester) async {
  238       final SemanticsHandle handle = tester.ensureSemantics();
  239       await tester.pumpWidget(const MaterialApp(home: ExpansionTileListDemo()));
  240       await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  241       handle.dispose();
  242     });
  243   });
  244 
  245   group('All material demos have labeled tap targets', () {
  246     testWidgets('backdrop_demo', (WidgetTester tester) async {
  247       final SemanticsHandle handle = tester.ensureSemantics();
  248       await tester.pumpWidget(const MaterialApp(home: BackdropDemo()));
  249       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  250       handle.dispose();
  251     });
  252 
  253     testWidgets('bottom_app_bar_demo', (WidgetTester tester) async {
  254       final SemanticsHandle handle = tester.ensureSemantics();
  255       await tester.pumpWidget(const MaterialApp(home: BottomAppBarDemo()));
  256       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  257       handle.dispose();
  258     });
  259 
  260     testWidgets('bottom_navigation_demo', (WidgetTester tester) async {
  261       final SemanticsHandle handle = tester.ensureSemantics();
  262       await tester.pumpWidget(const MaterialApp(home: BottomNavigationDemo()));
  263       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  264       handle.dispose();
  265     });
  266 
  267     testWidgets('buttons_demo', (WidgetTester tester) async {
  268       final SemanticsHandle handle = tester.ensureSemantics();
  269       await tester.pumpWidget(const MaterialApp(home: ButtonsDemo()));
  270       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  271       handle.dispose();
  272     });
  273 
  274     testWidgets('cards_demo', (WidgetTester tester) async {
  275       final SemanticsHandle handle = tester.ensureSemantics();
  276       await tester.pumpWidget(const MaterialApp(home: CardsDemo()));
  277       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  278       handle.dispose();
  279     });
  280 
  281     testWidgets('chip_demo', (WidgetTester tester) async {
  282       final SemanticsHandle handle = tester.ensureSemantics();
  283       await tester.pumpWidget(const MaterialApp(home: ChipDemo()));
  284       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  285       handle.dispose();
  286     });
  287 
  288     testWidgets('data_table_demo', (WidgetTester tester) async {
  289       final SemanticsHandle handle = tester.ensureSemantics();
  290       await tester.pumpWidget(const MaterialApp(home: DataTableDemo()));
  291       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  292       handle.dispose();
  293     }, skip: true); // DataTables are not accessible, https://github.com/flutter/flutter/issues/10830
  294 
  295     testWidgets('date_and_time_picker_demo', (WidgetTester tester) async {
  296       final SemanticsHandle handle = tester.ensureSemantics();
  297       await tester.pumpWidget(const MaterialApp(home: DateAndTimePickerDemo()));
  298       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  299       handle.dispose();
  300     });
  301 
  302     testWidgets('dialog_demo', (WidgetTester tester) async {
  303       final SemanticsHandle handle = tester.ensureSemantics();
  304       await tester.pumpWidget(const MaterialApp(home: DialogDemo()));
  305       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  306       handle.dispose();
  307     });
  308 
  309     testWidgets('drawer_demo', (WidgetTester tester) async {
  310       final SemanticsHandle handle = tester.ensureSemantics();
  311       await tester.pumpWidget(const MaterialApp(home: DrawerDemo()));
  312       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  313       handle.dispose();
  314     });
  315 
  316     testWidgets('elevation_demo', (WidgetTester tester) async {
  317       final SemanticsHandle handle = tester.ensureSemantics();
  318       await tester.pumpWidget(const MaterialApp(home: ElevationDemo()));
  319       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  320       handle.dispose();
  321     });
  322 
  323     testWidgets('expansion_panels_demo', (WidgetTester tester) async {
  324       final SemanticsHandle handle = tester.ensureSemantics();
  325       await tester.pumpWidget(const MaterialApp(home: ExpansionPanelsDemo()));
  326       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  327       handle.dispose();
  328     });
  329 
  330     testWidgets('grid_list_demo', (WidgetTester tester) async {
  331       final SemanticsHandle handle = tester.ensureSemantics();
  332       await tester.pumpWidget(const MaterialApp(home: GridListDemo()));
  333       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  334       handle.dispose();
  335     });
  336 
  337     testWidgets('icons_demo', (WidgetTester tester) async {
  338       final SemanticsHandle handle = tester.ensureSemantics();
  339       await tester.pumpWidget(const MaterialApp(home: IconsDemo()));
  340       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  341       handle.dispose();
  342     });
  343 
  344     testWidgets('leave_behind_demo', (WidgetTester tester) async {
  345       final SemanticsHandle handle = tester.ensureSemantics();
  346       await tester.pumpWidget(const MaterialApp(home: LeaveBehindDemo()));
  347       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  348       handle.dispose();
  349     });
  350 
  351     testWidgets('list_demo', (WidgetTester tester) async {
  352       final SemanticsHandle handle = tester.ensureSemantics();
  353       await tester.pumpWidget(const MaterialApp(home: ListDemo()));
  354       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  355       handle.dispose();
  356     });
  357 
  358     testWidgets('menu_demo', (WidgetTester tester) async {
  359       final SemanticsHandle handle = tester.ensureSemantics();
  360       await tester.pumpWidget(const MaterialApp(home: MenuDemo()));
  361       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  362       handle.dispose();
  363     });
  364 
  365     testWidgets('modal_bottom_sheet_demo', (WidgetTester tester) async {
  366       final SemanticsHandle handle = tester.ensureSemantics();
  367       await tester.pumpWidget(const MaterialApp(home: ModalBottomSheetDemo()));
  368       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  369       handle.dispose();
  370     });
  371 
  372     testWidgets('overscroll_demo', (WidgetTester tester) async {
  373       final SemanticsHandle handle = tester.ensureSemantics();
  374       await tester.pumpWidget(const MaterialApp(home: OverscrollDemo()));
  375       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  376       handle.dispose();
  377     });
  378 
  379     testWidgets('page_selector_demo', (WidgetTester tester) async {
  380       final SemanticsHandle handle = tester.ensureSemantics();
  381       await tester.pumpWidget(const MaterialApp(home: PageSelectorDemo()));
  382       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  383       handle.dispose();
  384     });
  385 
  386     testWidgets('persistent_bottom_sheet_demo', (WidgetTester tester) async {
  387       final SemanticsHandle handle = tester.ensureSemantics();
  388       await tester.pumpWidget(const MaterialApp(home: PersistentBottomSheetDemo()));
  389       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  390       handle.dispose();
  391     });
  392 
  393     testWidgets('progress_indicator_demo', (WidgetTester tester) async {
  394       final SemanticsHandle handle = tester.ensureSemantics();
  395       await tester.pumpWidget(const MaterialApp(home: ProgressIndicatorDemo()));
  396       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  397       handle.dispose();
  398     });
  399 
  400     testWidgets('reorderable_list_demo', (WidgetTester tester) async {
  401       final SemanticsHandle handle = tester.ensureSemantics();
  402       await tester.pumpWidget(const MaterialApp(home: ReorderableListDemo()));
  403       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  404       handle.dispose();
  405     });
  406 
  407     testWidgets('scrollable_tabs_demo', (WidgetTester tester) async {
  408       final SemanticsHandle handle = tester.ensureSemantics();
  409       await tester.pumpWidget(const MaterialApp(home: ScrollableTabsDemo()));
  410       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  411       handle.dispose();
  412     });
  413 
  414     testWidgets('search_demo', (WidgetTester tester) async {
  415       final SemanticsHandle handle = tester.ensureSemantics();
  416       await tester.pumpWidget(const MaterialApp(home: SearchDemo()));
  417       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  418       handle.dispose();
  419     });
  420 
  421     testWidgets('selection_controls_demo', (WidgetTester tester) async {
  422       final SemanticsHandle handle = tester.ensureSemantics();
  423       await tester.pumpWidget(const MaterialApp(home: SelectionControlsDemo()));
  424       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  425       handle.dispose();
  426     });
  427 
  428     testWidgets('slider_demo', (WidgetTester tester) async {
  429       final SemanticsHandle handle = tester.ensureSemantics();
  430       await tester.pumpWidget(const MaterialApp(home: SliderDemo()));
  431       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  432       handle.dispose();
  433     });
  434 
  435     testWidgets('snack_bar_demo', (WidgetTester tester) async {
  436       final SemanticsHandle handle = tester.ensureSemantics();
  437       await tester.pumpWidget(const MaterialApp(home: SnackBarDemo()));
  438       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  439       handle.dispose();
  440     });
  441 
  442     testWidgets('tabs_demo', (WidgetTester tester) async {
  443       final SemanticsHandle handle = tester.ensureSemantics();
  444       await tester.pumpWidget(const MaterialApp(home: TabsDemo()));
  445       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  446       handle.dispose();
  447     });
  448 
  449     testWidgets('tabs_fab_demo', (WidgetTester tester) async {
  450       final SemanticsHandle handle = tester.ensureSemantics();
  451       await tester.pumpWidget(const MaterialApp(home: TabsFabDemo()));
  452       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  453       handle.dispose();
  454     });
  455 
  456     testWidgets('text_form_field_demo', (WidgetTester tester) async {
  457       final SemanticsHandle handle = tester.ensureSemantics();
  458       await tester.pumpWidget(const MaterialApp(home: TextFormFieldDemo()));
  459       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  460       handle.dispose();
  461     });
  462 
  463     testWidgets('tooltip_demo', (WidgetTester tester) async {
  464       final SemanticsHandle handle = tester.ensureSemantics();
  465       await tester.pumpWidget(const MaterialApp(home: TooltipDemo()));
  466       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  467       handle.dispose();
  468     });
  469 
  470     testWidgets('expansion_tile_list_demo', (WidgetTester tester) async {
  471       final SemanticsHandle handle = tester.ensureSemantics();
  472       await tester.pumpWidget(const MaterialApp(home: ExpansionTileListDemo()));
  473       await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  474       handle.dispose();
  475     });
  476   });
  477 
  478   group('All material demos meet text contrast guidelines', () {
  479     final List<ThemeData> themes = <ThemeData>[
  480       kLightGalleryTheme,
  481       kDarkGalleryTheme,
  482     ];
  483 
  484     const List<String> themeNames = <String>[
  485       'kLightGalleryTheme',
  486       'kDarkGalleryTheme',
  487     ];
  488 
  489     for (int themeIndex = 0; themeIndex < themes.length; themeIndex += 1) {
  490       final ThemeData theme = themes[themeIndex];
  491       final String themeName = themeNames[themeIndex];
  492 
  493       testWidgets('backdrop_demo $themeName', (WidgetTester tester) async {
  494         final SemanticsHandle handle = tester.ensureSemantics();
  495         await tester.pumpWidget(MaterialApp(theme: theme, home: const BackdropDemo()));
  496         await expectLater(tester, meetsGuideline(textContrastGuideline));
  497         handle.dispose();
  498       });
  499 
  500       testWidgets('bottom_app_bar_demo $themeName', (WidgetTester tester) async {
  501         final SemanticsHandle handle = tester.ensureSemantics();
  502         await tester.pumpWidget(MaterialApp(theme: theme, home: const BottomAppBarDemo()));
  503         await expectLater(tester, meetsGuideline(textContrastGuideline));
  504         handle.dispose();
  505       });
  506 
  507       testWidgets('bottom_navigation_demo $themeName', (WidgetTester tester) async {
  508         final SemanticsHandle handle = tester.ensureSemantics();
  509         await tester.pumpWidget(MaterialApp(theme: theme, home: const BottomNavigationDemo()));
  510         await expectLater(tester, meetsGuideline(textContrastGuideline));
  511         handle.dispose();
  512       });
  513 
  514       testWidgets('buttons_demo $themeName', (WidgetTester tester) async {
  515         final SemanticsHandle handle = tester.ensureSemantics();
  516         await tester.pumpWidget(MaterialApp(theme: theme, home: const ButtonsDemo()));
  517         await expectLater(tester, meetsGuideline(textContrastGuideline));
  518         handle.dispose();
  519       });
  520 
  521       testWidgets('cards_demo $themeName', (WidgetTester tester) async {
  522         final SemanticsHandle handle = tester.ensureSemantics();
  523         await tester.pumpWidget(MaterialApp(theme: theme, home: const CardsDemo()));
  524         await expectLater(tester, meetsGuideline(textContrastGuideline));
  525         handle.dispose();
  526       });
  527 
  528       testWidgets('chip_demo $themeName', (WidgetTester tester) async {
  529         final SemanticsHandle handle = tester.ensureSemantics();
  530         await tester.pumpWidget(MaterialApp(theme: theme, home: const ChipDemo()));
  531         await expectLater(tester, meetsGuideline(textContrastGuideline));
  532         handle.dispose();
  533       });
  534 
  535       testWidgets('data_table_demo $themeName', (WidgetTester tester) async {
  536         final SemanticsHandle handle = tester.ensureSemantics();
  537         await tester.pumpWidget(MaterialApp(theme: theme, home: const DataTableDemo()));
  538         await expectLater(tester, meetsGuideline(textContrastGuideline));
  539         handle.dispose();
  540       });
  541 
  542       testWidgets('date_and_time_picker_demo $themeName', (WidgetTester tester) async {
  543         final SemanticsHandle handle = tester.ensureSemantics();
  544         await tester.pumpWidget(MaterialApp(theme: theme, home: const DateAndTimePickerDemo()));
  545         await expectLater(tester, meetsGuideline(textContrastGuideline));
  546         handle.dispose();
  547       });
  548 
  549       testWidgets('dialog_demo $themeName', (WidgetTester tester) async {
  550         final SemanticsHandle handle = tester.ensureSemantics();
  551         await tester.pumpWidget(MaterialApp(theme: theme, home: const DialogDemo()));
  552         await expectLater(tester, meetsGuideline(textContrastGuideline));
  553         handle.dispose();
  554       });
  555 
  556       testWidgets('drawer_demo $themeName', (WidgetTester tester) async {
  557         final SemanticsHandle handle = tester.ensureSemantics();
  558         await tester.pumpWidget(MaterialApp(theme: theme, home: const DrawerDemo()));
  559         await expectLater(tester, meetsGuideline(textContrastGuideline));
  560         handle.dispose();
  561       });
  562 
  563       testWidgets('elevation_demo $themeName', (WidgetTester tester) async {
  564         final SemanticsHandle handle = tester.ensureSemantics();
  565         await tester.pumpWidget(MaterialApp(theme: theme, home: const ElevationDemo()));
  566         await expectLater(tester, meetsGuideline(textContrastGuideline));
  567         handle.dispose();
  568       });
  569 
  570       testWidgets('expansion_panels_demo $themeName', (WidgetTester tester) async {
  571         final SemanticsHandle handle = tester.ensureSemantics();
  572         await tester.pumpWidget(MaterialApp(theme: theme, home: const ExpansionPanelsDemo()));
  573         await expectLater(tester, meetsGuideline(textContrastGuideline));
  574         handle.dispose();
  575       });
  576 
  577       testWidgets('grid_list_demo $themeName', (WidgetTester tester) async {
  578         final SemanticsHandle handle = tester.ensureSemantics();
  579         await tester.pumpWidget(MaterialApp(theme: theme, home: const GridListDemo()));
  580         await expectLater(tester, meetsGuideline(textContrastGuideline));
  581         handle.dispose();
  582       });
  583 
  584       testWidgets('icons_demo $themeName', (WidgetTester tester) async {
  585         final SemanticsHandle handle = tester.ensureSemantics();
  586         await tester.pumpWidget(MaterialApp(theme: theme, home: const IconsDemo()));
  587         await expectLater(tester, meetsGuideline(textContrastGuideline));
  588         handle.dispose();
  589       });
  590 
  591       testWidgets('leave_behind_demo $themeName', (WidgetTester tester) async {
  592         final SemanticsHandle handle = tester.ensureSemantics();
  593         await tester.pumpWidget(MaterialApp(theme: theme, home: const LeaveBehindDemo()));
  594         await expectLater(tester, meetsGuideline(textContrastGuideline));
  595         handle.dispose();
  596       });
  597 
  598       testWidgets('list_demo $themeName', (WidgetTester tester) async {
  599         final SemanticsHandle handle = tester.ensureSemantics();
  600         await tester.pumpWidget(MaterialApp(theme: theme, home: const ListDemo()));
  601         await expectLater(tester, meetsGuideline(textContrastGuideline));
  602         handle.dispose();
  603       });
  604 
  605       testWidgets('menu_demo $themeName', (WidgetTester tester) async {
  606         final SemanticsHandle handle = tester.ensureSemantics();
  607         await tester.pumpWidget(MaterialApp(theme: theme, home: const MenuDemo()));
  608         await expectLater(tester, meetsGuideline(textContrastGuideline));
  609         handle.dispose();
  610       });
  611 
  612       testWidgets('modal_bottom_sheet_demo $themeName', (WidgetTester tester) async {
  613         final SemanticsHandle handle = tester.ensureSemantics();
  614         await tester.pumpWidget(
  615           MaterialApp(theme: theme, home: const ModalBottomSheetDemo())
  616         );
  617         await expectLater(tester, meetsGuideline(textContrastGuideline));
  618         handle.dispose();
  619       });
  620 
  621       testWidgets('overscroll_demo', (WidgetTester tester) async {
  622         final SemanticsHandle handle = tester.ensureSemantics();
  623         await tester.pumpWidget(const MaterialApp(home: OverscrollDemo()));
  624         await expectLater(tester, meetsGuideline(textContrastGuideline));
  625         handle.dispose();
  626       });
  627 
  628       testWidgets('page_selector_demo $themeName', (WidgetTester tester) async {
  629         final SemanticsHandle handle = tester.ensureSemantics();
  630         await tester.pumpWidget(MaterialApp(theme: theme, home: const PageSelectorDemo()));
  631         await expectLater(tester, meetsGuideline(textContrastGuideline));
  632         handle.dispose();
  633       });
  634 
  635       testWidgets('persistent_bottom_sheet_demo $themeName', (WidgetTester tester) async {
  636         final SemanticsHandle handle = tester.ensureSemantics();
  637         await tester.pumpWidget(
  638           MaterialApp(theme: theme, home: const PersistentBottomSheetDemo())
  639         );
  640         await expectLater(tester, meetsGuideline(textContrastGuideline));
  641         handle.dispose();
  642       });
  643 
  644       testWidgets('progress_indicator_demo $themeName', (WidgetTester tester) async {
  645         final SemanticsHandle handle = tester.ensureSemantics();
  646         await tester.pumpWidget(MaterialApp(theme: theme, home: const ProgressIndicatorDemo()));
  647         await expectLater(tester, meetsGuideline(textContrastGuideline));
  648         handle.dispose();
  649       });
  650 
  651       testWidgets('reorderable_list_demo $themeName', (WidgetTester tester) async {
  652         final SemanticsHandle handle = tester.ensureSemantics();
  653         await tester.pumpWidget(MaterialApp(theme: theme, home: const ReorderableListDemo()));
  654         await expectLater(tester, meetsGuideline(textContrastGuideline));
  655         handle.dispose();
  656       });
  657 
  658       testWidgets('scrollable_tabs_demo $themeName', (WidgetTester tester) async {
  659         final SemanticsHandle handle = tester.ensureSemantics();
  660         await tester.pumpWidget(MaterialApp(theme: theme, home: const ScrollableTabsDemo()));
  661         await expectLater(tester, meetsGuideline(textContrastGuideline));
  662         handle.dispose();
  663       });
  664 
  665       testWidgets('search_demo $themeName', (WidgetTester tester) async {
  666         final SemanticsHandle handle = tester.ensureSemantics();
  667         await tester.pumpWidget(MaterialApp(theme: theme, home: const SearchDemo()));
  668         await expectLater(tester, meetsGuideline(textContrastGuideline));
  669         handle.dispose();
  670       });
  671 
  672       testWidgets('selection_controls_demo $themeName', (WidgetTester tester) async {
  673         final SemanticsHandle handle = tester.ensureSemantics();
  674         await tester.pumpWidget(MaterialApp(theme: theme, home: const SelectionControlsDemo()));
  675         await expectLater(tester, meetsGuideline(textContrastGuideline));
  676         handle.dispose();
  677       });
  678 
  679       testWidgets('slider_demo $themeName', (WidgetTester tester) async {
  680         final SemanticsHandle handle = tester.ensureSemantics();
  681         await tester.pumpWidget(MaterialApp(theme: theme, home: const SliderDemo()));
  682         await expectLater(tester, meetsGuideline(textContrastGuideline));
  683         handle.dispose();
  684       });
  685 
  686       testWidgets('snack_bar_demo $themeName', (WidgetTester tester) async {
  687         final SemanticsHandle handle = tester.ensureSemantics();
  688         await tester.pumpWidget(
  689           MaterialApp(theme: theme, home: const SnackBarDemo())
  690         );
  691         await expectLater(tester, meetsGuideline(textContrastGuideline));
  692         handle.dispose();
  693       });
  694 
  695       testWidgets('tabs_demo $themeName', (WidgetTester tester) async {
  696         final SemanticsHandle handle = tester.ensureSemantics();
  697         await tester.pumpWidget(MaterialApp(theme: theme, home: const TabsDemo()));
  698         await expectLater(tester, meetsGuideline(textContrastGuideline));
  699         handle.dispose();
  700       });
  701 
  702       testWidgets('tabs_fab_demo $themeName', (WidgetTester tester) async {
  703         final SemanticsHandle handle = tester.ensureSemantics();
  704         await tester.pumpWidget(MaterialApp(theme: theme, home: const TabsFabDemo()));
  705         await expectLater(tester, meetsGuideline(textContrastGuideline));
  706         handle.dispose();
  707       });
  708 
  709       testWidgets('text_form_field_demo $themeName', (WidgetTester tester) async {
  710         final SemanticsHandle handle = tester.ensureSemantics();
  711         await tester.pumpWidget(MaterialApp(theme: theme, home: const TextFormFieldDemo()));
  712         await expectLater(tester, meetsGuideline(textContrastGuideline));
  713         handle.dispose();
  714       });
  715 
  716       testWidgets('tooltip_demo $themeName', (WidgetTester tester) async {
  717         final SemanticsHandle handle = tester.ensureSemantics();
  718         await tester.pumpWidget(MaterialApp(theme: theme, home: const TooltipDemo()));
  719         await expectLater(tester, meetsGuideline(textContrastGuideline));
  720         handle.dispose();
  721       });
  722 
  723       testWidgets('expansion_tile_list_demo $themeName', (WidgetTester tester) async {
  724         final SemanticsHandle handle = tester.ensureSemantics();
  725         await tester.pumpWidget(MaterialApp(theme: theme, home: const ExpansionTileListDemo()));
  726         await expectLater(tester, meetsGuideline(textContrastGuideline));
  727         handle.dispose();
  728       });
  729     }
  730   });
  731 
  732   group('Gallery home page meets text contrast guidelines', () {
  733     testWidgets('options menu', (WidgetTester tester) async {
  734       await tester.pumpWidget(const GalleryApp(testMode: true));
  735       await tester.tap(find.byTooltip('Toggle options page'));
  736       await tester.pumpAndSettle();
  737       await expectLater(tester, meetsGuideline(textContrastGuideline));
  738     });
  739 
  740     testWidgets('options menu - dark theme', (WidgetTester tester) async {
  741       await tester.pumpWidget(const GalleryApp(testMode: true));
  742       await tester.tap(find.byTooltip('Toggle options page'));
  743       await tester.pumpAndSettle();
  744 
  745       // Toggle dark mode.
  746       final Finder themeToggleContainer = find.ancestor(
  747         of: find.text('Theme'),
  748         matching: find.byType(Container),
  749       );
  750       final Finder themeMenuButton = find.descendant(
  751         of: themeToggleContainer,
  752         matching: find.byIcon(Icons.arrow_drop_down),
  753       );
  754       await tester.tap(themeMenuButton);
  755       await tester.pumpAndSettle();
  756       await tester.tap(find.text('Dark'));
  757       await tester.pumpAndSettle();
  758 
  759       await expectLater(tester, meetsGuideline(textContrastGuideline));
  760     });
  761   });
  762 }