Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix analysis errors
  • Loading branch information
harryterkelsen committed Dec 19, 2023
commit aaaeba0bce0dacd12fa82e8c80dc33d622765c04
4 changes: 2 additions & 2 deletions lib/web_ui/test/canvaskit/multi_view_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ void testMain() {
});

test('can render into arbitrary views', () async {
CanvasKitRenderer.instance.renderScene(scene, implicitView);
await CanvasKitRenderer.instance.renderScene(scene, implicitView);

final EngineFlutterView anotherView = EngineFlutterView(
EnginePlatformDispatcher.instance, createDomElement('another-view'));
EnginePlatformDispatcher.instance.viewManager.registerView(anotherView);

CanvasKitRenderer.instance.renderScene(scene, anotherView);
await CanvasKitRenderer.instance.renderScene(scene, anotherView);
});

test('will error if trying to render into an unregistered view', () async {
Expand Down
4 changes: 2 additions & 2 deletions lib/web_ui/test/canvaskit/render_canvas_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ void testMain() {
});

Future<DomImageBitmap> newBitmap(int width, int height) async {
return (await createImageBitmap(
return createImageBitmap(
createBlankDomImageData(width, height) as JSAny, (
x: 0,
y: 0,
width: width,
height: height,
)).toDart)! as DomImageBitmap;
));
}

// Regression test for https://github.com/flutter/flutter/issues/75286
Expand Down
18 changes: 12 additions & 6 deletions lib/web_ui/test/engine/scene_view_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ class StubPictureRenderer implements PictureRenderer {
Future<DomImageBitmap> renderPicture(ScenePicture picture) async {
renderedPictures.add(picture);
final ui.Rect cullRect = picture.cullRect;
final DomImageBitmap bitmap = (await createImageBitmap(
scratchCanvasElement as JSObject,
(x: 0, y: 0, width: cullRect.width.toInt(), height: cullRect.height.toInt())
).toDart)! as DomImageBitmap;
final DomImageBitmap bitmap =
await createImageBitmap(scratchCanvasElement as JSObject, (
x: 0,
y: 0,
width: cullRect.width.toInt(),
height: cullRect.height.toInt(),
));
return bitmap;
}

Expand Down Expand Up @@ -83,7 +86,8 @@ void testMain() {
debugOverrideDevicePixelRatio(null);
});

test('SceneView places platform view according to device-pixel ratio', () async {
test('SceneView places platform view according to device-pixel ratio',
() async {
debugOverrideDevicePixelRatio(2.0);

final PlatformView platformView = PlatformView(
Expand Down Expand Up @@ -113,7 +117,9 @@ void testMain() {
debugOverrideDevicePixelRatio(null);
});

test('SceneView always renders most recent picture and skips intermediate pictures', () async {
test(
'SceneView always renders most recent picture and skips intermediate pictures',
() async {
final List<StubPicture> pictures = <StubPicture>[];
final List<Future<void>> renderFutures = <Future<void>>[];
for (int i = 1; i < 20; i++) {
Expand Down
2 changes: 1 addition & 1 deletion lib/web_ui/test/ui/image_golden_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ Future<void> testMain() async {
image.src = url;
await completer.future;

final DomImageBitmap bitmap = (await createImageBitmap(image as JSObject).toDart)! as DomImageBitmap;
final DomImageBitmap bitmap = await createImageBitmap(image as JSObject);

expect(bitmap.width.toDartInt, 150);
expect(bitmap.height.toDartInt, 150);
Expand Down