diff --git a/packages/flutter/test/rendering/editable_test.dart b/packages/flutter/test/rendering/editable_test.dart index 3ce391ebd59..6fa1fc2a6a6 100644 --- a/packages/flutter/test/rendering/editable_test.dart +++ b/packages/flutter/test/rendering/editable_test.dart @@ -428,10 +428,7 @@ void main() { pumpFrame(phase: EnginePhase.compositingBits); expect(editable, paintsExactlyCountTimes(#drawRRect, 0)); - - // TODO(yjbanov): ahem.ttf doesn't have Chinese glyphs, making this test - // sensitive to browser/OS when running in web mode: - }, skip: kIsWeb); // https://github.com/flutter/flutter/issues/83129 + }); test('text is painted above selection', () { final TextSelectionDelegate delegate = _FakeEditableTextState(); @@ -810,51 +807,44 @@ void main() { expect(editable.hasFocus, false); }); - test( - 'has correct maxScrollExtent', - () { - final TextSelectionDelegate delegate = _FakeEditableTextState(); - EditableText.debugDeterministicCursor = true; + test('has correct maxScrollExtent', () { + final TextSelectionDelegate delegate = _FakeEditableTextState(); + EditableText.debugDeterministicCursor = true; - final RenderEditable editable = RenderEditable( - maxLines: 2, - backgroundCursorColor: Colors.grey, - textDirection: TextDirection.ltr, - cursorColor: const Color.fromARGB(0xFF, 0xFF, 0x00, 0x00), - offset: ViewportOffset.zero(), - textSelectionDelegate: delegate, - text: const TextSpan( - text: - '撒地方加咖啡哈金凤凰卡号方式剪坏算法发挥福建垃\nasfjafjajfjaslfjaskjflasjfksajf撒分开建安路口附近拉设\n计费可使肌肤撒附近埃里克圾房卡设计费"', - style: TextStyle(height: 1.0, fontSize: 10.0, fontFamily: 'Roboto'), - ), - startHandleLayerLink: LayerLink(), - endHandleLayerLink: LayerLink(), - selection: const TextSelection.collapsed(offset: 4, affinity: TextAffinity.upstream), - ); + final RenderEditable editable = RenderEditable( + maxLines: 2, + backgroundCursorColor: Colors.grey, + textDirection: TextDirection.ltr, + cursorColor: const Color.fromARGB(0xFF, 0xFF, 0x00, 0x00), + offset: ViewportOffset.zero(), + textSelectionDelegate: delegate, + text: const TextSpan( + text: + '撒地方加咖啡哈金凤凰卡号方式剪坏算法发挥福建垃\nasfjafjajfjaslfjaskjflasjfksajf撒分开建安路口附近拉设\n计费可使肌肤撒附近埃里克圾房卡设计费"', + style: TextStyle(height: 1.0, fontSize: 10.0, fontFamily: 'Roboto'), + ), + startHandleLayerLink: LayerLink(), + endHandleLayerLink: LayerLink(), + selection: const TextSelection.collapsed(offset: 4, affinity: TextAffinity.upstream), + ); - editable.layout(BoxConstraints.loose(const Size(100.0, 1000.0))); - expect(editable.size, equals(const Size(100, 20))); - expect(editable.maxLines, equals(2)); - expect(editable.maxScrollExtent, equals(90)); + editable.layout(BoxConstraints.loose(const Size(100.0, 1000.0))); + expect(editable.size, equals(const Size(100, 20))); + expect(editable.maxLines, equals(2)); + expect(editable.maxScrollExtent, equals(90)); - editable.layout(BoxConstraints.loose(const Size(150.0, 1000.0))); - expect(editable.maxScrollExtent, equals(50)); + editable.layout(BoxConstraints.loose(const Size(150.0, 1000.0))); + expect(editable.maxScrollExtent, equals(50)); - editable.layout(BoxConstraints.loose(const Size(200.0, 1000.0))); - expect(editable.maxScrollExtent, equals(40)); + editable.layout(BoxConstraints.loose(const Size(200.0, 1000.0))); + expect(editable.maxScrollExtent, equals(40)); - editable.layout(BoxConstraints.loose(const Size(500.0, 1000.0))); - expect(editable.maxScrollExtent, equals(10)); + editable.layout(BoxConstraints.loose(const Size(500.0, 1000.0))); + expect(editable.maxScrollExtent, equals(10)); - editable.layout(BoxConstraints.loose(const Size(1000.0, 1000.0))); - expect(editable.maxScrollExtent, equals(10)); - // TODO(yjbanov): This test is failing in the Dart HHH-web bot and - // needs additional investigation before it can be reenabled. - }, - // https://github.com/flutter/flutter/issues/93691 - skip: const bool.fromEnvironment('DART_HHH_BOT'), - ); + editable.layout(BoxConstraints.loose(const Size(1000.0, 1000.0))); + expect(editable.maxScrollExtent, equals(10)); + }); test('getEndpointsForSelection handles empty characters', () { final TextSelectionDelegate delegate = _FakeEditableTextState(); @@ -1505,7 +1495,7 @@ void main() { final Rect composingRect = editable.getRectForComposingRange(const TextRange(start: 4, end: 5))!; expect(composingRect, const Rect.fromLTRB(40.0, 0.0, 54.0, 14.0)); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61021 + }); test('able to render multiple WidgetSpans', () async { final TextSelectionDelegate delegate = @@ -1550,7 +1540,7 @@ void main() { final Rect composingRect = editable.getRectForComposingRange(const TextRange(start: 4, end: 7))!; expect(composingRect, const Rect.fromLTRB(40.0, 0.0, 82.0, 14.0)); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61021 + }); test('able to render WidgetSpans with line wrap', () async { final TextSelectionDelegate delegate = @@ -1599,7 +1589,7 @@ void main() { expect(composingRect, const Rect.fromLTRB(40.0, 0.0, 68.0, 14.0)); composingRect = editable.getRectForComposingRange(const TextRange(start: 6, end: 7))!; expect(composingRect, const Rect.fromLTRB(0.0, 14.0, 14.0, 28.0)); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61021 + }); test('able to render WidgetSpans with line wrap alternating spans', () async { final TextSelectionDelegate delegate = @@ -1657,7 +1647,7 @@ void main() { expect(composingRect, const Rect.fromLTRB(24.0, 18.0, 34.0, 28.0)); composingRect = editable.getRectForComposingRange(const TextRange(start: 9, end: 10))!; expect(composingRect, const Rect.fromLTRB(34.0, 14.0, 48.0, 28.0)); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61021 + }); test('able to render WidgetSpans nested spans', () async { final TextSelectionDelegate delegate = @@ -1711,7 +1701,7 @@ void main() { expect(composingRect, const Rect.fromLTRB(0.0, 14.0, 14.0, 28.0)); composingRect = editable.getRectForComposingRange(const TextRange(start: 7, end: 8)); expect(composingRect, null); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61021 + }); test('WidgetSpan render box is painted at correct offset when scrolled', () async { final TextSelectionDelegate delegate = @@ -1752,7 +1742,7 @@ void main() { final Rect composingRect = editable.getRectForComposingRange(const TextRange(start: 4, end: 5))!; expect(composingRect, const Rect.fromLTRB(40.0, -100.0, 54.0, -86.0)); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61021 + }); test('can compute IntrinsicWidth for WidgetSpans', () { // Regression test for https://github.com/flutter/flutter/issues/59316 @@ -1893,7 +1883,7 @@ void main() { result = BoxHitTestResult(); editable.hitTest(result, position: const Offset(5.0, 15.0)); expect(result.path, hasLength(0)); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61020 + }); test('hits correct WidgetSpan when scrolled', () { final String text = '${"\n" * 10}test'; @@ -1975,7 +1965,7 @@ void main() { result = BoxHitTestResult(); editable.hitTest(result, position: const Offset(5.0, 15.0)); expect(result.path, hasLength(1)); // Only the RenderEditable. - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61020 + }); }); test('does not skip TextPainter.layout because of invalid cache', () { diff --git a/packages/flutter/test/rendering/paragraph_test.dart b/packages/flutter/test/rendering/paragraph_test.dart index c8f5ea2bc51..4968c510db5 100644 --- a/packages/flutter/test/rendering/paragraph_test.dart +++ b/packages/flutter/test/rendering/paragraph_test.dart @@ -247,7 +247,7 @@ void main() { expect(boxes[3], const TextBox.fromLTRBD(130.0, 10.0, 156.0, 20.0, TextDirection.ltr)); // 'fifth': expect(boxes[4], const TextBox.fromLTRBD(0.0, 20.0, 50.0, 30.0, TextDirection.ltr)); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61016 + }); test('getWordBoundary control test', () { final RenderParagraph paragraph = RenderParagraph( @@ -343,7 +343,7 @@ void main() { relayoutWith(maxLines: 100, softWrap: true, overflow: TextOverflow.fade); expect(paragraph.debugHasOverflowShader, isFalse); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61018 + }); test('maxLines', () { final RenderParagraph paragraph = RenderParagraph( @@ -583,7 +583,7 @@ void main() { expect(boxes[2], const TextBox.fromLTRBD(24.0, 0.0, 38.0, 14.0, TextDirection.ltr)); expect(boxes[3], const TextBox.fromLTRBD(38.0, 4.0, 48.0, 14.0, TextDirection.ltr)); expect(boxes[4], const TextBox.fromLTRBD(48.0, 0.0, 62.0, 14.0, TextDirection.ltr)); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61020 + }); test('getBoxesForSelection with boxHeightStyle for inline widgets', () { const TextSpan text = TextSpan( @@ -625,7 +625,7 @@ void main() { expect(boxes[2], const TextBox.fromLTRBD(24.0, 0.0, 38.0, 14.0, TextDirection.ltr)); expect(boxes[3], const TextBox.fromLTRBD(38.0, 0.0, 48.0, 14.0, TextDirection.ltr)); expect(boxes[4], const TextBox.fromLTRBD(48.0, 0.0, 62.0, 14.0, TextDirection.ltr)); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61020 + }); test('inline widgets multiline test', () { const TextSpan text = TextSpan( @@ -678,7 +678,7 @@ void main() { // Wraps expect(boxes[7], const TextBox.fromLTRBD(0.0, 28.0, 14.0, 42.0, TextDirection.ltr)); expect(boxes[8], const TextBox.fromLTRBD(14.0, 28.0, 28.0, 42.0, TextDirection.ltr)); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61020 + }); test('Does not include the semantics node of truncated rendering children', () { // Regression test for https://github.com/flutter/flutter/issues/88180 @@ -794,34 +794,30 @@ void main() { expect(node.childrenCount, 2); }); - test( - 'assembleSemanticsNode handles empty WidgetSpans that do not yield selection boxes', - () { - final TextSpan text = TextSpan( - text: '', - children: [ - TextSpan(text: 'A', recognizer: TapGestureRecognizer()..onTap = () {}), - const WidgetSpan(child: SizedBox.shrink()), - TextSpan(text: 'C', recognizer: TapGestureRecognizer()..onTap = () {}), - ], - ); - final List renderBoxes = [ - RenderParagraph(const TextSpan(text: 'b'), textDirection: TextDirection.ltr), - ]; - final RenderParagraph paragraph = RenderParagraphWithEmptyBoxListForWidgetSpan( - text, - children: renderBoxes, - textDirection: TextDirection.ltr, - ); - _applyParentData(renderBoxes, paragraph.text); - layout(paragraph); + test('assembleSemanticsNode handles empty WidgetSpans that do not yield selection boxes', () { + final TextSpan text = TextSpan( + text: '', + children: [ + TextSpan(text: 'A', recognizer: TapGestureRecognizer()..onTap = () {}), + const WidgetSpan(child: SizedBox.shrink()), + TextSpan(text: 'C', recognizer: TapGestureRecognizer()..onTap = () {}), + ], + ); + final List renderBoxes = [ + RenderParagraph(const TextSpan(text: 'b'), textDirection: TextDirection.ltr), + ]; + final RenderParagraph paragraph = RenderParagraphWithEmptyBoxListForWidgetSpan( + text, + children: renderBoxes, + textDirection: TextDirection.ltr, + ); + _applyParentData(renderBoxes, paragraph.text); + layout(paragraph); - final SemanticsNode node = SemanticsNode(); - paragraph.assembleSemanticsNode(node, SemanticsConfiguration(), []); - expect(node.childrenCount, 2); - }, - skip: isBrowser, // https://github.com/flutter/flutter/issues/61020 - ); + final SemanticsNode node = SemanticsNode(); + paragraph.assembleSemanticsNode(node, SemanticsConfiguration(), []); + expect(node.childrenCount, 2); + }); test('Basic TextSpan Hit testing', () { final TextSpan textSpanA = TextSpan(text: 'A' * 10); @@ -1064,7 +1060,7 @@ void main() { expect(paintingContext.canvas.drawnRect!.isEmpty, false); expect(paintingContext.canvas.drawnRectPaint!.style, PaintingStyle.fill); expect(paintingContext.canvas.drawnRectPaint!.color, isSameColorAs(selectionColor)); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61016 + }); test('getPositionForOffset works', () async { final RenderParagraph paragraph = RenderParagraph( diff --git a/packages/flutter/test/widgets/selectable_region_test.dart b/packages/flutter/test/widgets/selectable_region_test.dart index 27e85bd6b35..0becfed6432 100644 --- a/packages/flutter/test/widgets/selectable_region_test.dart +++ b/packages/flutter/test/widgets/selectable_region_test.dart @@ -87,7 +87,7 @@ void main() { expect(endEdge.globalPosition, const Offset(100.0, 100.0)); await gesture.up(); - }, skip: kIsWeb); // https://github.com/flutter/flutter/issues/102410. + }); testWidgets('mouse double click sends select-word event', (WidgetTester tester) async { final UniqueKey spy = UniqueKey(); @@ -368,7 +368,6 @@ void main() { expect(pageController.page, 1.0); }, variant: TargetPlatformVariant.only(TargetPlatform.iOS), - skip: kIsWeb, // https://github.com/flutter/flutter/issues/125582. ); testWidgets( @@ -485,7 +484,7 @@ void main() { (renderSelectionSpy.events[1] as SelectionEdgeUpdateEvent).type, SelectionEventType.endEdgeUpdate, ); - }, skip: kIsWeb); // https://github.com/flutter/flutter/issues/102410. + }); testWidgets('touch long press sends select-word event', (WidgetTester tester) async { final UniqueKey spy = UniqueKey(); @@ -1317,7 +1316,7 @@ void main() { await tester.pumpAndSettle(); }, variant: TargetPlatformVariant.only(TargetPlatform.iOS), - skip: true, // https://github.com/flutter/flutter/issues/125582. + skip: !kIsWeb, // [intended] This test verifies web behavior. ); testWidgets( @@ -1414,7 +1413,6 @@ void main() { await tester.pumpAndSettle(); }, variant: TargetPlatformVariant.all(), - skip: kIsWeb, // https://github.com/flutter/flutter/issues/125582. ); testWidgets('RenderParagraph should invalidate cached bounding boxes', ( @@ -1477,7 +1475,7 @@ void main() { // Should select "Good" again. expect(paragraph.selections.isEmpty, isFalse); expect(paragraph.selections[0], const TextSelection(baseOffset: 25, extentOffset: 29)); - }, skip: kIsWeb); // https://github.com/flutter/flutter/issues/125582. + }); testWidgets('mouse can select single text on desktop platforms', (WidgetTester tester) async { await tester.pumpWidget( @@ -1737,7 +1735,7 @@ void main() { await tester.pump(); expect(paragraph.selections[0], const TextSelection(baseOffset: 4, extentOffset: 11)); await gesture.up(); - }, skip: kIsWeb); // https://github.com/flutter/flutter/issues/125582. + }); testWidgets('mouse can select multiple widgets on double click drag', ( WidgetTester tester, @@ -1793,7 +1791,7 @@ void main() { expect(paragraph3.selections[0], const TextSelection(baseOffset: 0, extentOffset: 11)); await gesture.up(); - }, skip: kIsWeb); // https://github.com/flutter/flutter/issues/125582. + }); testWidgets( 'mouse can select multiple widgets on double click drag and return to origin word', @@ -1862,8 +1860,6 @@ void main() { await gesture.up(); }, - // https://github.com/flutter/flutter/issues/125582. - skip: kIsWeb, ); testWidgets('mouse can reverse selection across multiple widgets on double click drag', ( @@ -1919,7 +1915,7 @@ void main() { expect(paragraph1.selections[0], const TextSelection(baseOffset: 12, extentOffset: 4)); await gesture.up(); - }, skip: kIsWeb); // https://github.com/flutter/flutter/issues/125582. + }); testWidgets('mouse can select paragraph-by-paragraph on triple click drag', ( WidgetTester tester, @@ -2002,7 +1998,7 @@ void main() { await tester.pump(); expect(paragraph.selections[0], const TextSelection(baseOffset: 257, extentOffset: 0)); await gesture.up(); - }, skip: kIsWeb); // https://github.com/flutter/flutter/issues/125582. + }); testWidgets( 'mouse can select multiple widgets on triple click drag when selecting inside a WidgetSpan', @@ -2075,7 +2071,6 @@ void main() { await gesture.up(); }, - skip: kIsWeb, // https://github.com/flutter/flutter/issues/125582. ); testWidgets('mouse can select multiple widgets on triple click drag', ( @@ -2158,7 +2153,7 @@ void main() { expect(paragraph3.selections[0], const TextSelection(baseOffset: 0, extentOffset: 47)); await gesture.up(); - }, skip: kIsWeb); // https://github.com/flutter/flutter/issues/125582. + }); testWidgets( 'mouse can select multiple widgets on triple click drag and return to origin paragraph', @@ -2251,7 +2246,6 @@ void main() { await gesture.up(); }, - skip: kIsWeb, // https://github.com/flutter/flutter/issues/125582. ); testWidgets('mouse can reverse selection across multiple widgets on triple click drag', ( @@ -2315,7 +2309,7 @@ void main() { expect(paragraph1.selections[0], const TextSelection(baseOffset: 43, extentOffset: 0)); await gesture.up(); - }, skip: kIsWeb); // https://github.com/flutter/flutter/issues/125582. + }); testWidgets('mouse can select multiple widgets', (WidgetTester tester) async { await tester.pumpWidget( @@ -3684,7 +3678,6 @@ void main() { TargetPlatform.linux, TargetPlatform.fuchsia, }), - skip: isBrowser, // https://github.com/flutter/flutter/issues/61020 ); testWidgets( @@ -3743,7 +3736,6 @@ void main() { TargetPlatform.linux, TargetPlatform.fuchsia, }), - skip: isBrowser, // https://github.com/flutter/flutter/issues/61020 ); testWidgets( @@ -3799,7 +3791,6 @@ void main() { TargetPlatform.linux, TargetPlatform.fuchsia, }), - skip: isBrowser, // https://github.com/flutter/flutter/issues/61020 ); testWidgets( @@ -3848,7 +3839,6 @@ void main() { expect(innerParagraph.selections[0], const TextSelection(baseOffset: 6, extentOffset: 9)); }, variant: TargetPlatformVariant.only(TargetPlatform.macOS), - skip: isBrowser, // https://github.com/flutter/flutter/issues/61020 ); testWidgets( @@ -3898,7 +3888,6 @@ void main() { expect(tester.takeException(), isNull); }, variant: TargetPlatformVariant.only(TargetPlatform.macOS), - skip: isBrowser, // https://github.com/flutter/flutter/issues/61020 ); testWidgets( @@ -3949,7 +3938,6 @@ void main() { expect(paragraph.selections[0], const TextSelection(baseOffset: 124, extentOffset: 129)); }, variant: TargetPlatformVariant.only(TargetPlatform.macOS), - skip: isBrowser, // https://github.com/flutter/flutter/issues/61020 ); testWidgets( @@ -3999,7 +3987,6 @@ void main() { expect(paragraph.selections[0], const TextSelection(baseOffset: 124, extentOffset: 129)); }, variant: TargetPlatformVariant.only(TargetPlatform.macOS), - skip: isBrowser, // https://github.com/flutter/flutter/issues/61020 ); testWidgets( @@ -4053,7 +4040,6 @@ void main() { TargetPlatform.linux, TargetPlatform.fuchsia, }), - skip: isBrowser, // https://github.com/flutter/flutter/issues/61020 ); testWidgets( @@ -4105,7 +4091,6 @@ void main() { TargetPlatform.iOS, TargetPlatform.macOS, }), - skip: isBrowser, // https://github.com/flutter/flutter/issues/61020 ); testWidgets('mouse can select across bidi text', (WidgetTester tester) async { @@ -4155,7 +4140,7 @@ void main() { expect(paragraph3.selections[0], const TextSelection(baseOffset: 0, extentOffset: 6)); await gesture.up(); - }, skip: isBrowser); // https://github.com/flutter/flutter/issues/61020 + }); testWidgets('long press and drag touch moves selection word by word', ( WidgetTester tester, @@ -5516,7 +5501,7 @@ void main() { expect(paragraph1.selections, isEmpty); expect(paragraph2.selections, isEmpty); expect(paragraph3.selections, isEmpty); - }, skip: kIsWeb); // https://github.com/flutter/flutter/issues/125582. + }); testWidgets( 'Text processing actions are added to the toolbar',