Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
2102bb03
Unverified
Commit
2102bb03
authored
Sep 22, 2020
by
Dan Field
Committed by
GitHub
Sep 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove last FakeImage implementation (#66379)
parent
4881b4b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
40 deletions
+25
-40
image_stream_test.dart
packages/flutter/test/painting/image_stream_test.dart
+25
-40
No files found.
packages/flutter/test/painting/image_stream_test.dart
View file @
2102bb03
...
...
@@ -5,7 +5,6 @@
// @dart = 2.8
import
'dart:async'
;
import
'dart:typed_data'
;
import
'dart:ui'
;
import
'package:flutter/painting.dart'
;
...
...
@@ -14,8 +13,8 @@ import 'package:flutter_test/flutter_test.dart';
import
'package:meta/meta.dart'
;
class
FakeFrameInfo
implements
FrameInfo
{
FakeFrameInfo
(
int
width
,
int
height
,
this
.
_duration
)
:
_image
=
FakeImage
(
width
,
height
);
FakeFrameInfo
(
this
.
_duration
,
this
.
_image
);
final
Duration
_duration
;
final
Image
_image
;
...
...
@@ -27,27 +26,6 @@ class FakeFrameInfo implements FrameInfo {
Image
get
image
=>
_image
;
}
class
FakeImage
implements
Image
{
FakeImage
(
this
.
_width
,
this
.
_height
);
final
int
_width
;
final
int
_height
;
@override
int
get
width
=>
_width
;
@override
int
get
height
=>
_height
;
@override
void
dispose
()
{
}
@override
Future
<
ByteData
>
toByteData
({
ImageByteFormat
format
=
ImageByteFormat
.
rawRgba
})
async
{
throw
UnsupportedError
(
'Cannot encode test image'
);
}
}
class
MockCodec
implements
Codec
{
@override
...
...
@@ -92,6 +70,13 @@ class FakeEventReportingImageStreamCompleter extends ImageStreamCompleter {
}
void
main
(
)
{
Image
image20x10
;
Image
image200x100
;
setUpAll
(()
async
{
image20x10
=
await
createTestImage
(
width:
20
,
height:
10
);
image200x100
=
await
createTestImage
(
width:
200
,
height:
100
);
});
testWidgets
(
'Codec future fails'
,
(
WidgetTester
tester
)
async
{
final
Completer
<
Codec
>
completer
=
Completer
<
Codec
>();
MultiFrameImageStreamCompleter
(
...
...
@@ -310,7 +295,7 @@ void main() {
codecCompleter
.
complete
(
mockCodec
);
await
tester
.
idle
();
final
FrameInfo
frame
=
FakeFrameInfo
(
20
,
10
,
const
Duration
(
milliseconds:
200
)
);
final
FrameInfo
frame
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
200
),
image20x10
);
mockCodec
.
completeNextFrame
(
frame
);
await
tester
.
idle
();
...
...
@@ -336,7 +321,7 @@ void main() {
codecCompleter
.
complete
(
mockCodec
);
await
tester
.
idle
();
final
FrameInfo
frame1
=
FakeFrameInfo
(
20
,
10
,
const
Duration
(
milliseconds:
200
)
);
final
FrameInfo
frame1
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
200
),
image20x10
);
mockCodec
.
completeNextFrame
(
frame1
);
await
tester
.
idle
();
// We are waiting for the next animation tick, so at this point no frames
...
...
@@ -346,7 +331,7 @@ void main() {
await
tester
.
pump
();
expect
(
emittedImages
,
equals
(<
ImageInfo
>[
ImageInfo
(
image:
frame1
.
image
)]));
final
FrameInfo
frame2
=
FakeFrameInfo
(
200
,
100
,
const
Duration
(
milliseconds:
400
)
);
final
FrameInfo
frame2
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
400
),
image200x100
);
mockCodec
.
completeNextFrame
(
frame2
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
100
));
...
...
@@ -384,8 +369,8 @@ void main() {
codecCompleter
.
complete
(
mockCodec
);
await
tester
.
idle
();
final
FrameInfo
frame1
=
FakeFrameInfo
(
20
,
10
,
const
Duration
(
milliseconds:
200
)
);
final
FrameInfo
frame2
=
FakeFrameInfo
(
200
,
100
,
const
Duration
(
milliseconds:
400
)
);
final
FrameInfo
frame1
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
200
),
image20x10
);
final
FrameInfo
frame2
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
400
),
image200x100
);
mockCodec
.
completeNextFrame
(
frame1
);
await
tester
.
idle
();
// let nextFrameFuture complete
...
...
@@ -427,8 +412,8 @@ void main() {
codecCompleter
.
complete
(
mockCodec
);
await
tester
.
idle
();
final
FrameInfo
frame1
=
FakeFrameInfo
(
20
,
10
,
const
Duration
(
milliseconds:
200
)
);
final
FrameInfo
frame2
=
FakeFrameInfo
(
200
,
100
,
const
Duration
(
milliseconds:
400
)
);
final
FrameInfo
frame1
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
200
),
image20x10
);
final
FrameInfo
frame2
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
400
),
image200x100
);
mockCodec
.
completeNextFrame
(
frame1
);
await
tester
.
idle
();
// let nextFrameFuture complete
...
...
@@ -465,8 +450,8 @@ void main() {
codecCompleter
.
complete
(
mockCodec
);
await
tester
.
idle
();
final
FrameInfo
frame1
=
FakeFrameInfo
(
20
,
10
,
const
Duration
(
milliseconds:
200
)
);
final
FrameInfo
frame2
=
FakeFrameInfo
(
200
,
100
,
const
Duration
(
milliseconds:
400
)
);
final
FrameInfo
frame1
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
200
),
image20x10
);
final
FrameInfo
frame2
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
400
),
image200x100
);
mockCodec
.
completeNextFrame
(
frame1
);
await
tester
.
idle
();
// let nextFrameFuture complete
...
...
@@ -510,8 +495,8 @@ void main() {
codecCompleter
.
complete
(
mockCodec
);
await
tester
.
idle
();
final
FrameInfo
frame1
=
FakeFrameInfo
(
20
,
10
,
const
Duration
(
milliseconds:
200
)
);
final
FrameInfo
frame2
=
FakeFrameInfo
(
200
,
100
,
const
Duration
(
milliseconds:
400
)
);
final
FrameInfo
frame1
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
200
),
image20x10
);
final
FrameInfo
frame2
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
400
),
image200x100
);
mockCodec
.
completeNextFrame
(
frame1
);
await
tester
.
idle
();
// let nextFrameFuture complete
...
...
@@ -549,8 +534,8 @@ void main() {
codecCompleter
.
complete
(
mockCodec
);
await
tester
.
idle
();
final
FrameInfo
frame1
=
FakeFrameInfo
(
20
,
10
,
const
Duration
(
milliseconds:
200
)
);
final
FrameInfo
frame2
=
FakeFrameInfo
(
200
,
100
,
const
Duration
(
milliseconds:
400
)
);
final
FrameInfo
frame1
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
200
),
image20x10
);
final
FrameInfo
frame2
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
400
),
image200x100
);
mockCodec
.
completeNextFrame
(
frame1
);
await
tester
.
idle
();
// let nextFrameFuture complete
...
...
@@ -582,8 +567,8 @@ void main() {
codecCompleter
.
complete
(
mockCodec
);
await
tester
.
idle
();
final
FrameInfo
frame1
=
FakeFrameInfo
(
20
,
10
,
const
Duration
(
milliseconds:
200
)
);
final
FrameInfo
frame2
=
FakeFrameInfo
(
200
,
100
,
const
Duration
(
milliseconds:
400
)
);
final
FrameInfo
frame1
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
200
),
image20x10
);
final
FrameInfo
frame2
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
400
),
image200x100
);
mockCodec
.
completeNextFrame
(
frame1
);
await
tester
.
idle
();
// let nextFrameFuture complete
...
...
@@ -658,7 +643,7 @@ void main() {
imageStream
.
addListener
(
ImageStreamListener
(
listener
));
final
FrameInfo
frame1
=
FakeFrameInfo
(
20
,
10
,
const
Duration
(
milliseconds:
200
)
);
final
FrameInfo
frame1
=
FakeFrameInfo
(
const
Duration
(
milliseconds:
200
),
image20x10
);
mockCodec
.
completeNextFrame
(
frame1
);
await
tester
.
idle
();
// let nextFrameFuture complete
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment