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 all commits
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
6 changes: 4 additions & 2 deletions lib/web_ui/lib/src/engine/dom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,11 @@ DomEvent createDomEvent(String type, String name) {
return event;
}

@JS()
@JS('ProgressEvent')
@staticInterop
class DomProgressEvent extends DomEvent {}
class DomProgressEvent extends DomEvent {
external factory DomProgressEvent(String type);
}

extension DomProgressEventExtension on DomProgressEvent {
int? get loaded =>
Expand Down
6 changes: 3 additions & 3 deletions lib/web_ui/test/canvaskit/image_golden_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ void _testForImageCodecs({required bool useBrowserImageDecoder}) {
final Future<ui.Codec> futureCodec =
skiaInstantiateWebImageCodec('http://image-server.com/picture.jpg',
null);
mock.sendEvent('load', DomProgressEvent());
mock.sendEvent('load', DomProgressEvent('test progress event'));
final ui.Codec codec = await futureCodec;
expect(codec.frameCount, 1);
final ui.Image image = (await codec.getNextFrame()).image;
Expand Down Expand Up @@ -277,7 +277,7 @@ void _testForImageCodecs({required bool useBrowserImageDecoder}) {
try {
final Future<ui.Codec> futureCodec = skiaInstantiateWebImageCodec(
'url-does-not-matter', null);
mock.sendEvent('error', DomProgressEvent());
mock.sendEvent('error', DomProgressEvent('test error'));
await futureCodec;
fail('Expected to throw');
} on ImageCodecException catch (exception) {
Expand Down Expand Up @@ -317,7 +317,7 @@ void _testForImageCodecs({required bool useBrowserImageDecoder}) {
try {
final Future<ui.Codec> futureCodec = skiaInstantiateWebImageCodec(
'http://image-server.com/picture.jpg', null);
mock.sendEvent('load', DomProgressEvent());
mock.sendEvent('load', DomProgressEvent('test progress event'));
await futureCodec;
fail('Expected to throw');
} on ImageCodecException catch (exception) {
Expand Down