From 1160c8fd298f545ab50694eb71f7f204923a52fa Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Mon, 25 Nov 2019 12:43:58 -0800 Subject: [PATCH] Re-Staged: Fixing ContinuousRectangleBorder bottom radius (#45304) --- .../painting/continuous_rectangle_border.dart | 8 +- .../continous_rectangle_border_test.dart | 93 ++++++++++++++++++- 2 files changed, 94 insertions(+), 7 deletions(-) diff --git a/packages/flutter/lib/src/painting/continuous_rectangle_border.dart b/packages/flutter/lib/src/painting/continuous_rectangle_border.dart index 603f9b838ea..16fe5b1b569 100644 --- a/packages/flutter/lib/src/painting/continuous_rectangle_border.dart +++ b/packages/flutter/lib/src/painting/continuous_rectangle_border.dart @@ -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(); } diff --git a/packages/flutter/test/painting/continous_rectangle_border_test.dart b/packages/flutter/test/painting/continous_rectangle_border_test.dart index 755df17c4b9..5c90eb09d2e 100644 --- a/packages/flutter/test/painting/continous_rectangle_border_test.dart +++ b/packages/flutter/test/painting/continous_rectangle_border_test.dart @@ -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 {