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
51fa7046
Unverified
Commit
51fa7046
authored
Sep 19, 2020
by
Kate Lovett
Committed by
GitHub
Sep 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add handling for empty expectation (#66142)
parent
689ca09c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
flutter_goldens.dart
packages/flutter_goldens/lib/flutter_goldens.dart
+1
-1
flutter_goldens_test.dart
packages/flutter_goldens/test/flutter_goldens_test.dart
+16
-1
No files found.
packages/flutter_goldens/lib/flutter_goldens.dart
View file @
51fa7046
...
...
@@ -648,7 +648,7 @@ class FlutterLocalFileComparator extends FlutterGoldenFileComparator with LocalC
late
String
?
testExpectation
;
testExpectation
=
await
skiaClient
.
getExpectationForTest
(
testName
);
if
(
testExpectation
==
null
)
{
if
(
testExpectation
==
null
||
testExpectation
.
isEmpty
)
{
// There is no baseline for this test
print
(
'No expectations provided by Skia Gold for test:
$golden
. '
'This may be a new test. If this is an unexpected result, check '
...
...
packages/flutter_goldens/test/flutter_goldens_test.dart
View file @
51fa7046
...
...
@@ -903,6 +903,8 @@ void main() {
when
(
mockSkiaClient
.
getExpectationForTest
(
'flutter.golden_test.1'
))
.
thenAnswer
((
_
)
=>
Future
<
String
>.
value
(
'55109a4bed52acc780530f7a9aeff6c0'
));
when
(
mockSkiaClient
.
getExpectationForTest
(
'flutter.new_golden_test.2'
))
.
thenAnswer
((
_
)
=>
Future
<
String
>.
value
(
''
));
when
(
mockSkiaClient
.
getImageBytes
(
'55109a4bed52acc780530f7a9aeff6c0'
))
.
thenAnswer
((
_
)
=>
Future
<
List
<
int
>>.
value
(
_kTestPngBytes
));
when
(
mockSkiaClient
.
cleanTestName
(
'library.flutter.golden_test.1.png'
))
...
...
@@ -919,7 +921,7 @@ void main() {
);
});
testWithOutput
(
'passes non-existent baseline for new test'
,
()
async
{
testWithOutput
(
'passes non-existent baseline for new test
, null expectation
'
,
()
async
{
expect
(
await
comparator
.
compare
(
Uint8List
.
fromList
(
_kFailPngBytes
),
...
...
@@ -932,6 +934,19 @@ void main() {
'Validate image output found at flutter/test/library/'
);
testWithOutput
(
'passes non-existent baseline for new test, empty expectation'
,
()
async
{
expect
(
await
comparator
.
compare
(
Uint8List
.
fromList
(
_kFailPngBytes
),
Uri
.
parse
(
'flutter.new_golden_test.2'
),
),
isTrue
,
);
},
'No expectations provided by Skia Gold for test: library.flutter.new_golden_test.2. '
'This may be a new test. If this is an unexpected result, check https://flutter-gold.skia.org.
\n
'
'Validate image output found at flutter/test/library/'
);
test
(
'compare properly awaits validation & output before failing.'
,
()
async
{
final
Completer
<
bool
>
completer
=
Completer
<
bool
>();
final
Future
<
bool
>
result
=
comparator
.
compare
(
...
...
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