Unverified Commit ca14af6b authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Compatibility pass on flutter/rendering tests for JavaScript compilation. (5) (#33355)

parent 1b3fc535
...@@ -343,6 +343,7 @@ Future<void> _runTests() async { ...@@ -343,6 +343,7 @@ Future<void> _runTests() async {
Future<void> _runWebTests() async { Future<void> _runWebTests() async {
await _runFlutterWebTest(path.join(flutterRoot, 'packages', 'flutter'), expectFailure: false, tests: <String>[ await _runFlutterWebTest(path.join(flutterRoot, 'packages', 'flutter'), expectFailure: false, tests: <String>[
'test/foundation/', 'test/foundation/',
'test/rendering/',
'test/services/', 'test/services/',
'test/painting/', 'test/painting/',
'test/scheduler/', 'test/scheduler/',
......
...@@ -14,12 +14,12 @@ void main() { ...@@ -14,12 +14,12 @@ void main() {
test('Describe transform control test', () { test('Describe transform control test', () {
final Matrix4 identity = Matrix4.identity(); final Matrix4 identity = Matrix4.identity();
final List<String> description = debugDescribeTransform(identity); final List<String> description = debugDescribeTransform(identity);
expect(description, equals(<String>[ expect(description, <String>[
'[0] 1.0,0.0,0.0,0.0', '[0] 1.0,0.0,0.0,0.0',
'[1] 0.0,1.0,0.0,0.0', '[1] 0.0,1.0,0.0,0.0',
'[2] 0.0,0.0,1.0,0.0', '[2] 0.0,0.0,1.0,0.0',
'[3] 0.0,0.0,0.0,1.0', '[3] 0.0,0.0,0.0,1.0',
])); ]);
}); });
test('transform property test', () { test('transform property test', () {
......
...@@ -72,7 +72,7 @@ void main() { ...@@ -72,7 +72,7 @@ void main() {
' ╚═══════════\n' ' ╚═══════════\n'
), ),
); );
}); }, skip: isBrowser);
// Test that clipping will be used even when the text fits within the visible // Test that clipping will be used even when the text fits within the visible
// region if the start position of the text is offset (e.g. during scrolling // region if the start position of the text is offset (e.g. during scrolling
...@@ -168,7 +168,7 @@ void main() { ...@@ -168,7 +168,7 @@ void main() {
pumpFrame(); pumpFrame();
expect(editable, paintsExactlyCountTimes(#drawRRect, 0)); expect(editable, paintsExactlyCountTimes(#drawRRect, 0));
}); }, skip: isBrowser);
test('Cursor with ideographic script', () { test('Cursor with ideographic script', () {
final TextSelectionDelegate delegate = FakeEditableTextState(); final TextSelectionDelegate delegate = FakeEditableTextState();
...@@ -241,7 +241,7 @@ void main() { ...@@ -241,7 +241,7 @@ void main() {
pumpFrame(); pumpFrame();
expect(editable, paintsExactlyCountTimes(#drawRRect, 0)); expect(editable, paintsExactlyCountTimes(#drawRRect, 0));
}); }, skip: isBrowser);
test('text is painted above selection', () { test('text is painted above selection', () {
final TextSelectionDelegate delegate = FakeEditableTextState(); final TextSelectionDelegate delegate = FakeEditableTextState();
...@@ -327,7 +327,7 @@ void main() { ...@@ -327,7 +327,7 @@ void main() {
..paragraph(), ..paragraph(),
); );
expect(editable, paintsExactlyCountTimes(#drawRect, 1)); expect(editable, paintsExactlyCountTimes(#drawRect, 1));
}); }, skip: isBrowser);
test('selects correct place with offsets', () { test('selects correct place with offsets', () {
final TextSelectionDelegate delegate = FakeEditableTextState(); final TextSelectionDelegate delegate = FakeEditableTextState();
...@@ -407,7 +407,7 @@ void main() { ...@@ -407,7 +407,7 @@ void main() {
expect(currentSelection.isCollapsed, false); expect(currentSelection.isCollapsed, false);
expect(currentSelection.baseOffset, 5); expect(currentSelection.baseOffset, 5);
expect(currentSelection.extentOffset, 9); expect(currentSelection.extentOffset, 9);
}); }, skip: isBrowser);
test('selects correct place when offsets are flipped', () { test('selects correct place when offsets are flipped', () {
final TextSelectionDelegate delegate = FakeEditableTextState(); final TextSelectionDelegate delegate = FakeEditableTextState();
...@@ -439,7 +439,7 @@ void main() { ...@@ -439,7 +439,7 @@ void main() {
expect(currentSelection.isCollapsed, isFalse); expect(currentSelection.isCollapsed, isFalse);
expect(currentSelection.baseOffset, 1); expect(currentSelection.baseOffset, 1);
expect(currentSelection.extentOffset, 3); expect(currentSelection.extentOffset, 3);
}); }, skip: isBrowser);
test('selection does not flicker as user is dragging', () { test('selection does not flicker as user is dragging', () {
int selectionChangedCount = 0; int selectionChangedCount = 0;
...@@ -494,7 +494,7 @@ void main() { ...@@ -494,7 +494,7 @@ void main() {
expect(updatedSelection.baseOffset, 3); expect(updatedSelection.baseOffset, 3);
expect(updatedSelection.extentOffset, 5); expect(updatedSelection.extentOffset, 5);
expect(selectionChangedCount, 1); expect(selectionChangedCount, 1);
}); }, skip: isBrowser);
test('editable hasFocus correctly initialized', () { test('editable hasFocus correctly initialized', () {
// Regression test for https://github.com/flutter/flutter/issues/21640 // Regression test for https://github.com/flutter/flutter/issues/21640
......
...@@ -455,5 +455,5 @@ void main() { ...@@ -455,5 +455,5 @@ void main() {
_testConflicts(layerA, layerB, expectedErrorCount: 1); _testConflicts(layerA, layerB, expectedErrorCount: 1);
}); });
}); }, skip: isBrowser);
} }
...@@ -48,7 +48,7 @@ void main() { ...@@ -48,7 +48,7 @@ void main() {
final TextPosition positionBelow = paragraph.getPositionForOffset(const Offset(5.0, 20.0)); final TextPosition positionBelow = paragraph.getPositionForOffset(const Offset(5.0, 20.0));
expect(positionBelow.offset, greaterThan(position40.offset)); expect(positionBelow.offset, greaterThan(position40.offset));
}); }, skip: isBrowser);
test('getBoxesForSelection control test', () { test('getBoxesForSelection control test', () {
final RenderParagraph paragraph = RenderParagraph( final RenderParagraph paragraph = RenderParagraph(
...@@ -71,7 +71,7 @@ void main() { ...@@ -71,7 +71,7 @@ void main() {
expect(boxes.any((ui.TextBox box) => box.right == 100 && box.top == 10), isTrue); expect(boxes.any((ui.TextBox box) => box.right == 100 && box.top == 10), isTrue);
}, },
// Ahem-based tests don't yet quite work on Windows or some MacOS environments // Ahem-based tests don't yet quite work on Windows or some MacOS environments
skip: isLinux); skip: isLinux || isBrowser);
test('getWordBoundary control test', () { test('getWordBoundary control test', () {
final RenderParagraph paragraph = RenderParagraph( final RenderParagraph paragraph = RenderParagraph(
...@@ -88,7 +88,7 @@ void main() { ...@@ -88,7 +88,7 @@ void main() {
final TextRange range85 = paragraph.getWordBoundary(const TextPosition(offset: 75)); final TextRange range85 = paragraph.getWordBoundary(const TextPosition(offset: 75));
expect(range85.textInside(_kText), equals('Queen\'s')); expect(range85.textInside(_kText), equals('Queen\'s'));
}); }, skip: isBrowser);
test('overflow test', () { test('overflow test', () {
final RenderParagraph paragraph = RenderParagraph( final RenderParagraph paragraph = RenderParagraph(
...@@ -164,7 +164,7 @@ void main() { ...@@ -164,7 +164,7 @@ void main() {
relayoutWith(maxLines: 100, softWrap: true, overflow: TextOverflow.fade); relayoutWith(maxLines: 100, softWrap: true, overflow: TextOverflow.fade);
expect(paragraph.debugHasOverflowShader, isFalse); expect(paragraph.debugHasOverflowShader, isFalse);
}); }, skip: isBrowser);
test('maxLines', () { test('maxLines', () {
final RenderParagraph paragraph = RenderParagraph( final RenderParagraph paragraph = RenderParagraph(
...@@ -193,7 +193,7 @@ void main() { ...@@ -193,7 +193,7 @@ void main() {
layoutAt(3); layoutAt(3);
expect(paragraph.size.height, 30.0); expect(paragraph.size.height, 30.0);
}, skip: isWindows); // Ahem-based tests don't yet quite work on Windows }, skip: isWindows || isBrowser); // Ahem-based tests don't yet quite work on Windows
test('changing color does not do layout', () { test('changing color does not do layout', () {
final RenderParagraph paragraph = RenderParagraph( final RenderParagraph paragraph = RenderParagraph(
...@@ -280,7 +280,7 @@ void main() { ...@@ -280,7 +280,7 @@ void main() {
expect(boxes[2].toRect().height, closeTo(26.0, 0.0001)); expect(boxes[2].toRect().height, closeTo(26.0, 0.0001));
expect(boxes[3].toRect().width, anyOf(14.0, 13.0)); expect(boxes[3].toRect().width, anyOf(14.0, 13.0));
expect(boxes[3].toRect().height, closeTo(13.0, 0.0001)); expect(boxes[3].toRect().height, closeTo(13.0, 0.0001));
}); }, skip: isBrowser);
test('toStringDeep', () { test('toStringDeep', () {
final RenderParagraph paragraph = RenderParagraph( final RenderParagraph paragraph = RenderParagraph(
...@@ -361,7 +361,7 @@ void main() { ...@@ -361,7 +361,7 @@ void main() {
expect(boxes[3], const TextBox.fromLTRBD(38.0, 4.0, 48.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)); expect(boxes[4], const TextBox.fromLTRBD(48.0, 0.0, 62.0, 14.0, TextDirection.ltr));
// Ahem-based tests don't yet quite work on Windows or some MacOS environments // Ahem-based tests don't yet quite work on Windows or some MacOS environments
}, skip: isWindows || isMacOS); }, skip: isWindows || isMacOS || isBrowser);
test('inline widgets multiline test', () { test('inline widgets multiline test', () {
const TextSpan text = TextSpan( const TextSpan text = TextSpan(
...@@ -413,5 +413,5 @@ void main() { ...@@ -413,5 +413,5 @@ void main() {
expect(boxes[7], const TextBox.fromLTRBD(0.0, 28.0, 14.0, 42.0, TextDirection.ltr)); 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)); expect(boxes[8], const TextBox.fromLTRBD(14.0, 28.0, 28.0, 42.0 , TextDirection.ltr));
// Ahem-based tests don't yet quite work on Windows or some MacOS environments // Ahem-based tests don't yet quite work on Windows or some MacOS environments
}, skip: isWindows || isMacOS); }, skip: isWindows || isMacOS || isBrowser);
} }
...@@ -69,5 +69,5 @@ void main() { ...@@ -69,5 +69,5 @@ void main() {
expect(positioner.size.width, equals(200.0)); expect(positioner.size.width, equals(200.0));
expect(positioner.size.height, equals(200.0)); expect(positioner.size.height, equals(200.0));
}); }, skip: isBrowser);
} }
...@@ -229,7 +229,7 @@ void main() { ...@@ -229,7 +229,7 @@ void main() {
expect(getPixel(20, 20), equals(0x00000080)); expect(getPixel(20, 20), equals(0x00000080));
expect(getPixel(image.width - 1, 0), equals(0x00000000)); expect(getPixel(image.width - 1, 0), equals(0x00000000));
expect(getPixel(image.width - 1, 20), equals(0xffffffff)); expect(getPixel(image.width - 1, 20), equals(0xffffffff));
}); }, skip: isBrowser);
test('RenderOpacity does not composite if it is transparent', () { test('RenderOpacity does not composite if it is transparent', () {
final RenderOpacity renderOpacity = RenderOpacity( final RenderOpacity renderOpacity = RenderOpacity(
......
...@@ -478,7 +478,7 @@ void main() { ...@@ -478,7 +478,7 @@ void main() {
); );
expect(children.sublist(0, 21).any((RenderBox r) => r.attached), false); expect(children.sublist(0, 21).any((RenderBox r) => r.attached), false);
expect(children.sublist(21, 30).every((RenderBox r) => r.attached), true); expect(children.sublist(21, 30).every((RenderBox r) => r.attached), true);
}); }, skip: isBrowser);
test('RenderSliverGrid calculates correct geometry', () { test('RenderSliverGrid calculates correct geometry', () {
// Viewport is 800x600, each grid element is 400x100, giving us space for 12 visible children // Viewport is 800x600, each grid element is 400x100, giving us space for 12 visible children
......
...@@ -190,7 +190,7 @@ void main() { ...@@ -190,7 +190,7 @@ void main() {
revealed = viewport.getOffsetToReveal(target, 1.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0)); revealed = viewport.getOffsetToReveal(target, 1.0, rect: const Rect.fromLTWH(40.0, 40.0, 10.0, 10.0));
expect(revealed.offset, 360.0); expect(revealed.offset, 360.0);
expect(revealed.rect, const Rect.fromLTWH(0.0, 40.0, 10.0, 10.0)); expect(revealed.rect, const Rect.fromLTWH(0.0, 40.0, 10.0, 10.0));
}); }, skip: isBrowser);
testWidgets('Viewport getOffsetToReveal Sliver - down', (WidgetTester tester) async { testWidgets('Viewport getOffsetToReveal Sliver - down', (WidgetTester tester) async {
final List<Widget> children = <Widget>[]; final List<Widget> children = <Widget>[];
......
...@@ -479,6 +479,9 @@ Future<void> main() async { ...@@ -479,6 +479,9 @@ Future<void> main() async {
// we don't have an embedder yet this is the lowest-most layer we can put // we don't have an embedder yet this is the lowest-most layer we can put
// this stuff in. // this stuff in.
await ui.webOnlyInitializeEngine(); await ui.webOnlyInitializeEngine();
// TODO(flutterweb): remove need for dynamic cast.
(ui.window as dynamic).debugOverrideDevicePixelRatio(3.0);
(ui.window as dynamic).webOnlyDebugPhysicalSizeOverride = const ui.Size(2400, 1800);
internalBootstrapBrowserTest(() => test.main); internalBootstrapBrowserTest(() => test.main);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment