Added missing tests for OverflowBar example. (#146780)

Added missing tests for OverflowBar example. Issue #130459
This commit is contained in:
Matt Carroll 2024-04-16 15:10:56 -07:00 committed by GitHub
parent bc88d0b9ed
commit 4daad32a01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 1 deletions

View File

@ -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',

View File

@ -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);
});
}