diff --git a/dev/bots/check_code_samples.dart b/dev/bots/check_code_samples.dart index 53e6cfabff..c5415bb846 100644 --- a/dev/bots/check_code_samples.dart +++ b/dev/bots/check_code_samples.dart @@ -463,7 +463,6 @@ final Set _knownMissingTests = { 'examples/api/test/widgets/tween_animation_builder/tween_animation_builder.0_test.dart', 'examples/api/test/widgets/single_child_scroll_view/single_child_scroll_view.1_test.dart', 'examples/api/test/widgets/single_child_scroll_view/single_child_scroll_view.0_test.dart', - 'examples/api/test/widgets/overflow_bar/overflow_bar.0_test.dart', 'examples/api/test/widgets/restoration/restoration_mixin.0_test.dart', 'examples/api/test/widgets/actions/actions.0_test.dart', 'examples/api/test/widgets/actions/action_listener.0_test.dart', diff --git a/examples/api/test/widgets/overflow_bar/overflow_bar.0_test.dart b/examples/api/test/widgets/overflow_bar/overflow_bar.0_test.dart new file mode 100644 index 0000000000..56d67ec8c5 --- /dev/null +++ b/examples/api/test/widgets/overflow_bar/overflow_bar.0_test.dart @@ -0,0 +1,28 @@ +// 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_api_samples/widgets/overflow_bar/overflow_bar.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('OverflowBar displays buttons', (WidgetTester tester) async { + await tester.pumpWidget( + const example.OverflowBarExampleApp(), + ); + + // Creates a finder that matches widgets of the given + // `widgetType`, ensuring that the given widgets exist + // inside of an OverflowBar. + Finder buttonsFinder(Type widgetType) { + return find.descendant( + of: find.byType(OverflowBar), + matching: find.byType(widgetType), + ); + } + + expect(buttonsFinder(TextButton), findsNWidgets(2)); + expect(buttonsFinder(OutlinedButton), findsOne); + }); +}