Make sure that a FilledButton doesn't crash in 0x0 environment#175110
Make sure that a FilledButton doesn't crash in 0x0 environment#175110auto-submit[bot] merged 5 commits intoflutter:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a regression test for FilledButton to ensure it doesn't crash when placed in a zero-sized environment, addressing issue #6537. The new test case is clear, concise, and accurately simulates the problematic scenario. This is a valuable addition to the test suite that will help prevent future regressions. The implementation is excellent and I have no further comments.
There was a problem hiding this comment.
Code Review
This pull request adds a regression test to ensure FilledButton doesn't crash in a zero-sized environment. The test case is well-written and accurately reflects the issue. However, the fix for the underlying crash seems to be missing from this pull request. Please add the fix to this PR to make it complete.
| ), | ||
| ); | ||
| expect(tester.getSize(find.byType(FilledButton)), Size.zero); | ||
| }); |
There was a problem hiding this comment.
This test covers the simple FilledButton. To improve test coverage, it would be beneficial to also add a test case for FilledButton.icon, as its layout logic is more complex and could also be affected by this issue.
Here's a suggestion for an additional test:
testWidgets('FilledButton.icon does not crash at zero area', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Center(
child: SizedBox.shrink(
child: FilledButton.icon(
onPressed: () {},
icon: const Icon(Icons.add),
label: const Text('X'),
),
),
),
),
);
expect(tester.getSize(find.byType(FilledButton)), Size.zero);
});
dkwingsmt
left a comment
There was a problem hiding this comment.
Checklist:
- The test is in the correct file
- The test name goes “does not crash at zero area”
- The target widget is wrapped by
Center(or is fullscreen) - The target widget does not have an overlay, or the overlay is tested
- The target widget is expected to have a size of exactly
Size.zero
|
autosubmit label was removed for flutter/flutter/175110, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
0729b21 to
90758af
Compare
|
autosubmit label was removed for flutter/flutter/175110, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
autosubmit label was removed for flutter/flutter/175110, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
autosubmit label was removed for flutter/flutter/175110, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
autosubmit label was removed for flutter/flutter/175110, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…er#175110) This is my attempt to handle flutter#6537 for the FilledButton widget. Co-authored-by: Tong Mu <[email protected]>
This is my attempt to handle #6537 for the FilledButton widget.