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
aa622fbb
Unverified
Commit
aa622fbb
authored
Mar 13, 2020
by
Kate Lovett
Committed by
GitHub
Mar 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switching to Gold Status Check (#51968)
parent
dbe91c96
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
31 deletions
+35
-31
basic_test.dart
packages/flutter/test/widgets/basic_test.dart
+16
-0
flutter_goldens.dart
packages/flutter_goldens/lib/flutter_goldens.dart
+5
-1
skia_client.dart
packages/flutter_goldens_client/lib/skia_client.dart
+14
-30
No files found.
packages/flutter/test/widgets/basic_test.dart
View file @
aa622fbb
...
...
@@ -371,6 +371,22 @@ void main() {
expect
(
properties
.
properties
.
first
.
value
,
colorToPaint
);
});
});
testWidgets
(
'Inconsequential golden test'
,
(
WidgetTester
tester
)
async
{
// The test validates the Flutter Gold integration. Any changes to the
// golden file can be approved at any time.
await
tester
.
pumpWidget
(
RepaintBoundary
(
child:
Container
(
color:
const
Color
(
0xFF42A5F5
),
),
));
await
tester
.
pumpAndSettle
();
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
matchesGoldenFile
(
'inconsequential_golden_file.png'
),
);
// TODO(Piinks): Remove skip once web goldens are supported, https://github.com/flutter/flutter/issues/40297
},
skip:
isBrowser
);
}
HitsRenderBox
hits
(
RenderBox
renderBox
)
=>
HitsRenderBox
(
renderBox
);
...
...
packages/flutter_goldens/lib/flutter_goldens.dart
View file @
aa622fbb
...
...
@@ -385,7 +385,11 @@ class _AuthorizedFlutterPreSubmitComparator extends FlutterPreSubmitFileComparat
await
update
(
golden
,
imageBytes
);
final
File
goldenFile
=
getGoldenFile
(
golden
);
return
skiaClient
.
tryjobAdd
(
golden
.
path
,
goldenFile
);
await
skiaClient
.
tryjobAdd
(
golden
.
path
,
goldenFile
);
// This will always return true since golden file test failures are managed
// in pre-submit checks by the flutter-gold status check.
return
true
;
}
}
...
...
packages/flutter_goldens_client/lib/skia_client.dart
View file @
aa622fbb
...
...
@@ -325,7 +325,7 @@ class SkiaGoldClient {
///
/// The [testName] and [goldenFile] parameters reference the current
/// comparison being evaluated by the [_AuthorizedFlutterPreSubmitComparator].
Future
<
bool
>
tryjobAdd
(
String
testName
,
File
goldenFile
)
async
{
Future
<
void
>
tryjobAdd
(
String
testName
,
File
goldenFile
)
async
{
assert
(
testName
!=
null
);
assert
(
goldenFile
!=
null
);
...
...
@@ -343,36 +343,20 @@ class SkiaGoldClient {
imgtestArguments
,
);
if
(
result
.
exitCode
!=
0
)
{
final
String
resultStdout
=
result
.
stdout
.
toString
();
if
(
resultStdout
.
contains
(
'Untriaged'
)
||
resultStdout
.
contains
(
'negative image'
))
{
final
List
<
String
>
failureLinks
=
await
workDirectory
.
childFile
(
'failures.json'
).
readAsLines
();
final
StringBuffer
buf
=
StringBuffer
()
..
writeln
(
'The golden file "
$testName
" '
)
..
writeln
(
'did not match the expected image.'
)
..
writeln
(
'To view the closest matching image, the actual image generated, '
)
..
writeln
(
'and the visual difference, visit: '
)
..
writeln
(
failureLinks
.
last
)
..
writeln
(
'There you can also triage this image (e.g. because this '
)
..
writeln
(
'is an intentional change).'
)
..
writeln
();
throw
Exception
(
buf
.
toString
());
}
else
{
final
StringBuffer
buf
=
StringBuffer
()
..
writeln
(
'Unexpected Gold tryjobAdd failure.'
)
..
writeln
(
'Tryjob execution for golden file test
$testName
failed for'
)
..
writeln
(
'a reason unrelated to pixel comparison.'
)
..
writeln
()
..
writeln
(
'Debug information for Gold:'
)
..
writeln
(
'stdout:
${result.stdout}
'
)
..
writeln
(
'stderr:
${result.stderr}
'
)
..
writeln
();
throw
Exception
(
buf
.
toString
());
}
final
String
resultStdout
=
result
.
stdout
.
toString
();
if
(
result
.
exitCode
!=
0
&&
!(
resultStdout
.
contains
(
'Untriaged'
)
||
resultStdout
.
contains
(
'negative image'
)))
{
final
StringBuffer
buf
=
StringBuffer
()
..
writeln
(
'Unexpected Gold tryjobAdd failure.'
)
..
writeln
(
'Tryjob execution for golden file test
$testName
failed for'
)
..
writeln
(
'a reason unrelated to pixel comparison.'
)
..
writeln
()
..
writeln
(
'Debug information for Gold:'
)
..
writeln
(
'stdout:
${result.stdout}
'
)
..
writeln
(
'stderr:
${result.stderr}
'
)
..
writeln
();
throw
Exception
(
buf
.
toString
());
}
return
result
.
exitCode
==
0
;
}
/// Executes the `imgtest check` command in the goldctl tool for unauthorized
...
...
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