From d1707ab0adde059eaeea51019609b1048e7fdc1a Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 14 Feb 2019 15:15:01 -0800 Subject: [PATCH] Revert "Fix overflow clipping/fading for text (#27892)" (#27966) This reverts commit 46cabdab22ce59ba06949d666216ae4d10b76761. --- .../flutter/lib/src/rendering/paragraph.dart | 2 +- packages/flutter/test/widgets/text_test.dart | 69 ------------------- 2 files changed, 1 insertion(+), 70 deletions(-) diff --git a/packages/flutter/lib/src/rendering/paragraph.dart b/packages/flutter/lib/src/rendering/paragraph.dart index 08869df723..1742c190fa 100644 --- a/packages/flutter/lib/src/rendering/paragraph.dart +++ b/packages/flutter/lib/src/rendering/paragraph.dart @@ -287,9 +287,9 @@ class RenderParagraph extends RenderBox { // Other _textPainter state like didExceedMaxLines will also be affected. // See also RenderEditable which has a similar issue. final Size textSize = _textPainter.size; + final bool didOverflowHeight = _textPainter.didExceedMaxLines; size = constraints.constrain(textSize); - final bool didOverflowHeight = size.height < textSize.height || _textPainter.didExceedMaxLines; final bool didOverflowWidth = size.width < textSize.width; // TODO(abarth): We're only measuring the sizes of the line boxes here. If // the glyphs draw outside the line boxes, we might think that there isn't diff --git a/packages/flutter/test/widgets/text_test.dart b/packages/flutter/test/widgets/text_test.dart index f8f374f170..550a70f9a1 100644 --- a/packages/flutter/test/widgets/text_test.dart +++ b/packages/flutter/test/widgets/text_test.dart @@ -7,7 +7,6 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter/foundation.dart'; -import '../rendering/mock_canvas.dart'; import 'semantics_tester.dart'; void main() { @@ -247,72 +246,4 @@ void main() { expect(semantics, hasSemantics(expectedSemantics, ignoreTransform: true, ignoreId: true)); semantics.dispose(); }, skip: true); // TODO(jonahwilliams): correct once https://github.com/flutter/flutter/issues/20891 is resolved. - - testWidgets('Overflow is clipping correctly - short text with overflow: clip', (WidgetTester tester) async { - await _pumpTextWidget( - tester: tester, - overflow: TextOverflow.clip, - text: 'Hi', - ); - - expect(find.byType(Text), isNot(paints..clipRect())); - }); - - testWidgets('Overflow is clipping correctly - long text with overflow: ellipsis', (WidgetTester tester) async { - await _pumpTextWidget( - tester: tester, - overflow: TextOverflow.ellipsis, - text: 'a long long long long text, should be clip', - ); - - expect(find.byType(Text), paints..clipRect(rect: Rect.fromLTWH(0, 0, 50, 50))); - }); - - testWidgets('Overflow is clipping correctly - short text with overflow: ellipsis', (WidgetTester tester) async { - await _pumpTextWidget( - tester: tester, - overflow: TextOverflow.ellipsis, - text: 'Hi', - ); - - expect(find.byType(Text), isNot(paints..clipRect())); - }); - - testWidgets('Overflow is clipping correctly - long text with overflow: fade', (WidgetTester tester) async { - await _pumpTextWidget( - tester: tester, - overflow: TextOverflow.fade, - text: 'a long long long long text, should be clip', - ); - - expect(find.byType(Text), paints..clipRect(rect: Rect.fromLTWH(0, 0, 50, 50))); - }); - - testWidgets('Overflow is clipping correctly - short text with overflow: fade', (WidgetTester tester) async { - await _pumpTextWidget( - tester: tester, - overflow: TextOverflow.fade, - text: 'Hi', - ); - - expect(find.byType(Text), isNot(paints..clipRect())); - }); -} - -Future _pumpTextWidget({ WidgetTester tester, String text, TextOverflow overflow }) { - return tester.pumpWidget( - Directionality( - textDirection: TextDirection.ltr, - child: Center( - child: Container( - width: 50.0, - height: 50.0, - child: Text( - text, - overflow: overflow, - ), - ), - ), - ), - ); }