Skip to content

Commit a612fda

Browse files
authored
[web] Unskip some paragraph tests that are passing now (#162537)
Closes flutter/flutter#83129 Closes flutter/flutter#61020 Closes flutter/flutter#61021
1 parent 041d524 commit a612fda

File tree

3 files changed

+82
-111
lines changed

3 files changed

+82
-111
lines changed

packages/flutter/test/rendering/editable_test.dart

Lines changed: 41 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,7 @@ void main() {
428428
pumpFrame(phase: EnginePhase.compositingBits);
429429

430430
expect(editable, paintsExactlyCountTimes(#drawRRect, 0));
431-
432-
// TODO(yjbanov): ahem.ttf doesn't have Chinese glyphs, making this test
433-
// sensitive to browser/OS when running in web mode:
434-
}, skip: kIsWeb); // https://github.com/flutter/flutter/issues/83129
431+
});
435432

436433
test('text is painted above selection', () {
437434
final TextSelectionDelegate delegate = _FakeEditableTextState();
@@ -810,51 +807,44 @@ void main() {
810807
expect(editable.hasFocus, false);
811808
});
812809

813-
test(
814-
'has correct maxScrollExtent',
815-
() {
816-
final TextSelectionDelegate delegate = _FakeEditableTextState();
817-
EditableText.debugDeterministicCursor = true;
810+
test('has correct maxScrollExtent', () {
811+
final TextSelectionDelegate delegate = _FakeEditableTextState();
812+
EditableText.debugDeterministicCursor = true;
818813

819-
final RenderEditable editable = RenderEditable(
820-
maxLines: 2,
821-
backgroundCursorColor: Colors.grey,
822-
textDirection: TextDirection.ltr,
823-
cursorColor: const Color.fromARGB(0xFF, 0xFF, 0x00, 0x00),
824-
offset: ViewportOffset.zero(),
825-
textSelectionDelegate: delegate,
826-
text: const TextSpan(
827-
text:
828-
'撒地方加咖啡哈金凤凰卡号方式剪坏算法发挥福建垃\nasfjafjajfjaslfjaskjflasjfksajf撒分开建安路口附近拉设\n计费可使肌肤撒附近埃里克圾房卡设计费"',
829-
style: TextStyle(height: 1.0, fontSize: 10.0, fontFamily: 'Roboto'),
830-
),
831-
startHandleLayerLink: LayerLink(),
832-
endHandleLayerLink: LayerLink(),
833-
selection: const TextSelection.collapsed(offset: 4, affinity: TextAffinity.upstream),
834-
);
814+
final RenderEditable editable = RenderEditable(
815+
maxLines: 2,
816+
backgroundCursorColor: Colors.grey,
817+
textDirection: TextDirection.ltr,
818+
cursorColor: const Color.fromARGB(0xFF, 0xFF, 0x00, 0x00),
819+
offset: ViewportOffset.zero(),
820+
textSelectionDelegate: delegate,
821+
text: const TextSpan(
822+
text:
823+
'撒地方加咖啡哈金凤凰卡号方式剪坏算法发挥福建垃\nasfjafjajfjaslfjaskjflasjfksajf撒分开建安路口附近拉设\n计费可使肌肤撒附近埃里克圾房卡设计费"',
824+
style: TextStyle(height: 1.0, fontSize: 10.0, fontFamily: 'Roboto'),
825+
),
826+
startHandleLayerLink: LayerLink(),
827+
endHandleLayerLink: LayerLink(),
828+
selection: const TextSelection.collapsed(offset: 4, affinity: TextAffinity.upstream),
829+
);
835830

836-
editable.layout(BoxConstraints.loose(const Size(100.0, 1000.0)));
837-
expect(editable.size, equals(const Size(100, 20)));
838-
expect(editable.maxLines, equals(2));
839-
expect(editable.maxScrollExtent, equals(90));
831+
editable.layout(BoxConstraints.loose(const Size(100.0, 1000.0)));
832+
expect(editable.size, equals(const Size(100, 20)));
833+
expect(editable.maxLines, equals(2));
834+
expect(editable.maxScrollExtent, equals(90));
840835

841-
editable.layout(BoxConstraints.loose(const Size(150.0, 1000.0)));
842-
expect(editable.maxScrollExtent, equals(50));
836+
editable.layout(BoxConstraints.loose(const Size(150.0, 1000.0)));
837+
expect(editable.maxScrollExtent, equals(50));
843838

844-
editable.layout(BoxConstraints.loose(const Size(200.0, 1000.0)));
845-
expect(editable.maxScrollExtent, equals(40));
839+
editable.layout(BoxConstraints.loose(const Size(200.0, 1000.0)));
840+
expect(editable.maxScrollExtent, equals(40));
846841

847-
editable.layout(BoxConstraints.loose(const Size(500.0, 1000.0)));
848-
expect(editable.maxScrollExtent, equals(10));
842+
editable.layout(BoxConstraints.loose(const Size(500.0, 1000.0)));
843+
expect(editable.maxScrollExtent, equals(10));
849844

850-
editable.layout(BoxConstraints.loose(const Size(1000.0, 1000.0)));
851-
expect(editable.maxScrollExtent, equals(10));
852-
// TODO(yjbanov): This test is failing in the Dart HHH-web bot and
853-
// needs additional investigation before it can be reenabled.
854-
},
855-
// https://github.com/flutter/flutter/issues/93691
856-
skip: const bool.fromEnvironment('DART_HHH_BOT'),
857-
);
845+
editable.layout(BoxConstraints.loose(const Size(1000.0, 1000.0)));
846+
expect(editable.maxScrollExtent, equals(10));
847+
});
858848

859849
test('getEndpointsForSelection handles empty characters', () {
860850
final TextSelectionDelegate delegate = _FakeEditableTextState();
@@ -1505,7 +1495,7 @@ void main() {
15051495
final Rect composingRect =
15061496
editable.getRectForComposingRange(const TextRange(start: 4, end: 5))!;
15071497
expect(composingRect, const Rect.fromLTRB(40.0, 0.0, 54.0, 14.0));
1508-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61021
1498+
});
15091499

15101500
test('able to render multiple WidgetSpans', () async {
15111501
final TextSelectionDelegate delegate =
@@ -1550,7 +1540,7 @@ void main() {
15501540
final Rect composingRect =
15511541
editable.getRectForComposingRange(const TextRange(start: 4, end: 7))!;
15521542
expect(composingRect, const Rect.fromLTRB(40.0, 0.0, 82.0, 14.0));
1553-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61021
1543+
});
15541544

15551545
test('able to render WidgetSpans with line wrap', () async {
15561546
final TextSelectionDelegate delegate =
@@ -1599,7 +1589,7 @@ void main() {
15991589
expect(composingRect, const Rect.fromLTRB(40.0, 0.0, 68.0, 14.0));
16001590
composingRect = editable.getRectForComposingRange(const TextRange(start: 6, end: 7))!;
16011591
expect(composingRect, const Rect.fromLTRB(0.0, 14.0, 14.0, 28.0));
1602-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61021
1592+
});
16031593

16041594
test('able to render WidgetSpans with line wrap alternating spans', () async {
16051595
final TextSelectionDelegate delegate =
@@ -1657,7 +1647,7 @@ void main() {
16571647
expect(composingRect, const Rect.fromLTRB(24.0, 18.0, 34.0, 28.0));
16581648
composingRect = editable.getRectForComposingRange(const TextRange(start: 9, end: 10))!;
16591649
expect(composingRect, const Rect.fromLTRB(34.0, 14.0, 48.0, 28.0));
1660-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61021
1650+
});
16611651

16621652
test('able to render WidgetSpans nested spans', () async {
16631653
final TextSelectionDelegate delegate =
@@ -1711,7 +1701,7 @@ void main() {
17111701
expect(composingRect, const Rect.fromLTRB(0.0, 14.0, 14.0, 28.0));
17121702
composingRect = editable.getRectForComposingRange(const TextRange(start: 7, end: 8));
17131703
expect(composingRect, null);
1714-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61021
1704+
});
17151705

17161706
test('WidgetSpan render box is painted at correct offset when scrolled', () async {
17171707
final TextSelectionDelegate delegate =
@@ -1752,7 +1742,7 @@ void main() {
17521742
final Rect composingRect =
17531743
editable.getRectForComposingRange(const TextRange(start: 4, end: 5))!;
17541744
expect(composingRect, const Rect.fromLTRB(40.0, -100.0, 54.0, -86.0));
1755-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61021
1745+
});
17561746

17571747
test('can compute IntrinsicWidth for WidgetSpans', () {
17581748
// Regression test for https://github.com/flutter/flutter/issues/59316
@@ -1893,7 +1883,7 @@ void main() {
18931883
result = BoxHitTestResult();
18941884
editable.hitTest(result, position: const Offset(5.0, 15.0));
18951885
expect(result.path, hasLength(0));
1896-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61020
1886+
});
18971887

18981888
test('hits correct WidgetSpan when scrolled', () {
18991889
final String text = '${"\n" * 10}test';
@@ -1975,7 +1965,7 @@ void main() {
19751965
result = BoxHitTestResult();
19761966
editable.hitTest(result, position: const Offset(5.0, 15.0));
19771967
expect(result.path, hasLength(1)); // Only the RenderEditable.
1978-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61020
1968+
});
19791969
});
19801970

19811971
test('does not skip TextPainter.layout because of invalid cache', () {

packages/flutter/test/rendering/paragraph_test.dart

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ void main() {
247247
expect(boxes[3], const TextBox.fromLTRBD(130.0, 10.0, 156.0, 20.0, TextDirection.ltr));
248248
// 'fifth':
249249
expect(boxes[4], const TextBox.fromLTRBD(0.0, 20.0, 50.0, 30.0, TextDirection.ltr));
250-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61016
250+
});
251251

252252
test('getWordBoundary control test', () {
253253
final RenderParagraph paragraph = RenderParagraph(
@@ -343,7 +343,7 @@ void main() {
343343

344344
relayoutWith(maxLines: 100, softWrap: true, overflow: TextOverflow.fade);
345345
expect(paragraph.debugHasOverflowShader, isFalse);
346-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61018
346+
});
347347

348348
test('maxLines', () {
349349
final RenderParagraph paragraph = RenderParagraph(
@@ -583,7 +583,7 @@ void main() {
583583
expect(boxes[2], const TextBox.fromLTRBD(24.0, 0.0, 38.0, 14.0, TextDirection.ltr));
584584
expect(boxes[3], const TextBox.fromLTRBD(38.0, 4.0, 48.0, 14.0, TextDirection.ltr));
585585
expect(boxes[4], const TextBox.fromLTRBD(48.0, 0.0, 62.0, 14.0, TextDirection.ltr));
586-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61020
586+
});
587587

588588
test('getBoxesForSelection with boxHeightStyle for inline widgets', () {
589589
const TextSpan text = TextSpan(
@@ -625,7 +625,7 @@ void main() {
625625
expect(boxes[2], const TextBox.fromLTRBD(24.0, 0.0, 38.0, 14.0, TextDirection.ltr));
626626
expect(boxes[3], const TextBox.fromLTRBD(38.0, 0.0, 48.0, 14.0, TextDirection.ltr));
627627
expect(boxes[4], const TextBox.fromLTRBD(48.0, 0.0, 62.0, 14.0, TextDirection.ltr));
628-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61020
628+
});
629629

630630
test('inline widgets multiline test', () {
631631
const TextSpan text = TextSpan(
@@ -678,7 +678,7 @@ void main() {
678678
// Wraps
679679
expect(boxes[7], const TextBox.fromLTRBD(0.0, 28.0, 14.0, 42.0, TextDirection.ltr));
680680
expect(boxes[8], const TextBox.fromLTRBD(14.0, 28.0, 28.0, 42.0, TextDirection.ltr));
681-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61020
681+
});
682682

683683
test('Does not include the semantics node of truncated rendering children', () {
684684
// Regression test for https://github.com/flutter/flutter/issues/88180
@@ -794,34 +794,30 @@ void main() {
794794
expect(node.childrenCount, 2);
795795
});
796796

797-
test(
798-
'assembleSemanticsNode handles empty WidgetSpans that do not yield selection boxes',
799-
() {
800-
final TextSpan text = TextSpan(
801-
text: '',
802-
children: <InlineSpan>[
803-
TextSpan(text: 'A', recognizer: TapGestureRecognizer()..onTap = () {}),
804-
const WidgetSpan(child: SizedBox.shrink()),
805-
TextSpan(text: 'C', recognizer: TapGestureRecognizer()..onTap = () {}),
806-
],
807-
);
808-
final List<RenderBox> renderBoxes = <RenderBox>[
809-
RenderParagraph(const TextSpan(text: 'b'), textDirection: TextDirection.ltr),
810-
];
811-
final RenderParagraph paragraph = RenderParagraphWithEmptyBoxListForWidgetSpan(
812-
text,
813-
children: renderBoxes,
814-
textDirection: TextDirection.ltr,
815-
);
816-
_applyParentData(renderBoxes, paragraph.text);
817-
layout(paragraph);
797+
test('assembleSemanticsNode handles empty WidgetSpans that do not yield selection boxes', () {
798+
final TextSpan text = TextSpan(
799+
text: '',
800+
children: <InlineSpan>[
801+
TextSpan(text: 'A', recognizer: TapGestureRecognizer()..onTap = () {}),
802+
const WidgetSpan(child: SizedBox.shrink()),
803+
TextSpan(text: 'C', recognizer: TapGestureRecognizer()..onTap = () {}),
804+
],
805+
);
806+
final List<RenderBox> renderBoxes = <RenderBox>[
807+
RenderParagraph(const TextSpan(text: 'b'), textDirection: TextDirection.ltr),
808+
];
809+
final RenderParagraph paragraph = RenderParagraphWithEmptyBoxListForWidgetSpan(
810+
text,
811+
children: renderBoxes,
812+
textDirection: TextDirection.ltr,
813+
);
814+
_applyParentData(renderBoxes, paragraph.text);
815+
layout(paragraph);
818816

819-
final SemanticsNode node = SemanticsNode();
820-
paragraph.assembleSemanticsNode(node, SemanticsConfiguration(), <SemanticsNode>[]);
821-
expect(node.childrenCount, 2);
822-
},
823-
skip: isBrowser, // https://github.com/flutter/flutter/issues/61020
824-
);
817+
final SemanticsNode node = SemanticsNode();
818+
paragraph.assembleSemanticsNode(node, SemanticsConfiguration(), <SemanticsNode>[]);
819+
expect(node.childrenCount, 2);
820+
});
825821

826822
test('Basic TextSpan Hit testing', () {
827823
final TextSpan textSpanA = TextSpan(text: 'A' * 10);
@@ -1064,7 +1060,7 @@ void main() {
10641060
expect(paintingContext.canvas.drawnRect!.isEmpty, false);
10651061
expect(paintingContext.canvas.drawnRectPaint!.style, PaintingStyle.fill);
10661062
expect(paintingContext.canvas.drawnRectPaint!.color, isSameColorAs(selectionColor));
1067-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/61016
1063+
});
10681064

10691065
test('getPositionForOffset works', () async {
10701066
final RenderParagraph paragraph = RenderParagraph(

0 commit comments

Comments
 (0)