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
e537661a
Unverified
Commit
e537661a
authored
Apr 12, 2021
by
Lasse R.H. Nielsen
Committed by
GitHub
Apr 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change test to not implement ByteData (#80049)
parent
d1187487
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
image_resolution_test.dart
packages/flutter/test/widgets/image_resolution_test.dart
+12
-14
No files found.
packages/flutter/test/widgets/image_resolution_test.dart
View file @
e537661a
...
...
@@ -14,12 +14,10 @@ import 'package:flutter_test/flutter_test.dart';
import
'../image_data.dart'
;
class
TestByteData
implements
ByteData
{
TestByteData
(
this
.
scale
);
final
double
scale
;
ByteData
testByteData
(
double
scale
)
=>
ByteData
(
8
)..
setFloat64
(
0
,
scale
);
@override
d
ynamic
noSuchMethod
(
Invocation
invocation
)
=>
null
;
extension
on
ByteData
{
d
ouble
get
scale
=>
getFloat64
(
0
)
;
}
const
String
testManifest
=
'''
...
...
@@ -44,22 +42,22 @@ class TestAssetBundle extends CachingAssetBundle {
late
ByteData
data
;
switch
(
key
)
{
case
'assets/image.png'
:
data
=
T
estByteData
(
1.0
);
data
=
t
estByteData
(
1.0
);
break
;
case
'assets/1.0x/image.png'
:
data
=
T
estByteData
(
10.0
);
// see "...with a main asset and a 1.0x asset"
data
=
t
estByteData
(
10.0
);
// see "...with a main asset and a 1.0x asset"
break
;
case
'assets/1.5x/image.png'
:
data
=
T
estByteData
(
1.5
);
data
=
t
estByteData
(
1.5
);
break
;
case
'assets/2.0x/image.png'
:
data
=
T
estByteData
(
2.0
);
data
=
t
estByteData
(
2.0
);
break
;
case
'assets/3.0x/image.png'
:
data
=
T
estByteData
(
3.0
);
data
=
t
estByteData
(
3.0
);
break
;
case
'assets/4.0x/image.png'
:
data
=
T
estByteData
(
4.0
);
data
=
t
estByteData
(
4.0
);
break
;
}
return
SynchronousFuture
<
ByteData
>(
data
);
...
...
@@ -91,7 +89,7 @@ class TestAssetImage extends AssetImage {
ImageStreamCompleter
load
(
AssetBundleImageKey
key
,
DecoderCallback
decode
)
{
late
ImageInfo
imageInfo
;
key
.
bundle
.
load
(
key
.
name
).
then
<
void
>((
ByteData
data
)
{
final
TestByteData
testData
=
data
as
TestByteD
ata
;
final
ByteData
testData
=
d
ata
;
final
ui
.
Image
image
=
images
[
testData
.
scale
]!;
assert
(
image
!=
null
,
'Expected
${testData.scale}
to have a key in
$images
'
);
imageInfo
=
ImageInfo
(
image:
image
,
scale:
key
.
scale
);
...
...
@@ -312,12 +310,12 @@ void main() {
Key
key
=
GlobalKey
();
await
pumpTreeToLayout
(
tester
,
buildImageAtRatio
(
image
,
key
,
ratio
,
false
,
images
,
bundle
));
expect
(
getRenderImage
(
tester
,
key
).
size
,
const
Size
(
200.0
,
200.0
));
// Verify we got the 10x scaled image, since the
Test
ByteData said it should be 10x.
// Verify we got the 10x scaled image, since the
test
ByteData said it should be 10x.
expect
(
getRenderImage
(
tester
,
key
).
image
!.
height
,
480
);
key
=
GlobalKey
();
await
pumpTreeToLayout
(
tester
,
buildImageAtRatio
(
image
,
key
,
ratio
,
true
,
images
,
bundle
));
expect
(
getRenderImage
(
tester
,
key
).
size
,
const
Size
(
480.0
,
480.0
));
// Verify we got the 10x scaled image, since the
Test
ByteData said it should be 10x.
// Verify we got the 10x scaled image, since the
test
ByteData said it should be 10x.
expect
(
getRenderImage
(
tester
,
key
).
image
!.
height
,
480
);
});
...
...
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