Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
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
Update image_test.dart
  • Loading branch information
polina-c committed Aug 30, 2022
commit f330db4335751199dec5daa811e3347f8be7a05c
30 changes: 16 additions & 14 deletions lib/web_ui/test/engine/image/image_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@
// found in the LICENSE file.

import 'package:test/bootstrap/browser.dart';
import 'package:test/test.dart';
import 'package:ui/ui.dart' as ui;
// import 'package:test/test.dart';
// import 'package:ui/ui.dart' as ui;

void main() {
internalBootstrapBrowserTest(() => testMain);
}

Future<void> testMain() async {
test('toImage succeeds', () async {
final ui.Image image = await _createImage();
expect(image.runtimeType.toString(), equals('HtmlImage'));
});
// TODO(polina-c): uncomment the test when bug is fixed:
// https://github.com/flutter/engine/pull/35791
// test('toImage succeeds', () async {
// final ui.Image image = await _createImage();
// expect(image.runtimeType.toString(), equals('HtmlImage'));
// });
}

Future<ui.Image> _createImage() => _createPicture().toImage(10, 10);
// Future<ui.Image> _createImage() => _createPicture().toImage(10, 10);

ui.Picture _createPicture() {
final ui.PictureRecorder recorder = ui.PictureRecorder();
final ui.Canvas canvas = ui.Canvas(recorder);
const ui.Rect rect = ui.Rect.fromLTWH(0.0, 0.0, 100.0, 100.0);
canvas.clipRect(rect);
return recorder.endRecording();
}
// ui.Picture _createPicture() {
// final ui.PictureRecorder recorder = ui.PictureRecorder();
// final ui.Canvas canvas = ui.Canvas(recorder);
// const ui.Rect rect = ui.Rect.fromLTWH(0.0, 0.0, 100.0, 100.0);
// canvas.clipRect(rect);
// return recorder.endRecording();
// }