-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Make sure that an ElevatedButton doesn't crash in 0x0 environment #175006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure that an ElevatedButton doesn't crash in 0x0 environment #175006
Conversation
2816736 to
cb59c3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds a regression test to packages/flutter/test/material/elevated_button_test.dart. The new test, ElevatedButton does not crash at zero area, verifies that rendering an ElevatedButton within a zero-sized SizedBox does not cause a crash. My review includes a suggestion to add an explicit assertion to the test to improve its clarity and robustness.
| ), | ||
| ), | ||
| ); | ||
| expect(tester.getSize(find.byType(ElevatedButton)), Size.zero); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make the test's intent more explicit, it's a good practice to add an expect assertion to verify that no exceptions were thrown. This aligns with other crash regression tests in this file and follows the principle of writing effective tests.1
expect(tester.takeException(), isNull);
});Style Guide References
Footnotes
dkwingsmt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
MitchellGoodwin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well!
|
autosubmit label was removed for flutter/flutter/175006, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
87ea97e to
bf41ebc
Compare
|
autosubmit label was removed for flutter/flutter/175006, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…utter#175006) This is my attempt to handle flutter#6537 for the ElevatedButton widget. Co-authored-by: Tong Mu <[email protected]>
This is my attempt to handle #6537 for the ElevatedButton widget.