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 {
Future<void> _runWebTests() async {
await _runFlutterWebTest(path.join(flutterRoot, 'packages', 'flutter'), expectFailure: false, tests: <String>[
'test/foundation/',
'test/rendering/',
'test/services/',
'test/painting/',
'test/scheduler/',
......
......@@ -14,12 +14,12 @@ void main() {
test('Describe transform control test', () {
final Matrix4 identity = Matrix4.identity();
final List<String> description = debugDescribeTransform(identity);
expect(description, equals(<String>[
expect(description, <String>[
'[0] 1.0,0.0,0.0,0.0',
'[1] 0.0,1.0,0.0,0.0',
'[2] 0.0,0.0,1.0,0.0',
'[3] 0.0,0.0,0.0,1.0',
]));
]);
});
test('transform property test', () {
......
......@@ -72,7 +72,7 @@ void main() {
' ╚═══════════\n'
),
);
});
}, skip: isBrowser);
// 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
......@@ -168,7 +168,7 @@ void main() {
pumpFrame();
expect(editable, paintsExactlyCountTimes(#drawRRect, 0));
});
}, skip: isBrowser);
test('Cursor with ideographic script', () {
final TextSelectionDelegate delegate = FakeEditableTextState();
......@@ -241,7 +241,7 @@ void main() {
pumpFrame();
expect(editable, paintsExactlyCountTimes(#drawRRect, 0));
});
}, skip: isBrowser);
test('text is painted above selection', () {
final TextSelectionDelegate delegate = FakeEditableTextState();
......@@ -327,7 +327,7 @@ void main() {
..paragraph(),
);
expect(editable, paintsExactlyCountTimes(#drawRect, 1));
});
}, skip: isBrowser);
test('selects correct place with offsets', () {
final TextSelectionDelegate delegate = FakeEditableTextState();
......@@ -407,7 +407,7 @@ void main() {
expect(currentSelection.isCollapsed, false);
expect(currentSelection.baseOffset, 5);
expect(currentSelection.extentOffset, 9);
});
}, skip: isBrowser);
test('selects correct place when offsets are flipped', () {
final TextSelectionDelegate delegate = FakeEditableTextState();
......@@ -439,7 +439,7 @@ void main() {
expect(currentSelection.isCollapsed, isFalse);
expect(currentSelection.baseOffset, 1);
expect(currentSelection.extentOffset, 3);
});
}, skip: isBrowser);
test('selection does not flicker as user is dragging', () {
int selectionChangedCount = 0;
......@@ -494,7 +494,7 @@ void main() {
expect(updatedSelection.baseOffset, 3);
expect(updatedSelection.extentOffset, 5);
expect(selectionChangedCount, 1);
});
}, skip: isBrowser);
test('editable hasFocus correctly initialized', () {
// Regression test for https://github.com/flutter/flutter/issues/21640
......
......@@ -455,5 +455,5 @@ void main() {
_testConflicts(layerA, layerB, expectedErrorCount: 1);
});
});
}, skip: isBrowser);
}
......@@ -48,7 +48,7 @@ void main() {
final TextPosition positionBelow = paragraph.getPositionForOffset(const Offset(5.0, 20.0));
expect(positionBelow.offset, greaterThan(position40.offset));
});
}, skip: isBrowser);
test('getBoxesForSelection control test', () {
final RenderParagraph paragraph = RenderParagraph(
......@@ -71,7 +71,7 @@ void main() {
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
skip: isLinux);
skip: isLinux || isBrowser);
test('getWordBoundary control test', () {
final RenderParagraph paragraph = RenderParagraph(
......@@ -88,7 +88,7 @@ void main() {
final TextRange range85 = paragraph.getWordBoundary(const TextPosition(offset: 75));
expect(range85.textInside(_kText), equals('Queen\'s'));
});
}, skip: isBrowser);
test('overflow test', () {
final RenderParagraph paragraph = RenderParagraph(
......@@ -164,7 +164,7 @@ void main() {
relayoutWith(maxLines: 100, softWrap: true, overflow: TextOverflow.fade);
expect(paragraph.debugHasOverflowShader, isFalse);
});
}, skip: isBrowser);
test('maxLines', () {
final RenderParagraph paragraph = RenderParagraph(
......@@ -193,7 +193,7 @@ void main() {
layoutAt(3);
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', () {
final RenderParagraph paragraph = RenderParagraph(
......@@ -280,7 +280,7 @@ void main() {
expect(boxes[2].toRect().height, closeTo(26.0, 0.0001));
expect(boxes[3].toRect().width, anyOf(14.0, 13.0));
expect(boxes[3].toRect().height, closeTo(13.0, 0.0001));
});
}, skip: isBrowser);
test('toStringDeep', () {
final RenderParagraph paragraph = RenderParagraph(
......@@ -361,7 +361,7 @@ void main() {
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));
// 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', () {
const TextSpan text = TextSpan(
......@@ -413,5 +413,5 @@ void main() {
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));
// 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() {
expect(positioner.size.width, equals(200.0));
expect(positioner.size.height, equals(200.0));
});
}, skip: isBrowser);
}
......@@ -229,7 +229,7 @@ void main() {
expect(getPixel(20, 20), equals(0x00000080));
expect(getPixel(image.width - 1, 0), equals(0x00000000));
expect(getPixel(image.width - 1, 20), equals(0xffffffff));
});
}, skip: isBrowser);
test('RenderOpacity does not composite if it is transparent', () {
final RenderOpacity renderOpacity = RenderOpacity(
......
......@@ -478,7 +478,7 @@ void main() {
);
expect(children.sublist(0, 21).any((RenderBox r) => r.attached), false);
expect(children.sublist(21, 30).every((RenderBox r) => r.attached), true);
});
}, skip: isBrowser);
test('RenderSliverGrid calculates correct geometry', () {
// Viewport is 800x600, each grid element is 400x100, giving us space for 12 visible children
......
......@@ -190,7 +190,7 @@ void main() {
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.rect, const Rect.fromLTWH(0.0, 40.0, 10.0, 10.0));
});
}, skip: isBrowser);
testWidgets('Viewport getOffsetToReveal Sliver - down', (WidgetTester tester) async {
final List<Widget> children = <Widget>[];
......
......@@ -479,6 +479,9 @@ Future<void> main() async {
// we don't have an embedder yet this is the lowest-most layer we can put
// this stuff in.
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);
}
......
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