Skip to content

Commit ca14af6

Browse files
author
Jonah Williams
authored
Compatibility pass on flutter/rendering tests for JavaScript compilation. (5) (flutter#33355)
1 parent 1b3fc53 commit ca14af6

File tree

10 files changed

+26
-22
lines changed

10 files changed

+26
-22
lines changed

dev/bots/test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ Future<void> _runTests() async {
343343
Future<void> _runWebTests() async {
344344
await _runFlutterWebTest(path.join(flutterRoot, 'packages', 'flutter'), expectFailure: false, tests: <String>[
345345
'test/foundation/',
346+
'test/rendering/',
346347
'test/services/',
347348
'test/painting/',
348349
'test/scheduler/',

packages/flutter/test/rendering/debug_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ void main() {
1414
test('Describe transform control test', () {
1515
final Matrix4 identity = Matrix4.identity();
1616
final List<String> description = debugDescribeTransform(identity);
17-
expect(description, equals(<String>[
17+
expect(description, <String>[
1818
'[0] 1.0,0.0,0.0,0.0',
1919
'[1] 0.0,1.0,0.0,0.0',
2020
'[2] 0.0,0.0,1.0,0.0',
2121
'[3] 0.0,0.0,0.0,1.0',
22-
]));
22+
]);
2323
});
2424

2525
test('transform property test', () {

packages/flutter/test/rendering/editable_test.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void main() {
7272
' ╚═══════════\n'
7373
),
7474
);
75-
});
75+
}, skip: isBrowser);
7676

7777
// Test that clipping will be used even when the text fits within the visible
7878
// region if the start position of the text is offset (e.g. during scrolling
@@ -168,7 +168,7 @@ void main() {
168168
pumpFrame();
169169

170170
expect(editable, paintsExactlyCountTimes(#drawRRect, 0));
171-
});
171+
}, skip: isBrowser);
172172

173173
test('Cursor with ideographic script', () {
174174
final TextSelectionDelegate delegate = FakeEditableTextState();
@@ -241,7 +241,7 @@ void main() {
241241
pumpFrame();
242242

243243
expect(editable, paintsExactlyCountTimes(#drawRRect, 0));
244-
});
244+
}, skip: isBrowser);
245245

246246
test('text is painted above selection', () {
247247
final TextSelectionDelegate delegate = FakeEditableTextState();
@@ -327,7 +327,7 @@ void main() {
327327
..paragraph(),
328328
);
329329
expect(editable, paintsExactlyCountTimes(#drawRect, 1));
330-
});
330+
}, skip: isBrowser);
331331

332332
test('selects correct place with offsets', () {
333333
final TextSelectionDelegate delegate = FakeEditableTextState();
@@ -407,7 +407,7 @@ void main() {
407407
expect(currentSelection.isCollapsed, false);
408408
expect(currentSelection.baseOffset, 5);
409409
expect(currentSelection.extentOffset, 9);
410-
});
410+
}, skip: isBrowser);
411411

412412
test('selects correct place when offsets are flipped', () {
413413
final TextSelectionDelegate delegate = FakeEditableTextState();
@@ -439,7 +439,7 @@ void main() {
439439
expect(currentSelection.isCollapsed, isFalse);
440440
expect(currentSelection.baseOffset, 1);
441441
expect(currentSelection.extentOffset, 3);
442-
});
442+
}, skip: isBrowser);
443443

444444
test('selection does not flicker as user is dragging', () {
445445
int selectionChangedCount = 0;
@@ -494,7 +494,7 @@ void main() {
494494
expect(updatedSelection.baseOffset, 3);
495495
expect(updatedSelection.extentOffset, 5);
496496
expect(selectionChangedCount, 1);
497-
});
497+
}, skip: isBrowser);
498498

499499
test('editable hasFocus correctly initialized', () {
500500
// Regression test for https://github.com/flutter/flutter/issues/21640

packages/flutter/test/rendering/layers_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,5 +455,5 @@ void main() {
455455

456456
_testConflicts(layerA, layerB, expectedErrorCount: 1);
457457
});
458-
});
458+
}, skip: isBrowser);
459459
}

packages/flutter/test/rendering/paragraph_test.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void main() {
4848

4949
final TextPosition positionBelow = paragraph.getPositionForOffset(const Offset(5.0, 20.0));
5050
expect(positionBelow.offset, greaterThan(position40.offset));
51-
});
51+
}, skip: isBrowser);
5252

