Make sure that a CupertinoDesktopTextSelectionToolbar doesn't crash i… (#173964)

This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
CupertinoDesktopTextSelectionToolbar UI control.

---------

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
This commit is contained in:
Ahmed Mohamed Sameh 2025-10-21 01:45:08 +03:00 committed by GitHub
parent 246a6a2f2f
commit 3d3e2ebc51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -127,4 +127,22 @@ void main() {
greaterThan(anchor),
);
});
testWidgets('CupertinoDesktopTextSelectionToolbar does not crash at zero area', (
WidgetTester tester,
) async {
await tester.pumpWidget(
CupertinoApp(
home: Center(
child: SizedBox.shrink(
child: CupertinoDesktopTextSelectionToolbar(
anchor: const Offset(10, 10),
children: const <Widget>[Text('X')],
),
),
),
),
);
expect(tester.getSize(find.byType(CupertinoDesktopTextSelectionToolbar)), Size.zero);
});
}