Visitar URL original
Make sure that a Badge doesn't crash in 0x0 environment (#172065) · korca0220/flutter@9ea206f · GitHub
Skip to content

Commit 9ea206f

Browse files
ahmedsameha1dkwingsmt
authored andcommitted
Make sure that a Badge doesn't crash in 0x0 environment (flutter#172065)
This is my attempt to handle flutter#6537 for the Badge UI control. --------- Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
1 parent 171dba9 commit 9ea206f

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎packages/flutter/test/material/badge_test.dart‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,18 @@ void main() {
445445
expect(box, paints..rrect(rrect: RRect.fromLTRBR(0, -7, 30 + 8, 23, badgeRadius)));
446446
});
447447

448+
testWidgets('Badge renders at zero area', (WidgetTester tester) async {
449+
await tester.pumpWidget(
450+
const MaterialApp(
451+
home: Center(
452+
child: SizedBox.shrink(child: Badge(label: Text('X'))),
453+
),
454+
),
455+
);
456+
final Finder label = find.text('X');
457+
expect(tester.getSize(label), Size.zero);
458+
});
459+
448460
testWidgets('Badge.count maxCount limits displayed value', (WidgetTester tester) async {
449461
Widget buildFrame(int count, [int maxCount = 999]) {
450462
return MaterialApp(

0 commit comments

Comments
 (0)