5353
test('getBoxesForSelection control test', () {
5454
final RenderParagraph paragraph = RenderParagraph(
@@ -71,7 +71,7 @@ void main() {
7171
expect(boxes.any((ui.TextBox box) => box.right == 100 && box.top == 10), isTrue);
7272
},
7373
// Ahem-based tests don't yet quite work on Windows or some MacOS environments
74-
skip: isLinux);
74+
skip: isLinux || isBrowser);
7575

7676
test('getWordBoundary control test', () {
7777
final RenderParagraph paragraph = RenderParagraph(
@@ -88,7 +88,7 @@ void main() {
8888

8989
final TextRange range85 = paragraph.getWordBoundary(const TextPosition(offset: 75));
9090
expect(range85.textInside(_kText), equals('Queen\'s'));
91-
});
91+
}, skip: isBrowser);
9292

9393
test('overflow test', () {
9494
final RenderParagraph paragraph = RenderParagraph(
@@ -164,7 +164,7 @@ void main() {
164164

165165
relayoutWith(maxLines: 100, softWrap: true, overflow: TextOverflow.fade);
166166
expect(paragraph.debugHasOverflowShader, isFalse);
167-
});
167+
}, skip: isBrowser);
168168

169169
test('maxLines', () {
170170
final RenderParagraph paragraph = RenderParagraph(
@@ -193,7 +193,7 @@ void main() {
193193

194194
layoutAt(3);
195195
expect(paragraph.size.height, 30.0);
196-
}, skip: isWindows); // Ahem-based tests don't yet quite work on Windows
196+
}, skip: isWindows || isBrowser); // Ahem-based tests don't yet quite work on Windows
197197

198198
test('changing color does not do layout', () {
199199
final RenderParagraph paragraph = RenderParagraph(
@@ -280,7 +280,7 @@ void main() {
280280
expect(boxes[2].toRect().height, closeTo(26.0, 0.0001));
281281
expect(boxes[3].toRect().width, anyOf(14.0, 13.0));
282282
expect(boxes[3].toRect().height, closeTo(13.0, 0.0001));
283-
});
283+
}, skip: isBrowser);
284284

285285
test('toStringDeep', () {
286286
final RenderParagraph paragraph = RenderParagraph(
@@ -361,7 +361,7 @@ void main() {
361361
expect(boxes[3], const TextBox.fromLTRBD(38.0, 4.0, 48.0, 14.0, TextDirection.ltr));
362362
expect(boxes[4], const TextBox.fromLTRBD(48.0, 0.0, 62.0, 14.0, TextDirection.ltr));
363363
// Ahem-based tests don't yet quite work on Windows or some MacOS environments
364-
}, skip: isWindows || isMacOS);
364+
}, skip: isWindows || isMacOS || isBrowser);
365365

366366
test('inline widgets multiline test', () {
367367
const TextSpan text = TextSpan(
@@ -413,5 +413,5 @@ void main() {
413413
expect(boxes[7], const TextBox.fromLTRBD(0.0, 28.0, 14.0, 42.0, TextDirection.ltr));
414414
expect(boxes[8], const TextBox.fromLTRBD(14.0, 28.0, 28.0, 42.0 , TextDirection.ltr));
415415
// Ahem-based tests don't yet quite work on Windows or some MacOS environments
416-
}, skip: isWindows || isMacOS);
416+
}, skip: isWindows || isMacOS || isBrowser);
417417
}

packages/flutter/test/rendering/positioned_box_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ void main() {
6969

7070
expect(positioner.size.width, equals(200.0));
7171
expect(positioner.size.height, equals(200.0));
72-
});
72+
}, skip: isBrowser);
7373
}

packages/flutter/test/rendering/proxy_box_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ void main() {
229229
expect(getPixel(20, 20), equals(0x00000080));
230230
expect(getPixel(image.width - 1, 0), equals(0x00000000));
231231
expect(getPixel(image.width - 1, 20), equals(0xffffffff));
232-
});
232+
}, skip: isBrowser);
233233

234234
test('RenderOpacity does not composite if it is transparent', () {
235235
final RenderOpacity renderOpacity = RenderOpacity(

packages/flutter/test/rendering/sliver_cache_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ void main() {
478478
);
479479
expect(children.sublist(0, 21).any((RenderBox r) => r.attached), false);
480480
expect(children.sublist(21, 30).every((RenderBox r) => r.attached), true);
481-
});
481+
}, skip: isBrowser);
482482

483483
test('RenderSliverGrid calculates correct geometry', () {
484484
// Viewport is 800x600, each grid element is 400x100, giving us space for 12 visible children

packages/flutter/test/rendering/viewport_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ void main() {
190190
revealed = viewport.getOffsetToReveal(target, 1.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
191191
expect(revealed.offset, 360.0);
192192
expect(revealed.rect, const Rect.fromLTWH(0.0, 40.0, 10.0, 10.0));
193-
});
193+
}, skip: isBrowser);
194194

195195
testWidgets('Viewport getOffsetToReveal Sliver - down', (WidgetTester tester) async {
196196
final List<Widget> children = <Widget>[];

packages/flutter_tools/lib/src/build_runner/web_compilation_delegate.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,9 @@ Future<void> main() async {
479479
// we don't have an embedder yet this is the lowest-most layer we can put
480480
// this stuff in.
481481
await ui.webOnlyInitializeEngine();
482+
// TODO(flutterweb): remove need for dynamic cast.
483+
(ui.window as dynamic).debugOverrideDevicePixelRatio(3.0);
484+
(ui.window as dynamic).webOnlyDebugPhysicalSizeOverride = const ui.Size(2400, 1800);
482485
internalBootstrapBrowserTest(() => test.main);
483486
}
484487

0 commit comments

Comments
 (0)