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
c2813693
Commit
c2813693
authored
Dec 19, 2019
by
Kate Lovett
Committed by
Flutter GitHub Bot
Dec 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix subdirectory output (#47256)
parent
f05ab503
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
2 deletions
+31
-2
_goldens_io.dart
packages/flutter_test/lib/src/_goldens_io.dart
+1
-1
goldens_test.dart
packages/flutter_test/test/goldens_test.dart
+30
-1
No files found.
packages/flutter_test/lib/src/_goldens_io.dart
View file @
c2813693
...
...
@@ -155,7 +155,7 @@ class LocalComparisonOutput {
/// Returns the appropriate file for a given diff from a [ComparisonResult].
File
getFailureFile
(
String
failure
,
Uri
golden
,
Uri
basedir
)
{
final
String
fileName
=
golden
.
pathSegments
[
0
]
;
final
String
fileName
=
golden
.
pathSegments
.
last
;
final
String
testName
=
fileName
.
split
(
path
.
extension
(
fileName
))[
0
]
+
'_'
+
failure
...
...
packages/flutter_test/test/goldens_test.dart
View file @
c2813693
...
...
@@ -149,7 +149,7 @@ void main() {
group
(
'fails'
,
()
{
test
(
'and generates correct output in the correct location'
,
()
async
{
test
(
'and generates correct output in the correct
base
location'
,
()
async
{
comparator
=
LocalFileComparator
(
Uri
.
parse
(
'local_test.dart'
),
pathStyle:
fs
.
path
.
style
);
await
fs
.
file
(
fix
(
'/golden.png'
)).
writeAsBytes
(
_kColorFailurePngBytes
);
try
{
...
...
@@ -176,6 +176,35 @@ void main() {
}
});
test
(
'and generates correct output when files are in a subdirectory'
,
()
async
{
comparator
=
LocalFileComparator
(
Uri
.
parse
(
'local_test.dart'
),
pathStyle:
fs
.
path
.
style
);
fs
.
file
(
fix
(
'subdir/golden.png'
))
..
createSync
(
recursive:
true
)
..
writeAsBytes
(
_kColorFailurePngBytes
);
try
{
await
doComparison
(
'subdir/golden.png'
);
fail
(
'TestFailure expected but not thrown.'
);
}
on
TestFailure
catch
(
error
)
{
expect
(
error
.
message
,
contains
(
'% diff detected'
));
final
io
.
File
master
=
fs
.
file
(
fix
(
'/failures/golden_masterImage.png'
)
);
final
io
.
File
test
=
fs
.
file
(
fix
(
'/failures/golden_testImage.png'
)
);
final
io
.
File
isolated
=
fs
.
file
(
fix
(
'/failures/golden_isolatedDiff.png'
)
);
final
io
.
File
masked
=
fs
.
file
(
fix
(
'/failures/golden_maskedDiff.png'
)
);
expect
(
master
.
existsSync
(),
isTrue
);
expect
(
test
.
existsSync
(),
isTrue
);
expect
(
isolated
.
existsSync
(),
isTrue
);
expect
(
masked
.
existsSync
(),
isTrue
);
}
});
test
(
'when golden file does not exist'
,
()
async
{
try
{
await
doComparison
();
...
...
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