Skip to content

Commit b57256e

Browse files
[web] Unskip 12 passing framework tests in text_test and opacity_test (#193298)
Unskips 12 tests across 2 framework test files (`packages/flutter/test/widgets/text_test.dart` and `packages/flutter/test/widgets/opacity_test.dart`) that were previously skipped on web (`skip: isBrowser`) and now pass on Chrome: - `packages/flutter/test/widgets/text_test.dart` (11 skips removed): - Unskips 3 semantics tests (Bidi/`TextSpan` recognizer link semantics and inline widget semantics) skipped for #62945. - Unskips the `Overflow is clipping correctly` test skipped for #87878. - Unskips 3 `textWidthBasis` tests (`longestLine`, `textAlign` with parent alignment, and `longestLine` with loose constraints) skipped for #44020. - Unskips 4 `WidgetSpans with no semantic information are elided from semantics` tests skipped for #87877. - `packages/flutter/test/widgets/opacity_test.dart` (1 skip removed): - Unskips `empty opacity does not crash`, skipped for #49857 (HTML renderer `OffsetLayer.toImage`, closed). The only non-trivial diff is `dart format` reflowing the `textWidthBasis.longestLine confines the width of the paragraph` test after its trailing `skip:` argument was removed; the test body is unchanged. Related issues: - #44020 - #49857 - #62945 - #87877 - #87878 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [flutter/website]: https://github.com/flutter/website [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent d39275d commit b57256e

2 files changed

Lines changed: 44 additions & 50 deletions

File tree

‎packages/flutter/test/widgets/opacity_test.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ void main() {
184184
final offsetLayer = element.renderObject!.debugLayer! as OffsetLayer;
185185
final ui.Image image = await offsetLayer.toImage(const Rect.fromLTRB(0.0, 0.0, 1.0, 1.0));
186186
image.dispose();
187-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/49857
187+
});
188188

189189
testWidgets('Child shows up in the right spot when opacity is disabled', (
190190
WidgetTester tester,

‎packages/flutter/test/widgets/text_test.dart‎

Lines changed: 43 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ void main() {
970970
);
971971
expect(semantics, hasSemantics(expectedSemantics, ignoreTransform: true, ignoreId: true));
972972
semantics.dispose();
973-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/62945
973+
});
974974

975975
testWidgets('TapGesture recognizers contribute link semantics', (WidgetTester tester) async {
976976
final semantics = SemanticsTester(tester);
@@ -1061,7 +1061,7 @@ void main() {
10611061
hasSemantics(expectedSemantics, ignoreTransform: true, ignoreId: true, ignoreRect: true),
10621062
);
10631063
semantics.dispose();
1064-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/62945
1064+
});
10651065

10661066
testWidgets('inline widgets semantic nodes scale', (WidgetTester tester) async {
10671067
final semantics = SemanticsTester(tester);
@@ -1132,7 +1132,7 @@ void main() {
11321132
);
11331133
expect(semantics, hasSemantics(expectedSemantics, ignoreTransform: true, ignoreId: true));
11341134
semantics.dispose();
1135-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/62945
1135+
});
11361136

11371137
testWidgets('receives fontFamilyFallback and package from DefaultTextStyle', (
11381138
WidgetTester tester,
@@ -1182,7 +1182,7 @@ void main() {
11821182
);
11831183

11841184
expect(find.byType(Text), paints..clipRect(rect: const Rect.fromLTWH(0, 0, 50, 50)));
1185-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/87878
1185+
});
11861186

