Skip to content

Commit

Permalink
Added missing tests for OverflowBar example. (flutter#146780)
Browse files Browse the repository at this point in the history
Added missing tests for OverflowBar example. Issue flutter#130459
  • Loading branch information
matthew-carroll committed Apr 16, 2024
1 parent bc88d0b commit 4daad32
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
1 change: 0 additions & 1 deletion dev/bots/check_code_samples.dart
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ final Set<String> _knownMissingTests = <String>{
'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',
Expand Down
28 changes: 28 additions & 0 deletions examples/api/test/widgets/overflow_bar/overflow_bar.0_test.dart
Original file line number Diff line number Diff line change
@@ -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);
});
}

0 comments on commit 4daad32

Please sign in to comment.