mirror of
https://github.com/flutter/flutter.git
synced 2026-01-09 07:51:35 +08:00
Make sure that a DecoratedBox doesn't crash in 0x0 environment (#180329)
This is my attempt to handle https://github.com/flutter/flutter/issues/6537 for the DecoratedBox widget.
This commit is contained in:
parent
5cd1f94844
commit
6954931bb8
@ -779,6 +779,18 @@ void main() {
|
|||||||
matchesGoldenFile('container.clipBehaviour.with.shadow.png'),
|
matchesGoldenFile('container.clipBehaviour.with.shadow.png'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('DecoratedBox does not crash at zero area', (WidgetTester tester) async {
|
||||||
|
await tester.pumpWidget(
|
||||||
|
const Directionality(
|
||||||
|
textDirection: TextDirection.ltr,
|
||||||
|
child: Center(
|
||||||
|
child: SizedBox.shrink(child: DecoratedBox(decoration: BoxDecoration())),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
expect(tester.getSize(find.byType(DecoratedBox)), Size.zero);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MockPaintingContext extends Fake implements PaintingContext {
|
class _MockPaintingContext extends Fake implements PaintingContext {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user