Skip to content

Commit 0908c2e

Browse files
authored
Make sure that a Slider doesn't crash in 0x0 environment (flutter#177882)
This is my attempt to handle flutter#6537 for the Slider widget.
1 parent a642edd commit 0908c2e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/flutter/test/material/slider_test.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5490,4 +5490,17 @@ void main() {
54905490
paints..circle(x: 800.0 - sliderPadding, y: 300.0, color: theme.colorScheme.primary),
54915491
);
54925492
});
5493+
5494+
testWidgets('Slider does not crash at zero area', (WidgetTester tester) async {
5495+
await tester.pumpWidget(
5496+
MaterialApp(
5497+
home: Scaffold(
5498+
body: Center(
5499+
child: SizedBox.shrink(child: Slider(value: 1, onChanged: (_) {})),
5500+
),
5501+
),
5502+
),
5503+
);
5504+
expect(tester.getSize(find.byType(Slider)), Size.zero);
5505+
});
54935506
}

0 commit comments

Comments
 (0)