11871187
testWidgets('Overflow is clipping correctly - short text with overflow: ellipsis', (
11881188
WidgetTester tester,
@@ -1264,7 +1264,7 @@ void main() {
12641264
final Size textSizeLongestLine = tester.getSize(find.byType(Text));
12651265
expect(textSizeLongestLine.width, equals(630.0));
12661266
expect(textSizeLongestLine.height, equals(fontHeight * 2));
1267-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/44020
1267+
});
12681268

12691269
testWidgets('textWidthBasis with textAlign still obeys parent alignment', (
12701270
WidgetTester tester,
@@ -1314,52 +1314,46 @@ void main() {
13141314
expect(tester.getSize(find.text('RIGHT ALIGNED, PARENT')).width, lessThan(width));
13151315
expect(tester.getSize(find.text('LEFT ALIGNED, LONGEST LINE')).width, lessThan(width));
13161316
expect(tester.getSize(find.text('RIGHT ALIGNED, LONGEST LINE')).width, equals(width));
1317-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/44020
1317+
});
13181318

1319-
testWidgets(
1320-
'textWidthBasis.longestLine confines the width of the paragraph '
1321-
'when given loose constraints',
1322-
(WidgetTester tester) async {
1323-
// Regression test for https://github.com/flutter/flutter/issues/62550.
1324-
await tester.pumpWidget(
1325-
Center(
1326-
child: SizedBox(
1327-
width: 400,
1328-
child: Center(
1329-
child: RichText(
1330-
// 400 is not wide enough for this string. The part after the
1331-
// whitespace is going to be broken into a 2nd line.
1332-
text: const TextSpan(
1333-
text: 'fwefwefwewfefewfwe fwfwfwefweabcdefghijklmnopqrstuvwxyz',
1334-
),
1335-
textWidthBasis: TextWidthBasis.longestLine,
1336-
textDirection: TextDirection.rtl,
1337-
),
1319+
testWidgets('textWidthBasis.longestLine confines the width of the paragraph '
1320+
'when given loose constraints', (WidgetTester tester) async {
1321+
// Regression test for https://github.com/flutter/flutter/issues/62550.
1322+
await tester.pumpWidget(
1323+
Center(
1324+
child: SizedBox(
1325+
width: 400,
1326+
child: Center(
1327+
child: RichText(
1328+
// 400 is not wide enough for this string. The part after the
1329+
// whitespace is going to be broken into a 2nd line.
1330+
text: const TextSpan(text: 'fwefwefwewfefewfwe fwfwfwefweabcdefghijklmnopqrstuvwxyz'),
1331+
textWidthBasis: TextWidthBasis.longestLine,
1332+
textDirection: TextDirection.rtl,
13381333
),
13391334
),
13401335
),
1341-
);
1336+
),
1337+
);
13421338

1343-
expect(
1344-
find.byType(RichText),
1345-
paints..something((Symbol method, List<dynamic> arguments) {
1346-
if (method != #drawParagraph) {
1347-
return false;
1348-
}
1349-
final paragraph = arguments[0] as ui.Paragraph;
1350-
final offset = arguments[1] as Offset;
1351-
final List<ui.LineMetrics> lines = paragraph.computeLineMetrics();
1352-
for (final line in lines) {
1353-
if (line.left + offset.dx + line.width >= 400) {
1354-
throw 'line $line is greater than the max width constraints';
1355-
}
1339+
expect(
1340+
find.byType(RichText),
1341+
paints..something((Symbol method, List<dynamic> arguments) {
1342+
if (method != #drawParagraph) {
1343+
return false;
1344+
}
1345+
final paragraph = arguments[0] as ui.Paragraph;
1346+
final offset = arguments[1] as Offset;
1347+
final List<ui.LineMetrics> lines = paragraph.computeLineMetrics();
1348+
for (final line in lines) {
1349+
if (line.left + offset.dx + line.width >= 400) {
1350+
throw 'line $line is greater than the max width constraints';
13561351
}
1357-
return true;
1358-
}),
1359-
);
1360-
},
1361-
skip: isBrowser, // https://github.com/flutter/flutter/issues/44020
1362-
);
1352+
}
1353+
return true;
1354+
}),
1355+
);
1356+
});
13631357

13641358
testWidgets('Paragraph.getBoxesForRange returns nothing when selection range is zero length', (
13651359
WidgetTester tester,
@@ -1437,7 +1431,7 @@ void main() {
14371431
),
14381432
);
14391433
semantics.dispose();
1440-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/87877
1434+
});
14411435

14421436
// Regression test for https://github.com/flutter/flutter/issues/69787
14431437
testWidgets('WidgetSpans with no semantic information are elided from semantics - case 2', (
@@ -1491,7 +1485,7 @@ void main() {
14911485
),
14921486
);
14931487
semantics.dispose();
1494-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/87877
1488+
});
14951489

14961490
// Regression test for https://github.com/flutter/flutter/issues/69787
14971491
testWidgets('WidgetSpans with no semantic information are elided from semantics - case 3', (
@@ -1551,7 +1545,7 @@ void main() {
15511545
),
15521546
);
15531547
semantics.dispose();
1554-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/87877
1548+
});
15551549

15561550
// Regression test for https://github.com/flutter/flutter/issues/69787
15571551
testWidgets('WidgetSpans with no semantic information are elided from semantics - case 4', (
@@ -1622,7 +1616,7 @@ void main() {
16221616
),
16231617
);
16241618
semantics.dispose();
1625-
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/87877
1619+
});
16261620

16271621
testWidgets('RenderParagraph intrinsic width', (WidgetTester tester) async {
16281622
await tester.pumpWidget(

0 commit comments

Comments
 (0)