Make sure that a DragTarget doesn't crash in 0x0 environment#180422
Make sure that a DragTarget doesn't crash in 0x0 environment#180422auto-submit[bot] merged 2 commits intoflutter:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds a test to prevent a regression for a crash in DragTarget when it has a zero-sized area. However, the test as written only confirms that the DragTarget can have a zero size, but it does not simulate a drag operation over it, which is the scenario that causes the crash. I've suggested an update to the test to include a Draggable and a drag gesture. Furthermore, it appears the actual fix for the bug is missing from this pull request; without it, the corrected test would fail.
| testWidgets('DragTarget does not crash at zero area', ( | ||
| WidgetTester tester, | ||
| ) async { | ||
| await tester.pumpWidget( | ||
| Directionality( | ||
| textDirection: TextDirection.ltr, | ||
| child: Center( | ||
| child: SizedBox.shrink( | ||
| child: DragTarget<bool>(builder: (_, _, _) => Text('X')), | ||
| ), | ||
| ), | ||
| ), | ||
| ); | ||
| expect(tester.getSize(find.byType(DragTarget<bool>)), Size.zero); | ||
| }); |
There was a problem hiding this comment.
This test case is intended to verify that DragTarget doesn't crash when it has a zero size, but it only checks that the widget can be sized to zero. It doesn't simulate a drag operation, which is necessary to trigger the crash condition described in the associated issue. The test should be updated to include a Draggable widget and simulate a drag gesture over the zero-sized DragTarget to ensure the fix is properly tested.
testWidgets('DragTarget does not crash when dragged over at zero size', (
WidgetTester tester,
) async {
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: Stack(
children: <Widget>[
const Draggable<int>(
data: 1,
feedback: SizedBox(width: 20, height: 20),
child: SizedBox(width: 20, height: 20),
),
Center(
child: SizedBox.shrink(
child: DragTarget<int>(
builder: (_, __, ___) => const SizedBox.shrink(),
),
),
),
],
),
),
);
expect(tester.getSize(find.byType(DragTarget<int>)), Size.zero);
final TestGesture gesture = await tester.startGesture(tester.getCenter(find.byType(Draggable<int>)));
await tester.pump(); // Start the drag.
await gesture.moveTo(tester.getCenter(find.byType(DragTarget<int>)));
await tester.pump(); // Drag over the target.
// The test passes if it doesn't crash.
await gesture.up();
});|
Hi @ahmedsameha1, can you resolve the conflicts here to unblock this PR? Thanks! |
41c3c7a to
15cb2fe
Compare
flutter/flutter@d81cd3e...793b0b8 2026-01-13 [email protected] Make sure that a FormField doesn't crash at 0x0 environment (flutter/flutter#180810) 2026-01-13 [email protected] Roll Fuchsia Linux SDK from VYeyMPe1lyCtlcl-V... to vTYb37OeUqZRxpiiP... (flutter/flutter#180880) 2026-01-13 [email protected] Make sure that a DisplayFeatureSubScreen doesn't crash in 0x0 environ… (flutter/flutter#180357) 2026-01-13 [email protected] Make sure that a DragTarget doesn't crash in 0x0 environment (flutter/flutter#180422) 2026-01-13 [email protected] Manually roll test dependencies (flutter/flutter#180886) 2026-01-12 [email protected] Roll Skia from f70bcbf1b090 to 714d0af2eda7 (2 revisions) (flutter/flutter#180866) 2026-01-12 [email protected] Roll libpng to version 1.6.53 (flutter/flutter#180712) 2026-01-12 [email protected] Turn on fragment shader equality test (flutter/flutter#180784) 2026-01-12 [email protected] Update `PlatformPlugin` to not call `setStatusBarColor`, `setNavigationBarColor`, `setNavigationBarDividerColor` when disabled (flutter/flutter#180061) 2026-01-12 [email protected] Roll Skia from a650ce2b0d50 to f70bcbf1b090 (1 revision) (flutter/flutter#180860) 2026-01-12 [email protected] Fix RawAutocomplete unmounted crash during async optionsBuilder (flutter/flutter#180824) 2026-01-12 [email protected] Fix `documentation member not recognized` because of missing import in `FlutterEngine.java` (flutter/flutter#180731) 2026-01-12 [email protected] Roll Dart SDK from 42fd9ef68c1a to 34318de9874b (1 revision) (flutter/flutter#180854) 2026-01-12 [email protected] Add API sample and docs for Expansible widget (flutter/flutter#180273) 2026-01-12 [email protected] Roll Skia from 487a9943210b to a650ce2b0d50 (2 revisions) (flutter/flutter#180849) 2026-01-12 [email protected] Improve code quality in `BinaryMessenger.java` (flutter/flutter#180733) 2026-01-12 [email protected] Reland `Enabled some disabled impeller fragment shader dart tests` (flutter/flutter#180788) 2026-01-12 [email protected] [ Tool ] Fix `flutter run -d all` crash (flutter/flutter#180845) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…#180422) This is my attempt to handle flutter#6537 for the DragTarget widget.
flutter/flutter@d81cd3e...793b0b8 2026-01-13 [email protected] Make sure that a FormField doesn't crash at 0x0 environment (flutter/flutter#180810) 2026-01-13 [email protected] Roll Fuchsia Linux SDK from VYeyMPe1lyCtlcl-V... to vTYb37OeUqZRxpiiP... (flutter/flutter#180880) 2026-01-13 [email protected] Make sure that a DisplayFeatureSubScreen doesn't crash in 0x0 environ… (flutter/flutter#180357) 2026-01-13 [email protected] Make sure that a DragTarget doesn't crash in 0x0 environment (flutter/flutter#180422) 2026-01-13 [email protected] Manually roll test dependencies (flutter/flutter#180886) 2026-01-12 [email protected] Roll Skia from f70bcbf1b090 to 714d0af2eda7 (2 revisions) (flutter/flutter#180866) 2026-01-12 [email protected] Roll libpng to version 1.6.53 (flutter/flutter#180712) 2026-01-12 [email protected] Turn on fragment shader equality test (flutter/flutter#180784) 2026-01-12 [email protected] Update `PlatformPlugin` to not call `setStatusBarColor`, `setNavigationBarColor`, `setNavigationBarDividerColor` when disabled (flutter/flutter#180061) 2026-01-12 [email protected] Roll Skia from a650ce2b0d50 to f70bcbf1b090 (1 revision) (flutter/flutter#180860) 2026-01-12 [email protected] Fix RawAutocomplete unmounted crash during async optionsBuilder (flutter/flutter#180824) 2026-01-12 [email protected] Fix `documentation member not recognized` because of missing import in `FlutterEngine.java` (flutter/flutter#180731) 2026-01-12 [email protected] Roll Dart SDK from 42fd9ef68c1a to 34318de9874b (1 revision) (flutter/flutter#180854) 2026-01-12 [email protected] Add API sample and docs for Expansible widget (flutter/flutter#180273) 2026-01-12 [email protected] Roll Skia from 487a9943210b to a650ce2b0d50 (2 revisions) (flutter/flutter#180849) 2026-01-12 [email protected] Improve code quality in `BinaryMessenger.java` (flutter/flutter#180733) 2026-01-12 [email protected] Reland `Enabled some disabled impeller fragment shader dart tests` (flutter/flutter#180788) 2026-01-12 [email protected] [ Tool ] Fix `flutter run -d all` crash (flutter/flutter#180845) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This is my attempt to handle #6537 for the DragTarget widget.