File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
packages/flutter/test/material Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -4851,6 +4851,29 @@ void main() {
48514851 checkPopupMenu (popupMenuTheme2);
48524852 });
48534853
4854+ testWidgets ('PopupMenuButton does not crash at zero area' , (WidgetTester tester) async {
4855+ // This test case only verifies the layout of the button itself, not the
4856+ // overlay, because there doesn't seem to be a way to open the menu at zero
4857+ // area. Though, this should be sufficient since the overlay has been verified
4858+ // by similar tests for MenuAnchor and PopupMenuItem.
4859+ tester.view.physicalSize = Size .zero;
4860+ addTearDown (tester.view.reset);
4861+ await tester.pumpWidget (
4862+ MaterialApp (
4863+ home: Center (
4864+ child: SizedBox .shrink (
4865+ child: PopupMenuButton <String >(
4866+ itemBuilder: (BuildContext context) => < PopupMenuItem <String >> [
4867+ const PopupMenuItem <String >(value: 'X' , child: Text ('X' )),
4868+ ],
4869+ ),
4870+ ),
4871+ ),
4872+ ),
4873+ );
4874+ expect (tester.getSize (find.byType (PopupMenuButton <String >)), Size .zero);
4875+ });
4876+
48544877 testWidgets ('PopupMenuDivider does not crash at zero area' , (WidgetTester tester) async {
48554878 await tester.pumpWidget (
48564879 const MaterialApp (
You can’t perform that action at this time.
0 commit comments