-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Make sure that a Draggable doesn't crash in 0x0 environment #180380
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 a Draggable doesn't crash in 0x0 environment #180380
Conversation
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 widget test to ensure that Draggable widgets do not crash when placed in a zero-sized area. The test correctly sets up the scenario, but it does not trigger a drag gesture, which is necessary to reproduce the crash described in the associated issue. I've suggested an addition to the test to initiate a drag gesture, which will properly verify the fix.
| ), | ||
| ), | ||
| ); | ||
| expect(tester.getSize(find.byType(Draggable<bool>)), 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.
The test sets up the zero-sized Draggable correctly, but it doesn't attempt to drag it. The crash described in issue #6537 occurs when a drag is initiated. To properly test the fix, we should simulate a drag gesture on the Draggable.
expect(tester.getSize(find.byType(Draggable<bool>)), Size.zero);
// Start a drag gesture to ensure it doesn't crash.
final TestGesture gesture = await tester.startGesture(tester.getCenter(find.byType(Draggable<bool>)));
await gesture.up();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.
I think this isn't true and the test is fine as-is, right?
justinmc
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 👍
| ), | ||
| ), | ||
| ); | ||
| expect(tester.getSize(find.byType(Draggable<bool>)), 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.
I think this isn't true and the test is fine as-is, right?
This is my attempt to handle #6537 for the Draggable widget.