Re-Staged: Fixing ContinuousRectangleBorder bottom radius (#45304)

This commit is contained in:
Kate Lovett 2019-11-25 12:43:58 -08:00 committed by GitHub
parent c64d91a03f
commit 1160c8fd29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 94 additions and 7 deletions

View file

@ -115,10 +115,10 @@ class ContinuousRectangleBorder extends ShapeBorder {
..cubicTo(left, top, left, top, left + tlRadiusY, top)
..lineTo(right - trRadiusX, top)
..cubicTo(right, top, right, top, right, top + trRadiusY)
..lineTo(right, bottom - blRadiusX)
..cubicTo(right, bottom, right, bottom, right - blRadiusY, bottom)
..lineTo(left + brRadiusX, bottom)
..cubicTo(left, bottom, left, bottom, left, bottom - brRadiusY)
..lineTo(right, bottom - brRadiusX)
..cubicTo(right, bottom, right, bottom, right - brRadiusY, bottom)
..lineTo(left + blRadiusX, bottom)
..cubicTo(left, bottom, left, bottom, left, bottom - blRadiusY)
..close();
}

View file

@ -78,11 +78,13 @@ void main() {
testWidgets('Golden test varying radii', (WidgetTester tester) async {
await tester.pumpWidget(RepaintBoundary(
child: Material(
color: Colors.greenAccent[400],
color: Colors.green[100],
shape: const ContinuousRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(28.0),
bottomRight: Radius.circular(14.0),
topLeft: Radius.elliptical(100.0, 200.0),
topRight: Radius.circular(350.0),
bottomLeft: Radius.elliptical(2000.0, 100.0),
bottomRight: Radius.circular(700.0),
),
),
),
@ -94,6 +96,91 @@ void main() {
find.byType(RepaintBoundary),
matchesGoldenFile('continuous_rectangle_border.golden_test_varying_radii.png'),
);
// TODO(Piinks): Remove skip once web goldens are supported, https://github.com/flutter/flutter/issues/40297
}, skip: isBrowser);
testWidgets('Golden test topLeft radii', (WidgetTester tester) async {
await tester.pumpWidget(RepaintBoundary(
child: Material(
color: Colors.green[200],
shape: const ContinuousRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.elliptical(100.0, 200.0),
),
),
),
));
await tester.pumpAndSettle();
await expectLater(
find.byType(RepaintBoundary),
matchesGoldenFile('continuous_rectangle_border.golden_test_topLeft_radii.png'),
);
// TODO(Piinks): Remove skip once web goldens are supported, https://github.com/flutter/flutter/issues/40297
}, skip: isBrowser);
testWidgets('Golden test topRight radii', (WidgetTester tester) async {
await tester.pumpWidget(RepaintBoundary(
child: Material(
color: Colors.green[300],
shape: const ContinuousRectangleBorder(
borderRadius: BorderRadius.only(
topRight: Radius.circular(350.0),
),
),
),
));
await tester.pumpAndSettle();
await expectLater(
find.byType(RepaintBoundary),
matchesGoldenFile('continuous_rectangle_border.golden_test_topRight_radii.png'),
);
// TODO(Piinks): Remove skip once web goldens are supported, https://github.com/flutter/flutter/issues/40297
}, skip: isBrowser);
testWidgets('Golden test bottomLeft radii', (WidgetTester tester) async {
await tester.pumpWidget(RepaintBoundary(
child: Material(
color: Colors.green[400],
shape: const ContinuousRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.elliptical(2000.0, 100.0),
),
),
),
));
await tester.pumpAndSettle();
await expectLater(
find.byType(RepaintBoundary),
matchesGoldenFile('continuous_rectangle_border.golden_test_bottomLeft_radii.png'),
);
// TODO(Piinks): Remove skip once web goldens are supported, https://github.com/flutter/flutter/issues/40297
}, skip: isBrowser);
testWidgets('Golden test bottomRight radii', (WidgetTester tester) async {
await tester.pumpWidget(RepaintBoundary(
child: Material(
color: Colors.green[500],
shape: const ContinuousRectangleBorder(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(700.0),
),
),
),
));
await tester.pumpAndSettle();
await expectLater(
find.byType(RepaintBoundary),
matchesGoldenFile('continuous_rectangle_border.golden_test_bottomRight_radii.png'),
);
// TODO(Piinks): Remove skip once web goldens are supported, https://github.com/flutter/flutter/issues/40297
}, skip: isBrowser);
testWidgets('Golden test large radii', (WidgetTester tester) async {