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
dfbbfcd3
Unverified
Commit
dfbbfcd3
authored
Nov 07, 2019
by
Kate Lovett
Committed by
GitHub
Nov 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing local golden output flake (#44307)
parent
3dd67410
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
flutter_goldens.dart
packages/flutter_goldens/lib/flutter_goldens.dart
+5
-4
flutter_goldens_test.dart
packages/flutter_goldens/test/flutter_goldens_test.dart
+21
-0
No files found.
packages/flutter_goldens/lib/flutter_goldens.dart
View file @
dfbbfcd3
...
...
@@ -506,10 +506,11 @@ class FlutterLocalFileComparator extends FlutterGoldenFileComparator with LocalC
}
failureDiffs
[
expectation
]
=
result
;
}
failureDiffs
.
forEach
((
String
expectation
,
ComparisonResult
result
)
async
{
if
(
await
skiaClient
.
isValidDigestForExpectation
(
expectation
,
golden
.
path
))
generateFailureOutput
(
result
,
golden
,
basedir
,
key:
expectation
);
});
for
(
MapEntry
<
String
,
ComparisonResult
>
entry
in
failureDiffs
.
entries
)
{
if
(
await
skiaClient
.
isValidDigestForExpectation
(
entry
.
key
,
golden
.
path
))
generateFailureOutput
(
entry
.
value
,
golden
,
basedir
,
key:
entry
.
key
);
}
return
false
;
}
}
packages/flutter_goldens/test/flutter_goldens_test.dart
View file @
dfbbfcd3
...
...
@@ -741,6 +741,27 @@ void main() {
isTrue
,
);
});
test
(
'compare properly awaits validation & output before failing.'
,
()
async
{
final
Completer
<
bool
>
completer
=
Completer
<
bool
>();
when
(
mockSkiaClient
.
isValidDigestForExpectation
(
'55109a4bed52acc780530f7a9aeff6c0'
,
'library.flutter.golden_test.1.png'
,
))
.
thenAnswer
((
_
)
=>
completer
.
future
);
final
Future
<
bool
>
result
=
comparator
.
compare
(
Uint8List
.
fromList
(
_kFailPngBytes
),
Uri
.
parse
(
'flutter.golden_test.1.png'
),
);
bool
shouldThrow
=
true
;
result
.
then
((
_
)
{
if
(
shouldThrow
)
fail
(
'Compare completed before validation completed!'
);
});
await
Future
<
void
>.
value
();
shouldThrow
=
false
;
completer
.
complete
(
Future
<
bool
>.
value
(
false
));
});
});
});
}
...
...
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