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
4676c66b
Unverified
Commit
4676c66b
authored
May 02, 2019
by
Kate Lovett
Committed by
GitHub
May 02, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gold' into master
parents
8af81d6a
80344aca
Changes
32
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
600 additions
and
482 deletions
+600
-482
date_picker_test.dart
packages/flutter/test/cupertino/date_picker_test.dart
+29
-38
nav_bar_test.dart
packages/flutter/test/cupertino/nav_bar_test.dart
+3
-11
segmented_control_test.dart
packages/flutter/test/cupertino/segmented_control_test.dart
+4
-6
bottom_app_bar_test.dart
packages/flutter/test/material/bottom_app_bar_test.dart
+3
-5
bottom_app_bar_theme_test.dart
...ages/flutter/test/material/bottom_app_bar_theme_test.dart
+1
-4
bottom_navigation_bar_test.dart
...ges/flutter/test/material/bottom_navigation_bar_test.dart
+1
-3
card_theme_test.dart
packages/flutter/test/material/card_theme_test.dart
+1
-4
dialog_theme_test.dart
packages/flutter/test/material/dialog_theme_test.dart
+1
-4
dropdown_test.dart
packages/flutter/test/material/dropdown_test.dart
+2
-5
floating_action_button_test.dart
...es/flutter/test/material/floating_action_button_test.dart
+1
-3
input_decorator_test.dart
packages/flutter/test/material/input_decorator_test.dart
+3
-8
material_test.dart
packages/flutter/test/material/material_test.dart
+2
-6
radio_test.dart
packages/flutter/test/material/radio_test.dart
+1
-3
tab_bar_theme_test.dart
packages/flutter/test/material/tab_bar_theme_test.dart
+4
-10
continous_rectangle_border_test.dart
...lutter/test/painting/continous_rectangle_border_test.dart
+3
-7
localized_fonts_test.dart
packages/flutter/test/rendering/localized_fonts_test.dart
+6
-14
backdrop_filter_test.dart
packages/flutter/test/widgets/backdrop_filter_test.dart
+1
-3
clip_test.dart
packages/flutter/test/widgets/clip_test.dart
+13
-13
editable_text_cursor_test.dart
packages/flutter/test/widgets/editable_text_cursor_test.dart
+4
-6
invert_colors_test.dart
packages/flutter/test/widgets/invert_colors_test.dart
+2
-6
list_wheel_scroll_view_test.dart
...ges/flutter/test/widgets/list_wheel_scroll_view_test.dart
+2
-6
opacity_test.dart
packages/flutter/test/widgets/opacity_test.dart
+1
-4
physical_model_test.dart
packages/flutter/test/widgets/physical_model_test.dart
+1
-3
shadow_test.dart
packages/flutter/test/widgets/shadow_test.dart
+14
-22
text_golden_test.dart
packages/flutter/test/widgets/text_golden_test.dart
+27
-35
widget_inspector_test.dart
packages/flutter/test/widgets/widget_inspector_test.dart
+26
-50
flutter_goldens.dart
packages/flutter_goldens/lib/flutter_goldens.dart
+36
-29
flutter_goldens_test.dart
packages/flutter_goldens/test/flutter_goldens_test.dart
+73
-54
client.dart
packages/flutter_goldens_client/lib/client.dart
+161
-112
matchers.dart
packages/flutter_test/lib/src/matchers.dart
+84
-0
matchers_test.dart
packages/flutter_test/test/matchers_test.dart
+82
-0
update_packages.dart
packages/flutter_tools/lib/src/commands/update_packages.dart
+8
-8
No files found.
packages/flutter/test/cupertino/date_picker_test.dart
View file @
4676c66b
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'dart:ui'
;
import
'dart:ui'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
...
@@ -823,43 +822,6 @@ void main() {
...
@@ -823,43 +822,6 @@ void main() {
);
);
});
});
testWidgets
(
'DatePicker golden tests'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
Center
(
child:
SizedBox
(
width:
400
,
height:
400
,
child:
RepaintBoundary
(
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
dateAndTime
,
initialDateTime:
DateTime
(
2019
,
1
,
1
,
4
),
onDateTimeChanged:
(
_
)
{},
),
)
),
)
)
);
await
expectLater
(
find
.
byType
(
CupertinoDatePicker
),
matchesGoldenFile
(
'date_picker_test.datetime.initial.1.png'
),
skip:
!
Platform
.
isLinux
);
// Slightly drag the hour component to make the current hour off-center.
await
tester
.
drag
(
find
.
text
(
'4'
),
Offset
(
0
,
_kRowOffset
.
dy
/
2
));
await
tester
.
pump
();
await
expectLater
(
find
.
byType
(
CupertinoDatePicker
),
matchesGoldenFile
(
'date_picker_test.datetime.drag.1.png'
),
skip:
!
Platform
.
isLinux
);
});
});
testWidgets
(
'scrollController can be removed or added'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'scrollController can be removed or added'
,
(
WidgetTester
tester
)
async
{
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
int
lastSelectedItem
;
int
lastSelectedItem
;
...
@@ -933,6 +895,35 @@ void main() {
...
@@ -933,6 +895,35 @@ void main() {
expect
(
lastSelectedItem
,
1
);
expect
(
lastSelectedItem
,
1
);
handle
.
dispose
();
handle
.
dispose
();
});
});
testWidgets
(
'DatePicker golden tests'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
SizedBox
(
width:
200
,
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
dateAndTime
,
initialDateTime:
DateTime
(
2019
,
1
,
1
,
4
),
onDateTimeChanged:
(
_
)
{},
)
)
)
);
await
expectLater
(
find
.
byType
(
CupertinoDatePicker
),
matchesSkiaGoldFile
(
'date_picker_test.datetime.initial.png'
),
);
// Slightly drag the hour component to make the current hour off-center.
await
tester
.
drag
(
find
.
text
(
'4'
),
Offset
(
0
,
_kRowOffset
.
dy
/
2
));
await
tester
.
pump
();
await
expectLater
(
find
.
byType
(
CupertinoDatePicker
),
matchesSkiaGoldFile
(
'date_picker_test.datetime.drag.png'
),
);
});
}
}
Widget
_buildPicker
(
{
FixedExtentScrollController
controller
,
ValueChanged
<
int
>
onSelectedItemChanged
})
{
Widget
_buildPicker
(
{
FixedExtentScrollController
controller
,
ValueChanged
<
int
>
onSelectedItemChanged
})
{
...
...
packages/flutter/test/cupertino/nav_bar_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/services.dart'
;
...
@@ -801,12 +799,9 @@ void main() {
...
@@ -801,12 +799,9 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
last
,
find
.
byType
(
RepaintBoundary
).
last
,
matches
GoldenFile
(
'nav_bar_test.standard_title.1
.png'
),
matches
SkiaGoldFile
(
'nav_bar_test.standard_title
.png'
),
);
);
},
},
// TODO(xster): remove once https://github.com/flutter/flutter/issues/17483
// is fixed.
skip:
!
Platform
.
isLinux
,
);
);
testWidgets
(
testWidgets
(
...
@@ -835,13 +830,10 @@ void main() {
...
@@ -835,13 +830,10 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
last
,
find
.
byType
(
RepaintBoundary
).
last
,
matches
GoldenFile
(
'nav_bar_test.large_title.1
.png'
),
matches
SkiaGoldFile
(
'nav_bar_test.large_title
.png'
),
);
);
},
},
// TODO(xster): remove once https://github.com/flutter/flutter/issues/17483
);
// is fixed.
skip:
!
Platform
.
isLinux
,
);
testWidgets
(
'NavBar draws a light system bar for a dark background'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'NavBar draws a light system bar for a dark background'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter/test/cupertino/segmented_control_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -1327,9 +1325,9 @@ void main() {
...
@@ -1327,9 +1325,9 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
find
.
byType
(
RepaintBoundary
),
matches
GoldenFile
(
'segmented_control_test.0
.0.png'
),
matches
SkiaGoldFile
(
'segmented_control_test
.0.png'
),
);
);
}
,
skip:
!
Platform
.
isLinux
);
});
testWidgets
(
'Golden Test Pressed State'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Golden Test Pressed State'
,
(
WidgetTester
tester
)
async
{
final
Map
<
int
,
Widget
>
children
=
<
int
,
Widget
>{};
final
Map
<
int
,
Widget
>
children
=
<
int
,
Widget
>{};
...
@@ -1365,7 +1363,7 @@ void main() {
...
@@ -1365,7 +1363,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
find
.
byType
(
RepaintBoundary
),
matches
GoldenFile
(
'segmented_control_test.1.0
.png'
),
matches
SkiaGoldFile
(
'segmented_control_test.1
.png'
),
);
);
}
,
skip:
!
Platform
.
isLinux
);
});
}
}
packages/flutter/test/material/bottom_app_bar_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
...
@@ -73,15 +71,15 @@ void main() {
...
@@ -73,15 +71,15 @@ void main() {
await
pump
(
FloatingActionButtonLocation
.
endDocked
);
await
pump
(
FloatingActionButtonLocation
.
endDocked
);
await
expectLater
(
await
expectLater
(
find
.
byKey
(
key
),
find
.
byKey
(
key
),
matches
Golden
File
(
'bottom_app_bar.custom_shape.1.png'
),
matches
SkiaGold
File
(
'bottom_app_bar.custom_shape.1.png'
),
);
);
await
pump
(
FloatingActionButtonLocation
.
centerDocked
);
await
pump
(
FloatingActionButtonLocation
.
centerDocked
);
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
await
expectLater
(
await
expectLater
(
find
.
byKey
(
key
),
find
.
byKey
(
key
),
matches
Golden
File
(
'bottom_app_bar.custom_shape.2.png'
),
matches
SkiaGold
File
(
'bottom_app_bar.custom_shape.2.png'
),
);
);
}
,
skip:
!
Platform
.
isLinux
);
});
testWidgets
(
'color defaults to Theme.bottomAppBarColor'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'color defaults to Theme.bottomAppBarColor'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
...
packages/flutter/test/material/bottom_app_bar_theme_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -82,8 +80,7 @@ void main() {
...
@@ -82,8 +80,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byKey
(
_painterKey
),
find
.
byKey
(
_painterKey
),
matchesGoldenFile
(
'bottom_app_bar_theme.custom_shape.png'
),
matchesSkiaGoldFile
(
'bottom_app_bar_theme.custom_shape.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
...
packages/flutter/test/material/bottom_navigation_bar_test.dart
View file @
4676c66b
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
;
import
'dart:ui'
;
import
'dart:ui'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -1148,8 +1147,7 @@ void main() {
...
@@ -1148,8 +1147,7 @@ void main() {
await
tester
.
pump
(
const
Duration
(
milliseconds:
30
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
30
));
await
expectLater
(
await
expectLater
(
find
.
byType
(
BottomNavigationBar
),
find
.
byType
(
BottomNavigationBar
),
matchesGoldenFile
(
'bottom_navigation_bar.shifting_transition.2.
$pump
.png'
),
matchesSkiaGoldFile
(
'bottom_navigation_bar.shifting_transition.
$pump
.png'
),
skip:
!
Platform
.
isLinux
,
);
);
}
}
});
});
...
...
packages/flutter/test/material/card_theme_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -139,8 +137,7 @@ void main() {
...
@@ -139,8 +137,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byKey
(
painterKey
),
find
.
byKey
(
painterKey
),
matchesGoldenFile
(
'card_theme.custom_shape.png'
),
matchesSkiaGoldFile
(
'card_theme.custom_shape.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
}
}
...
...
packages/flutter/test/material/dialog_theme_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -132,8 +130,7 @@ void main() {
...
@@ -132,8 +130,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byKey
(
_painterKey
),
find
.
byKey
(
_painterKey
),
matchesGoldenFile
(
'dialog_theme.dialog_with_custom_border.png'
),
matchesSkiaGoldFile
(
'dialog_theme.dialog_with_custom_border.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
...
packages/flutter/test/material/dropdown_test.dart
View file @
4676c66b
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
;
import
'dart:math'
as
math
;
import
'dart:math'
as
math
;
import
'dart:ui'
show
window
;
import
'dart:ui'
show
window
;
...
@@ -141,8 +140,7 @@ void main() {
...
@@ -141,8 +140,7 @@ void main() {
assert
(
tester
.
renderObject
(
buttonFinder
).
attached
);
assert
(
tester
.
renderObject
(
buttonFinder
).
attached
);
await
expectLater
(
await
expectLater
(
find
.
ancestor
(
of:
buttonFinder
,
matching:
find
.
byType
(
RepaintBoundary
)).
first
,
find
.
ancestor
(
of:
buttonFinder
,
matching:
find
.
byType
(
RepaintBoundary
)).
first
,
matchesGoldenFile
(
'dropdown_test.default.0.png'
),
matchesSkiaGoldFile
(
'dropdown_test.default.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
@@ -154,8 +152,7 @@ void main() {
...
@@ -154,8 +152,7 @@ void main() {
assert
(
tester
.
renderObject
(
buttonFinder
).
attached
);
assert
(
tester
.
renderObject
(
buttonFinder
).
attached
);
await
expectLater
(
await
expectLater
(
find
.
ancestor
(
of:
buttonFinder
,
matching:
find
.
byType
(
RepaintBoundary
)).
first
,
find
.
ancestor
(
of:
buttonFinder
,
matching:
find
.
byType
(
RepaintBoundary
)).
first
,
matchesGoldenFile
(
'dropdown_test.expanded.0.png'
),
matchesSkiaGoldFile
(
'dropdown_test.expanded.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
...
packages/flutter/test/material/floating_action_button_test.dart
View file @
4676c66b
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
;
import
'dart:ui'
;
import
'dart:ui'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -681,8 +680,7 @@ void main() {
...
@@ -681,8 +680,7 @@ void main() {
await
tester
.
pump
(
const
Duration
(
milliseconds:
1000
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
1000
));
await
expectLater
(
await
expectLater
(
find
.
byKey
(
key
),
find
.
byKey
(
key
),
matchesGoldenFile
(
'floating_action_button_test.clip.2.png'
),
// .clip.1.png is obsolete and can be removed
matchesSkiaGoldFile
(
'floating_action_button_test.clip.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
...
packages/flutter/test/material/input_decorator_test.dart
View file @
4676c66b
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:async'
;
import
'dart:io'
show
Platform
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
...
@@ -2020,19 +2019,15 @@ void main() {
...
@@ -2020,19 +2019,15 @@ void main() {
await
tester
.
pumpWidget
(
buildFrame
(
TextDirection
.
ltr
));
await
tester
.
pumpWidget
(
buildFrame
(
TextDirection
.
ltr
));
await
expectLater
(
await
expectLater
(
find
.
byType
(
InputDecorator
),
find
.
byType
(
InputDecorator
),
matchesGoldenFile
(
'input_decorator.outline_icon_label.ltr.png'
),
matchesSkiaGoldFile
(
'input_decorator.outline_icon_label.ltr.png'
),
skip:
!
Platform
.
isLinux
,
);
);
await
tester
.
pumpWidget
(
buildFrame
(
TextDirection
.
rtl
));
await
tester
.
pumpWidget
(
buildFrame
(
TextDirection
.
rtl
));
await
expectLater
(
await
expectLater
(
find
.
byType
(
InputDecorator
),
find
.
byType
(
InputDecorator
),
matchesGoldenFile
(
'input_decorator.outline_icon_label.rtl.png'
),
matchesSkiaGoldFile
(
'input_decorator.outline_icon_label.rtl.png'
),
skip:
!
Platform
.
isLinux
,
);
);
},
});
skip:
!
Platform
.
isLinux
,
);
testWidgets
(
'InputDecorationTheme.toString()'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'InputDecorationTheme.toString()'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/19305
// Regression test for https://github.com/flutter/flutter/issues/19305
...
...
packages/flutter/test/material/material_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
...
@@ -618,8 +616,7 @@ void main() {
...
@@ -618,8 +616,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byKey
(
painterKey
),
find
.
byKey
(
painterKey
),
matchesGoldenFile
(
'material.border_paint_above.png'
),
matchesSkiaGoldFile
(
'material.border_paint_above.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
@@ -659,8 +656,7 @@ void main() {
...
@@ -659,8 +656,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byKey
(
painterKey
),
find
.
byKey
(
painterKey
),
matchesGoldenFile
(
'material.border_paint_below.png'
),
matchesSkiaGoldFile
(
'material.border_paint_below.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
});
});
...
...
packages/flutter/test/material/radio_test.dart
View file @
4676c66b
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'dart:ui'
;
import
'dart:ui'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
...
@@ -277,8 +276,7 @@ void main() {
...
@@ -277,8 +276,7 @@ void main() {
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
await
expectLater
(
await
expectLater
(
find
.
byKey
(
painterKey
),
find
.
byKey
(
painterKey
),
matchesGoldenFile
(
'radio.ink_ripple.png'
),
matchesSkiaGoldFile
(
'radio.ink_ripple.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
}
}
...
...
packages/flutter/test/material/tab_bar_theme_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -269,8 +267,7 @@ void main() {
...
@@ -269,8 +267,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byKey
(
_painterKey
),
find
.
byKey
(
_painterKey
),
matchesGoldenFile
(
'tab_bar_theme.tab_indicator_size_tab.png'
),
matchesSkiaGoldFile
(
'tab_bar_theme.tab_indicator_size_tab.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
@@ -281,8 +278,7 @@ void main() {
...
@@ -281,8 +278,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byKey
(
_painterKey
),
find
.
byKey
(
_painterKey
),
matchesGoldenFile
(
'tab_bar_theme.tab_indicator_size_label.png'
),
matchesSkiaGoldFile
(
'tab_bar_theme.tab_indicator_size_label.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
@@ -298,8 +294,7 @@ void main() {
...
@@ -298,8 +294,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byKey
(
_painterKey
),
find
.
byKey
(
_painterKey
),
matchesGoldenFile
(
'tab_bar_theme.custom_tab_indicator.png'
),
matchesSkiaGoldFile
(
'tab_bar_theme.custom_tab_indicator.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
@@ -315,8 +310,7 @@ void main() {
...
@@ -315,8 +310,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byKey
(
_painterKey
),
find
.
byKey
(
_painterKey
),
matchesGoldenFile
(
'tab_bar_theme.beveled_rect_indicator.png'
),
matchesSkiaGoldFile
(
'tab_bar_theme.beveled_rect_indicator.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
}
}
packages/flutter/test/painting/continous_rectangle_border_test.dart
View file @
4676c66b
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -72,8 +71,7 @@ void main() {
...
@@ -72,8 +71,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
find
.
byType
(
RepaintBoundary
),
matchesGoldenFile
(
'continuous_rectangle_border.golden_test_even_radii.png'
),
matchesSkiaGoldFile
(
'continuous_rectangle_border.golden_test_even_radii.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
@@ -94,8 +92,7 @@ void main() {
...
@@ -94,8 +92,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
find
.
byType
(
RepaintBoundary
),
matchesGoldenFile
(
'continuous_rectangle_border.golden_test_varying_radii.png'
),
matchesSkiaGoldFile
(
'continuous_rectangle_border.golden_test_varying_radii.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
@@ -113,8 +110,7 @@ void main() {
...
@@ -113,8 +110,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
find
.
byType
(
RepaintBoundary
),
matchesGoldenFile
(
'continuous_rectangle_border.golden_test_large_radii.png'
),
matchesSkiaGoldFile
(
'continuous_rectangle_border.golden_test_large_radii.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
...
packages/flutter/test/rendering/localized_fonts_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -51,11 +49,9 @@ void main() {
...
@@ -51,11 +49,9 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RichText
),
find
.
byType
(
RichText
),
matches
Golden
File
(
'localized_fonts.rich_text.styled_text_span.png'
),
matches
SkiaGold
File
(
'localized_fonts.rich_text.styled_text_span.png'
),
);
);
},
});
skip:
!
Platform
.
isLinux
,
);
testWidgets
(
testWidgets
(
'Text with locale-specific glyphs, ambient locale'
,
'Text with locale-specific glyphs, ambient locale'
,
...
@@ -103,11 +99,9 @@ void main() {
...
@@ -103,11 +99,9 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
Row
),
find
.
byType
(
Row
),
matches
Golden
File
(
'localized_fonts.text_ambient_locale.chars.png'
),
matches
SkiaGold
File
(
'localized_fonts.text_ambient_locale.chars.png'
),
);
);
},
});
skip:
!
Platform
.
isLinux
,
);
testWidgets
(
testWidgets
(
'Text with locale-specific glyphs, explicit locale'
,
'Text with locale-specific glyphs, explicit locale'
,
...
@@ -147,10 +141,8 @@ void main() {
...
@@ -147,10 +141,8 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
Row
),
find
.
byType
(
Row
),
matches
Golden
File
(
'localized_fonts.text_explicit_locale.chars.png'
),
matches
SkiaGold
File
(
'localized_fonts.text_explicit_locale.chars.png'
),
);
);
},
});
skip:
!
Platform
.
isLinux
,
);
}
}
packages/flutter/test/widgets/backdrop_filter_test.dart
View file @
4676c66b
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
;
import
'dart:ui'
;
import
'dart:ui'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
...
@@ -43,8 +42,7 @@ void main() {
...
@@ -43,8 +42,7 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matchesGoldenFile
(
'backdrop_filter_test.cull_rect.1.png'
),
matchesSkiaGoldFile
(
'backdrop_filter_test.cull_rect.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
}
}
packages/flutter/test/widgets/clip_test.dart
View file @
4676c66b
...
@@ -356,7 +356,7 @@ void main() {
...
@@ -356,7 +356,7 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matches
GoldenFile
(
'clip.ClipRect.1
.png'
),
matches
SkiaGoldFile
(
'clip.ClipRect
.png'
),
);
);
});
});
...
@@ -396,7 +396,7 @@ void main() {
...
@@ -396,7 +396,7 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matches
GoldenFile
(
'clip.ClipRectOverlay.1
.png'
),
matches
SkiaGoldFile
(
'clip.ClipRectOverlay
.png'
),
);
);
});
});
...
@@ -445,7 +445,7 @@ void main() {
...
@@ -445,7 +445,7 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matches
GoldenFile
(
'clip.ClipRRect.1
.png'
),
matches
SkiaGoldFile
(
'clip.ClipRRect
.png'
),
);
);
});
});
...
@@ -488,7 +488,7 @@ void main() {
...
@@ -488,7 +488,7 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matches
GoldenFile
(
'clip.ClipOval.1
.png'
),
matches
SkiaGoldFile
(
'clip.ClipOval
.png'
),
);
);
});
});
...
@@ -536,7 +536,7 @@ void main() {
...
@@ -536,7 +536,7 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matches
GoldenFile
(
'clip.ClipPath.1
.png'
),
matches
SkiaGoldFile
(
'clip.ClipPath
.png'
),
);
);
});
});
...
@@ -581,7 +581,7 @@ void main() {
...
@@ -581,7 +581,7 @@ void main() {
await
tester
.
pumpWidget
(
genPhysicalModel
(
Clip
.
antiAlias
));
await
tester
.
pumpWidget
(
genPhysicalModel
(
Clip
.
antiAlias
));
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matches
GoldenFile
(
'clip.PhysicalModel.antiAlias.1
.png'
),
matches
SkiaGoldFile
(
'clip.PhysicalModel.antiAlias
.png'
),
);
);
});
});
...
@@ -589,7 +589,7 @@ void main() {
...
@@ -589,7 +589,7 @@ void main() {
await
tester
.
pumpWidget
(
genPhysicalModel
(
Clip
.
hardEdge
));
await
tester
.
pumpWidget
(
genPhysicalModel
(
Clip
.
hardEdge
));
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matches
GoldenFile
(
'clip.PhysicalModel.hardEdge.1
.png'
),
matches
SkiaGoldFile
(
'clip.PhysicalModel.hardEdge
.png'
),
);
);
});
});
...
@@ -599,7 +599,7 @@ void main() {
...
@@ -599,7 +599,7 @@ void main() {
await
tester
.
pumpWidget
(
genPhysicalModel
(
Clip
.
antiAliasWithSaveLayer
));
await
tester
.
pumpWidget
(
genPhysicalModel
(
Clip
.
antiAliasWithSaveLayer
));
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matches
Golden
File
(
'clip.PhysicalModel.antiAliasWithSaveLayer.png'
),
matches
SkiaGold
File
(
'clip.PhysicalModel.antiAliasWithSaveLayer.png'
),
);
);
});
});
...
@@ -641,7 +641,7 @@ void main() {
...
@@ -641,7 +641,7 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matches
GoldenFile
(
'clip.PhysicalModel.default.1
.png'
),
matches
SkiaGoldFile
(
'clip.PhysicalModel.default
.png'
),
);
);
});
});
...
@@ -690,7 +690,7 @@ void main() {
...
@@ -690,7 +690,7 @@ void main() {
await
tester
.
pumpWidget
(
genPhysicalShape
(
Clip
.
antiAlias
));
await
tester
.
pumpWidget
(
genPhysicalShape
(
Clip
.
antiAlias
));
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matches
GoldenFile
(
'clip.PhysicalShape.antiAlias.1
.png'
),
matches
SkiaGoldFile
(
'clip.PhysicalShape.antiAlias
.png'
),
);
);
});
});
...
@@ -698,7 +698,7 @@ void main() {
...
@@ -698,7 +698,7 @@ void main() {
await
tester
.
pumpWidget
(
genPhysicalShape
(
Clip
.
hardEdge
));
await
tester
.
pumpWidget
(
genPhysicalShape
(
Clip
.
hardEdge
));
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matches
GoldenFile
(
'clip.PhysicalShape.hardEdge.1
.png'
),
matches
SkiaGoldFile
(
'clip.PhysicalShape.hardEdge
.png'
),
);
);
});
});
...
@@ -706,7 +706,7 @@ void main() {
...
@@ -706,7 +706,7 @@ void main() {
await
tester
.
pumpWidget
(
genPhysicalShape
(
Clip
.
antiAliasWithSaveLayer
));
await
tester
.
pumpWidget
(
genPhysicalShape
(
Clip
.
antiAliasWithSaveLayer
));
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matches
Golden
File
(
'clip.PhysicalShape.antiAliasWithSaveLayer.png'
),
matches
SkiaGold
File
(
'clip.PhysicalShape.antiAliasWithSaveLayer.png'
),
);
);
});
});
...
@@ -752,7 +752,7 @@ void main() {
...
@@ -752,7 +752,7 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matches
GoldenFile
(
'clip.PhysicalShape.default.1
.png'
),
matches
SkiaGoldFile
(
'clip.PhysicalShape.default
.png'
),
);
);
});
});
...
...
packages/flutter/test/widgets/editable_text_cursor_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -92,9 +90,9 @@ void main() {
...
@@ -92,9 +90,9 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byKey
(
const
ValueKey
<
int
>(
1
)),
find
.
byKey
(
const
ValueKey
<
int
>(
1
)),
matches
GoldenFile
(
'editable_text_test.0.3
.png'
),
matches
SkiaGoldFile
(
'editable_text_test.0
.png'
),
);
);
}
,
skip:
!
Platform
.
isLinux
);
});
testWidgets
(
'cursor layout has correct radius'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'cursor layout has correct radius'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
EditableTextState
>
editableTextKey
=
GlobalKey
<
EditableTextState
>();
final
GlobalKey
<
EditableTextState
>
editableTextKey
=
GlobalKey
<
EditableTextState
>();
...
@@ -143,9 +141,9 @@ void main() {
...
@@ -143,9 +141,9 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byKey
(
const
ValueKey
<
int
>(
1
)),
find
.
byKey
(
const
ValueKey
<
int
>(
1
)),
matches
GoldenFile
(
'editable_text_test.1.3
.png'
),
matches
SkiaGoldFile
(
'editable_text_test.1
.png'
),
);
);
}
,
skip:
!
Platform
.
isLinux
);
});
testWidgets
(
'Cursor animates on iOS'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Cursor animates on iOS'
,
(
WidgetTester
tester
)
async
{
final
Widget
widget
=
MaterialApp
(
final
Widget
widget
=
MaterialApp
(
...
...
packages/flutter/test/widgets/invert_colors_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -22,8 +20,7 @@ void main() {
...
@@ -22,8 +20,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
find
.
byType
(
RepaintBoundary
),
matchesGoldenFile
(
'invert_colors_test.0.png'
),
matchesSkiaGoldFile
(
'invert_colors_test.0.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
@@ -41,8 +38,7 @@ void main() {
...
@@ -41,8 +38,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
find
.
byType
(
RepaintBoundary
),
matchesGoldenFile
(
'invert_colors_test.1.png'
),
matchesSkiaGoldFile
(
'invert_colors_test.1.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
}
}
...
...
packages/flutter/test/widgets/list_wheel_scroll_view_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
...
@@ -537,8 +535,7 @@ void main() {
...
@@ -537,8 +535,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byKey
(
const
Key
(
'list_wheel_scroll_view'
)),
find
.
byKey
(
const
Key
(
'list_wheel_scroll_view'
)),
matchesGoldenFile
(
'list_wheel_scroll_view.center_child.magnified.png'
),
matchesSkiaGoldFile
(
'list_wheel_scroll_view.center_child.magnified.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
@@ -592,8 +589,7 @@ void main() {
...
@@ -592,8 +589,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byKey
(
const
Key
(
'list_wheel_scroll_view'
)),
find
.
byKey
(
const
Key
(
'list_wheel_scroll_view'
)),
matchesGoldenFile
(
'list_wheel_scroll_view.curved_wheel.left.png'
),
matchesSkiaGoldFile
(
'list_wheel_scroll_view.curved_wheel.left.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
...
packages/flutter/test/widgets/opacity_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -179,8 +177,7 @@ void main() {
...
@@ -179,8 +177,7 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matchesGoldenFile
(
'opacity_test.offset.1.png'
),
matchesSkiaGoldFile
(
'opacity_test.offset.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
...
packages/flutter/test/widgets/physical_model_test.dart
View file @
4676c66b
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'dart:math'
as
math
show
pi
;
import
'dart:math'
as
math
show
pi
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -111,8 +110,7 @@ void main() {
...
@@ -111,8 +110,7 @@ void main() {
expect
(
exception
.
diagnostics
.
first
.
toString
(),
startsWith
(
'A RenderFlex overflowed by '
));
expect
(
exception
.
diagnostics
.
first
.
toString
(),
startsWith
(
'A RenderFlex overflowed by '
));
await
expectLater
(
await
expectLater
(
find
.
byKey
(
key
),
find
.
byKey
(
key
),
matchesGoldenFile
(
'physical_model_overflow.png'
),
matchesSkiaGoldFile
(
'physical_model_overflow.png'
),
skip:
!
Platform
.
isLinux
,
);
);
});
});
...
...
packages/flutter/test/widgets/shadow_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -25,18 +23,15 @@ void main() {
...
@@ -25,18 +23,15 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
Container
),
find
.
byType
(
Container
),
matches
Golden
File
(
'shadow.BoxDecoration.disabled.png'
),
matches
SkiaGold
File
(
'shadow.BoxDecoration.disabled.png'
),
);
);
debugDisableShadows
=
false
;
debugDisableShadows
=
false
;
tester
.
binding
.
reassembleApplication
();
tester
.
binding
.
reassembleApplication
();
await
tester
.
pump
();
await
tester
.
pump
();
if
(
Platform
.
isLinux
)
{
await
expectLater
(
// TODO(ianh): use the skip argument instead once that doesn't hang, https://github.com/dart-lang/test/issues/830
find
.
byType
(
Container
),
await
expectLater
(
matchesSkiaGoldFile
(
'shadow.BoxDecoration.enabled.png'
),
find
.
byType
(
Container
),
);
matchesGoldenFile
(
'shadow.BoxDecoration.enabled.png'
),
);
// shadows render differently on different platforms
}
debugDisableShadows
=
true
;
debugDisableShadows
=
true
;
});
});
...
@@ -61,11 +56,11 @@ void main() {
...
@@ -61,11 +56,11 @@ void main() {
await
tester
.
pumpWidget
(
build
(
elevation
));
await
tester
.
pumpWidget
(
build
(
elevation
));
await
expectLater
(
await
expectLater
(
find
.
byType
(
Container
),
find
.
byType
(
Container
),
matches
Golden
File
(
'shadow.ShapeDecoration.
$elevation
.png'
),
matches
SkiaGold
File
(
'shadow.ShapeDecoration.
$elevation
.png'
),
);
);
}
}
debugDisableShadows
=
true
;
debugDisableShadows
=
true
;
}
,
skip:
!
Platform
.
isLinux
);
// shadows render differently on different platforms
}
);
testWidgets
(
'Shadows with PhysicalLayer'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Shadows with PhysicalLayer'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -88,18 +83,15 @@ void main() {
...
@@ -88,18 +83,15 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
Container
),
find
.
byType
(
Container
),
matches
GoldenFile
(
'shadow.PhysicalModel.disabled
.png'
),
matches
SkiaGoldFile
(
'shadow.PhysicalModel.disabled.0
.png'
),
);
);
debugDisableShadows
=
false
;
debugDisableShadows
=
false
;
tester
.
binding
.
reassembleApplication
();
tester
.
binding
.
reassembleApplication
();
await
tester
.
pump
();
await
tester
.
pump
();
if
(
Platform
.
isLinux
)
{
await
expectLater
(
// TODO(ianh): use the skip argument instead once that doesn't hang, https://github.com/dart-lang/test/issues/830
find
.
byType
(
Container
),
await
expectLater
(
matchesSkiaGoldFile
(
'shadow.PhysicalModel.enabled.png'
),
find
.
byType
(
Container
),
);
matchesGoldenFile
(
'shadow.PhysicalModel.enabled.png'
),
);
// shadows render differently on different platforms
}
debugDisableShadows
=
true
;
debugDisableShadows
=
true
;
});
});
...
@@ -128,9 +120,9 @@ void main() {
...
@@ -128,9 +120,9 @@ void main() {
await
tester
.
pumpWidget
(
build
(
elevation
.
toDouble
()));
await
tester
.
pumpWidget
(
build
(
elevation
.
toDouble
()));
await
expectLater
(
await
expectLater
(
find
.
byType
(
Container
),
find
.
byType
(
Container
),
matches
GoldenFile
(
'shadow.PhysicalShape.
$elevation
.1
.png'
),
matches
SkiaGoldFile
(
'shadow.PhysicalModel.disabled.1.
$elevation
.png'
),
);
);
}
}
debugDisableShadows
=
true
;
debugDisableShadows
=
true
;
}
,
skip:
!
Platform
.
isLinux
);
// shadows render differently on different platforms
}
);
}
}
packages/flutter/test/widgets/text_golden_test.dart
View file @
4676c66b
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
...
@@ -31,7 +29,7 @@ void main() {
...
@@ -31,7 +29,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
Container
),
find
.
byType
(
Container
),
matches
Golden
File
(
'text_golden.Centered.png'
),
matches
SkiaGold
File
(
'text_golden.Centered.png'
),
);
);
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -55,9 +53,9 @@ void main() {
...
@@ -55,9 +53,9 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
Container
),
find
.
byType
(
Container
),
matches
Golden
File
(
'text_golden.Centered.wrap.png'
),
matches
SkiaGold
File
(
'text_golden.Centered.wrap.png'
),
);
);
}
,
skip:
!
Platform
.
isLinux
);
});
testWidgets
(
'Text Foreground'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Text Foreground'
,
(
WidgetTester
tester
)
async
{
...
@@ -86,7 +84,7 @@ void main() {
...
@@ -86,7 +84,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
find
.
byType
(
RepaintBoundary
),
matches
Golden
File
(
'text_golden.Foreground.gradient.png'
),
matches
SkiaGold
File
(
'text_golden.Foreground.gradient.png'
),
);
);
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -108,7 +106,7 @@ void main() {
...
@@ -108,7 +106,7 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
find
.
byType
(
RepaintBoundary
),
matches
Golden
File
(
'text_golden.Foreground.stroke.png'
),
matches
SkiaGold
File
(
'text_golden.Foreground.stroke.png'
),
);
);
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -131,9 +129,9 @@ void main() {
...
@@ -131,9 +129,9 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
find
.
byType
(
RepaintBoundary
),
matches
Golden
File
(
'text_golden.Foreground.stroke_and_gradient.png'
),
matches
SkiaGold
File
(
'text_golden.Foreground.stroke_and_gradient.png'
),
);
);
}
,
skip:
!
Platform
.
isLinux
);
});
// TODO(garyq): This test requires an update when the background
// TODO(garyq): This test requires an update when the background
// drawing from the beginning of the line bug is fixed. The current
// drawing from the beginning of the line bug is fixed. The current
...
@@ -181,9 +179,9 @@ void main() {
...
@@ -181,9 +179,9 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
find
.
byType
(
RepaintBoundary
),
matches
Golden
File
(
'text_golden.Background.png'
),
matches
SkiaGold
File
(
'text_golden.Background.png'
),
);
);
}
,
skip:
!
Platform
.
isLinux
);
});
testWidgets
(
'Text Fade'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Text Fade'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -217,9 +215,9 @@ void main() {
...
@@ -217,9 +215,9 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
RepaintBoundary
).
first
,
find
.
byType
(
RepaintBoundary
).
first
,
matches
Golden
File
(
'text_golden.Fade.1.png'
),
matches
SkiaGold
File
(
'text_golden.Fade.1.png'
),
);
);
}
,
skip:
!
Platform
.
isLinux
);
});
testWidgets
(
'Default Strut text'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Default Strut text'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -242,10 +240,9 @@ void main() {
...
@@ -242,10 +240,9 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
Container
),
find
.
byType
(
Container
),
matches
Golden
File
(
'text_golden.StrutDefault.png'
),
matches
SkiaGold
File
(
'text_golden.StrutDefault.png'
),
);
);
},
skip:
true
);
// Should only be on linux (skip: !Platform.isLinux).
});
// Disabled for now until font inconsistency is resolved.
testWidgets
(
'Strut text 1'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Strut text 1'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -270,10 +267,9 @@ void main() {
...
@@ -270,10 +267,9 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
Container
),
find
.
byType
(
Container
),
matches
GoldenFile
(
'text_golden.Strut.1
.1.png'
),
matches
SkiaGoldFile
(
'text_golden.Strut
.1.png'
),
);
);
},
skip:
true
);
// Should only be on linux (skip: !Platform.isLinux).
});
// Disabled for now until font inconsistency is resolved.
testWidgets
(
'Strut text 2'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Strut text 2'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -299,10 +295,9 @@ void main() {
...
@@ -299,10 +295,9 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
Container
),
find
.
byType
(
Container
),
matches
GoldenFile
(
'text_golden.Strut.2.1
.png'
),
matches
SkiaGoldFile
(
'text_golden.Strut.2
.png'
),
);
);
},
skip:
true
);
// Should only be on linux (skip: !Platform.isLinux).
});
// Disabled for now until font inconsistency is resolved.
testWidgets
(
'Strut text rich'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Strut text rich'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -351,10 +346,9 @@ void main() {
...
@@ -351,10 +346,9 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
Container
),
find
.
byType
(
Container
),
matches
GoldenFile
(
'text_golden.Strut.3.1
.png'
),
matches
SkiaGoldFile
(
'text_golden.Strut.3
.png'
),
);
);
},
skip:
true
);
// Should only be on linux (skip: !Platform.isLinux).
});
// Disabled for now until font inconsistency is resolved.
testWidgets
(
'Strut text font fallback'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Strut text font fallback'
,
(
WidgetTester
tester
)
async
{
// Font Fallback
// Font Fallback
...
@@ -387,10 +381,9 @@ void main() {
...
@@ -387,10 +381,9 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
Container
),
find
.
byType
(
Container
),
matches
GoldenFile
(
'text_golden.Strut.4.1
.png'
),
matches
SkiaGoldFile
(
'text_golden.Strut.4
.png'
),
);
);
},
skip:
true
);
// Should only be on linux (skip: !Platform.isLinux).
});
// Disabled for now until font inconsistency is resolved.
testWidgets
(
'Strut text rich forceStrutHeight'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Strut text rich forceStrutHeight'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -439,10 +432,9 @@ void main() {
...
@@ -439,10 +432,9 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
Container
),
find
.
byType
(
Container
),
matches
GoldenFile
(
'text_golden.StrutForce.1
.1.png'
),
matches
SkiaGoldFile
(
'text_golden.StrutForce
.1.png'
),
);
);
},
skip:
true
);
// Should only be on linux (skip: !Platform.isLinux).
});
// Disabled for now until font inconsistency is resolved.
testWidgets
(
'Decoration thickness'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Decoration thickness'
,
(
WidgetTester
tester
)
async
{
final
TextDecoration
allDecorations
=
TextDecoration
.
combine
(
final
TextDecoration
allDecorations
=
TextDecoration
.
combine
(
...
@@ -478,9 +470,9 @@ void main() {
...
@@ -478,9 +470,9 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
Container
),
find
.
byType
(
Container
),
matches
GoldenFile
(
'text_golden.Decoration.1.0
.png'
),
matches
SkiaGoldFile
(
'text_golden.Decoration.1
.png'
),
);
);
}
,
skip:
!
Platform
.
isLinux
);
// Coretext uses different thicknesses for decoration
}
);
testWidgets
(
'Decoration thickness'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Decoration thickness'
,
(
WidgetTester
tester
)
async
{
final
TextDecoration
allDecorations
=
TextDecoration
.
combine
(
final
TextDecoration
allDecorations
=
TextDecoration
.
combine
(
...
@@ -517,7 +509,7 @@ void main() {
...
@@ -517,7 +509,7 @@ void main() {
);
);
await
expectLater
(
await
expectLater
(
find
.
byType
(
Container
),
find
.
byType
(
Container
),
matches
GoldenFile
(
'text_golden.DecorationThickness.1.0
.png'
),
matches
SkiaGoldFile
(
'text_golden.DecorationThickness.1
.png'
),
);
);
}
,
skip:
!
Platform
.
isLinux
);
// Coretext uses different thicknesses for decoration
}
);
}
}
packages/flutter/test/widgets/widget_inspector_test.dart
View file @
4676c66b
This diff is collapsed.
Click to expand it.
packages/flutter_goldens/lib/flutter_goldens.dart
View file @
4676c66b
...
@@ -3,16 +3,20 @@
...
@@ -3,16 +3,20 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:async'
;
import
'dart:io'
;
import
'dart:typed_data'
;
import
'dart:typed_data'
;
import
'package:file/file.dart'
;
import
'package:file/file.dart'
;
import
'package:file/local.dart'
;
import
'package:file/local.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'package:test_api/test_api.dart'
as
test_package
show
TestFailure
;
import
'package:flutter_goldens_client/client.dart'
;
import
'package:flutter_goldens_client/client.dart'
;
export
'package:flutter_goldens_client/client.dart'
;
export
'package:flutter_goldens_client/client.dart'
;
const
String
_kFlutterRootKey
=
'FLUTTER_ROOT'
;
/// Main method that can be used in a `flutter_test_config.dart` file to set
/// Main method that can be used in a `flutter_test_config.dart` file to set
/// [goldenFileComparator] to an instance of [FlutterGoldenFileComparator] that
/// [goldenFileComparator] to an instance of [FlutterGoldenFileComparator] that
/// works for the current test.
/// works for the current test.
...
@@ -25,12 +29,12 @@ Future<void> main(FutureOr<void> testMain()) async {
...
@@ -25,12 +29,12 @@ Future<void> main(FutureOr<void> testMain()) async {
///
///
/// Within the https://github.com/flutter/flutter repository, it's important
/// Within the https://github.com/flutter/flutter repository, it's important
/// not to check-in binaries in order to keep the size of the repository to a
/// not to check-in binaries in order to keep the size of the repository to a
/// minimum. To satisfy this requirement, this comparator retrieves the golden
/// minimum. To satisfy this requirement, this comparator uses the
/// files from a sibling repository, `flutter/goldens`.
/// [SkiaGoldClient] to upload widgets for framework-related golden tests and
/// process results.
///
///
/// This comparator will locally clone the `flutter/goldens` repository into
/// This comparator will instantiate the [SkiaGoldClient] and process the
/// the `$FLUTTER_ROOT/bin/cache/pkg/goldens` folder, then perform the comparison against
/// results of the test.
/// the files therein.
class
FlutterGoldenFileComparator
implements
GoldenFileComparator
{
class
FlutterGoldenFileComparator
implements
GoldenFileComparator
{
/// Creates a [FlutterGoldenFileComparator] that will resolve golden file
/// Creates a [FlutterGoldenFileComparator] that will resolve golden file
/// URIs relative to the specified [basedir].
/// URIs relative to the specified [basedir].
...
@@ -49,48 +53,51 @@ class FlutterGoldenFileComparator implements GoldenFileComparator {
...
@@ -49,48 +53,51 @@ class FlutterGoldenFileComparator implements GoldenFileComparator {
@visibleForTesting
@visibleForTesting
final
FileSystem
fs
;
final
FileSystem
fs
;
/// Instance of the [SkiaGoldClient] for executing tests.
final
SkiaGoldClient
_skiaClient
=
SkiaGoldClient
();
/// Creates a new [FlutterGoldenFileComparator] that mirrors the relative
/// Creates a new [FlutterGoldenFileComparator] that mirrors the relative
/// path resolution of the default [goldenFileComparator].
/// path resolution of the default [goldenFileComparator].
///
///
/// By the time the future completes, the clone of the `flutter/goldens`
/// The [defaultComparator] parameter is visible for testing
/// repository is guaranteed to be ready use.
///
/// The [goldens] and [defaultComparator] parameters are visible for testing
/// purposes only.
/// purposes only.
static
Future
<
FlutterGoldenFileComparator
>
fromDefaultComparator
({
static
Future
<
FlutterGoldenFileComparator
>
fromDefaultComparator
({
GoldensClient
goldens
,
LocalFileComparator
defaultComparator
,
LocalFileComparator
defaultComparator
,
})
async
{
})
async
{
defaultComparator
??=
goldenFileComparator
;
defaultComparator
??=
goldenFileComparator
;
// Prepare the goldens repo.
goldens
??=
GoldensClient
();
await
goldens
.
prepare
();
// Calculate the appropriate basedir for the current test context.
// Calculate the appropriate basedir for the current test context.
final
FileSystem
fs
=
goldens
.
fs
;
const
FileSystem
fs
=
LocalFileSystem
()
;
final
Directory
testDirectory
=
fs
.
directory
(
defaultComparator
.
basedir
);
final
Directory
testDirectory
=
fs
.
directory
(
defaultComparator
.
basedir
);
final
String
testDirectoryRelativePath
=
fs
.
path
.
relative
(
testDirectory
.
path
,
from:
goldens
.
flutterRoot
.
path
);
final
Directory
flutterRoot
=
fs
.
directory
(
Platform
.
environment
[
_kFlutterRootKey
]);
return
FlutterGoldenFileComparator
(
goldens
.
repositoryRoot
.
childDirectory
(
testDirectoryRelativePath
).
uri
);
final
Directory
goldenRoot
=
flutterRoot
.
childDirectory
(
fs
.
path
.
join
(
'bin'
,
'cache'
,
'pkg'
,
'goldens'
,
));
final
String
testDirectoryRelativePath
=
fs
.
path
.
relative
(
testDirectory
.
path
,
from:
flutterRoot
.
path
,
);
return
FlutterGoldenFileComparator
(
goldenRoot
.
childDirectory
(
testDirectoryRelativePath
).
uri
);
}
}
@override
@override
Future
<
bool
>
compare
(
Uint8List
imageBytes
,
Uri
golden
)
async
{
Future
<
bool
>
compare
(
Uint8List
imageBytes
,
Uri
golden
)
async
{
final
File
goldenFile
=
_getGoldenFile
(
golden
);
final
File
goldenFile
=
_getGoldenFile
(
golden
);
if
(!
goldenFile
.
existsSync
())
{
if
(!
goldenFile
.
existsSync
())
{
throw
TestFailure
(
'Could not be compared against non-existent file: "
$golden
"'
);
throw
test_package
.
TestFailure
(
'Could not be compared against non-existent file: "
$golden
"'
);
}
final
List
<
int
>
goldenBytes
=
await
goldenFile
.
readAsBytes
();
// TODO(tvolkert): Improve the intelligence of this comparison.
if
(
goldenBytes
.
length
!=
imageBytes
.
length
)
{
return
false
;
}
}
for
(
int
i
=
0
;
i
<
goldenBytes
.
length
;
i
++)
{
final
bool
authorized
=
await
_skiaClient
.
auth
(
fs
.
directory
(
basedir
));
if
(
goldenBytes
[
i
]
!=
imageBytes
[
i
])
{
if
(!
authorized
)
{
return
false
;
// TODO(Piinks): Clean up for final implementation on CI, https://github.com/flutter/flutter/pull/31630
}
return
true
;
//throw test_package.TestFailure('Could not authorize golctl.');
}
}
return
true
;
await
_skiaClient
.
imgtestInit
();
return
await
_skiaClient
.
imgtestAdd
(
golden
.
path
,
goldenFile
);
}
}
@override
@override
...
...
packages/flutter_goldens/test/flutter_goldens_test.dart
View file @
4676c66b
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:io'
as
io
;
import
'dart:typed_data'
;
import
'dart:typed_data'
;
import
'package:file/file.dart'
;
import
'package:file/file.dart'
;
...
@@ -14,49 +13,57 @@ import 'package:platform/platform.dart';
...
@@ -14,49 +13,57 @@ import 'package:platform/platform.dart';
import
'package:process/process.dart'
;
import
'package:process/process.dart'
;
const
String
_kFlutterRoot
=
'/flutter'
;
const
String
_kFlutterRoot
=
'/flutter'
;
const
String
_kRepository
Root
=
'
$_kFlutterRoot
/bin/cache/pkg/goldens'
;
//const String _kGolden
Root = '$_kFlutterRoot/bin/cache/pkg/goldens';
const
String
_kVersionFile
=
'
$_kFlutterRoot
/bin/internal/goldens.version'
;
//
const String _kVersionFile = '$_kFlutterRoot/bin/internal/goldens.version';
const
String
_kGoldensVersion
=
'123456abcdef'
;
//
const String _kGoldensVersion = '123456abcdef';
// TODO(Piinks): Finish testing, https://github.com/flutter/flutter/pull/31630
void
main
(
)
{
void
main
(
)
{
MemoryFileSystem
fs
;
MemoryFileSystem
fs
;
FakePlatform
platform
;
FakePlatform
platform
;
MockProcessManager
process
;
MockProcessManager
process
;
//Directory flutter;
//Directory golden;
setUp
(()
{
setUp
(()
async
{
fs
=
MemoryFileSystem
();
fs
=
MemoryFileSystem
();
platform
=
FakePlatform
(
environment:
<
String
,
String
>{
'FLUTTER_ROOT'
:
_kFlutterRoot
});
platform
=
FakePlatform
(
environment:
<
String
,
String
>{
'FLUTTER_ROOT'
:
_kFlutterRoot
,
// TODO(Piinks): Add other env vars for testing, https://github.com/flutter/flutter/pull/31630
});
process
=
MockProcessManager
();
process
=
MockProcessManager
();
fs
.
directory
(
_kFlutterRoot
).
createSync
(
recursive:
true
);
//flutter = await fs.directory(_kFlutterRoot).create
(recursive: true);
fs
.
directory
(
_kRepositoryRoot
).
createSync
(
recursive:
true
);
//golden = await fs.directory(_kGoldenRoot).create
(recursive: true);
fs
.
file
(
_kVersionFile
).
createSync
(
recursive:
true
);
//
fs.file(_kVersionFile).createSync(recursive: true);
fs
.
file
(
_kVersionFile
).
writeAsStringSync
(
_kGoldensVersion
);
//
fs.file(_kVersionFile).writeAsStringSync(_kGoldensVersion);
});
});
group
(
'
Goldens
Client'
,
()
{
group
(
'
SkiaGold
Client'
,
()
{
GoldensClient
goldens
;
//SkiaGoldClient skiaGold
;
setUp
(()
{
setUp
(()
{
goldens
=
GoldensClient
(
//skiaGold =
SkiaGoldClient
(
fs:
fs
,
fs:
fs
,
platform:
platform
,
platform:
platform
,
process:
process
,
process:
process
,
);
);
});
});
group
(
'prepare'
,
()
{
group
(
'auth'
,
()
{
test
(
'performs minimal work if versions match'
,
()
async
{
// check for successful auth - return true
when
(
process
.
run
(
any
,
workingDirectory:
anyNamed
(
'workingDirectory'
)))
// check for unsuccessful auth - throw NonZeroExitCode
.
thenAnswer
((
_
)
=>
Future
<
io
.
ProcessResult
>.
value
(
io
.
ProcessResult
(
123
,
0
,
_kGoldensVersion
,
''
)));
// check for unavailable auth (not on CI) - return false
await
goldens
.
prepare
();
// check for redundant work
});
// Verify that we only spawned `git rev-parse HEAD`
final
VerificationResult
verifyProcessRun
=
group
(
'init'
,
()
{
verify
(
process
.
run
(
captureAny
,
workingDirectory:
captureAnyNamed
(
'workingDirectory'
)));
// check for successful init - return true
verifyProcessRun
.
called
(
1
);
// check for unsuccessful init - throw NonZeroExitCode
expect
(
verifyProcessRun
.
captured
.
first
,
<
String
>[
'git'
,
'rev-parse'
,
'HEAD'
]);
// Check for redundant work
expect
(
verifyProcessRun
.
captured
.
last
,
_kRepositoryRoot
);
});
});
group
(
'imgtest'
,
()
{
});
});
});
});
...
@@ -74,21 +81,22 @@ void main() {
...
@@ -74,21 +81,22 @@ void main() {
group
(
'fromDefaultComparator'
,
()
{
group
(
'fromDefaultComparator'
,
()
{
test
(
'calculates the basedir correctly'
,
()
async
{
test
(
'calculates the basedir correctly'
,
()
async
{
final
MockGoldensClient
goldens
=
MockGoldens
Client
();
// final MockSkiaGoldClient skiaGold = MockSkiaGold
Client();
final
MockLocalFileComparator
defaultComparator
=
MockLocalFileComparator
();
//
final MockLocalFileComparator defaultComparator = MockLocalFileComparator();
final
Directory
flutterRoot
=
fs
.
directory
(
'/foo'
)..
createSync
(
recursive:
true
);
//
final Directory flutterRoot = fs.directory('/foo')..createSync(recursive: true);
final
Directory
goldens
Root
=
flutterRoot
.
childDirectory
(
'bar'
)..
createSync
(
recursive:
true
);
// final Directory skiaGold
Root = flutterRoot.childDirectory('bar')..createSync(recursive: true);
when
(
goldens
.
fs
).
thenReturn
(
fs
);
// when(skiaGold
.fs).thenReturn(fs);
when
(
goldens
.
flutterRoot
).
thenReturn
(
flutterRoot
);
// when(skiaGold
.flutterRoot).thenReturn(flutterRoot);
when
(
goldens
.
repositoryRoot
).
thenReturn
(
goldens
Root
);
// when(skiaGold.repositoryRoot).thenReturn(skiaGold
Root);
when
(
defaultComparator
.
basedir
).
thenReturn
(
flutterRoot
.
childDirectory
(
'baz'
).
uri
);
//
when(defaultComparator.basedir).thenReturn(flutterRoot.childDirectory('baz').uri);
comparator
=
await
FlutterGoldenFileComparator
.
fromDefaultComparator
(
//
comparator = await FlutterGoldenFileComparator.fromDefaultComparator(
goldens:
goldens
,
defaultComparator:
defaultComparator
);
//
goldens: goldens, defaultComparator: defaultComparator);
expect
(
comparator
.
basedir
,
fs
.
directory
(
'/foo/bar/baz'
).
uri
);
//
expect(comparator.basedir, fs.directory('/foo/bar/baz').uri);
});
});
});
});
group
(
'compare'
,
()
{
group
(
'compare'
,
()
{
test
(
'throws if golden file is not found'
,
()
async
{
test
(
'throws if golden file is not found'
,
()
async
{
try
{
try
{
await
comparator
.
compare
(
Uint8List
.
fromList
(<
int
>[
1
,
2
,
3
]),
Uri
.
parse
(
'test.png'
));
await
comparator
.
compare
(
Uint8List
.
fromList
(<
int
>[
1
,
2
,
3
]),
Uri
.
parse
(
'test.png'
));
...
@@ -98,21 +106,32 @@ void main() {
...
@@ -98,21 +106,32 @@ void main() {
}
}
});
});
test
(
'returns false if golden bytes do not match'
,
()
async
{
// TODO(Piinks): This is currently disabled in flutter_goldens.dart, https://github.com/flutter/flutter/pull/31630
final
File
goldenFile
=
fs
.
file
(
'/path/to/flutter/bin/cache/goldens/test/foo/bar/test.png'
)
// test('throws if goldctl has not been authorized', () async {
..
createSync
(
recursive:
true
);
// // See that preceding test does not leave auth behind [52]
goldenFile
.
writeAsBytesSync
(<
int
>[
4
,
5
,
6
],
flush:
true
);
// try {
final
bool
result
=
await
comparator
.
compare
(
Uint8List
.
fromList
(<
int
>[
1
,
2
,
3
]),
Uri
.
parse
(
'test.png'
));
// await comparator.compare(Uint8List.fromList(<int>[1, 2, 3]), Uri.parse('test.png'));
expect
(
result
,
isFalse
);
// fail('TestFailure expected but not thrown');
});
// } on TestFailure catch (error) {
// expect(error.message, contains('Could not authorize goldctl.'));
test
(
'returns true if golden bytes match'
,
()
async
{
// }
final
File
goldenFile
=
fs
.
file
(
'/path/to/flutter/bin/cache/goldens/test/foo/bar/test.png'
)
// });
..
createSync
(
recursive:
true
);
// TODO(Piinks): Add methods to Mock SkiaGoldClient to inform the comparator and test for proper behavior. See matcher_test.dart for model, https://github.com/flutter/flutter/pull/31630
goldenFile
.
writeAsBytesSync
(<
int
>[
1
,
2
,
3
],
flush:
true
);
// test('returns false if skia gold test fails', () async {
final
bool
result
=
await
comparator
.
compare
(
Uint8List
.
fromList
(<
int
>[
1
,
2
,
3
]),
Uri
.
parse
(
'test.png'
));
// final File goldenFile = fs.file('/path/to/flutter/bin/cache/goldens/test/foo/bar/test.png')
expect
(
result
,
isTrue
);
// ..createSync(recursive: true);
});
// goldenFile.writeAsBytesSync(<int>[4, 5, 6], flush: true);
// final bool result = await comparator.compare(Uint8List.fromList(<int>[1, 2, 3]), Uri.parse('test.png'));
// expect(result, isFalse);
// });
//
// test('returns true if skia gold test passes', () async {
// final File goldenFile = fs.file('/path/to/flutter/bin/cache/goldens/test/foo/bar/test.png')
// ..createSync(recursive: true);
// goldenFile.writeAsBytesSync(<int>[1, 2, 3], flush: true);
// final bool result = await comparator.compare(Uint8List.fromList(<int>[1, 2, 3]), Uri.parse('test.png'));
// expect(result, isTrue);
// });
});
});
group
(
'update'
,
()
{
group
(
'update'
,
()
{
...
@@ -136,5 +155,5 @@ void main() {
...
@@ -136,5 +155,5 @@ void main() {
}
}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
Mock
GoldensClient
extends
Mock
implements
Goldens
Client
{}
class
Mock
SkiaGoldClient
extends
Mock
implements
SkiaGold
Client
{}
class
MockLocalFileComparator
extends
Mock
implements
LocalFileComparator
{}
class
MockLocalFileComparator
extends
Mock
implements
LocalFileComparator
{}
packages/flutter_goldens_client/lib/client.dart
View file @
4676c66b
This diff is collapsed.
Click to expand it.
packages/flutter_test/lib/src/matchers.dart
View file @
4676c66b
...
@@ -318,6 +318,43 @@ AsyncMatcher matchesGoldenFile(dynamic key) {
...
@@ -318,6 +318,43 @@ AsyncMatcher matchesGoldenFile(dynamic key) {
throw
ArgumentError
(
'Unexpected type for golden file:
${key.runtimeType}
'
);
throw
ArgumentError
(
'Unexpected type for golden file:
${key.runtimeType}
'
);
}
}
/// Asserts that a [Finder], [Future<ui.Image>], or [ui.Image] matches the
/// golden image file identified by [key] through Skia Gold.
///
/// For the case of a [Finder], the [Finder] must match exactly one widget and
/// the rendered image of the first [RepaintBoundary] ancestor of the widget is
/// treated as the image for the widget.
///
/// [key] may be either a [Uri] or a [String] representation of a URI.
///
/// This is an asynchronous matcher, meaning that callers should use
/// [expectLater] when using this matcher and await the future returned by
/// [expectLater].
///
/// ## Sample code
///
/// ```dart
/// await expectLater(find.text('Save'), matchesSkiaGoldFile('save.png'));
/// await expectLater(image, matchesSkiaGoldFile('save.png'));
/// await expectLater(imageFuture, matchesSkiaGoldFile('save.png'));
/// ```
///
/// See also:
///
/// * [FlutterGoldenFileComparator], which acts as the backend for this matcher.
/// * [SkiaGoldClient], which the [FlutterGoldenFileComparator] uses to execute
/// and process results of testing with Skia Gold.
/// * [flutter_test] for a discussion of test configurations, whereby callers
/// may swap out the backend for this matcher.
AsyncMatcher
matchesSkiaGoldFile
(
dynamic
key
)
{
if
(
key
is
Uri
)
{
return
_MatchesSkiaGoldFile
(
key
);
}
else
if
(
key
is
String
)
{
return
_MatchesSkiaGoldFile
.
forStringPath
(
key
);
}
throw
ArgumentError
(
'Unexpected type for Skia Gold file:
${key.runtimeType}
'
);
}
/// Asserts that a [Finder], [Future<ui.Image>], or [ui.Image] matches a
/// Asserts that a [Finder], [Future<ui.Image>], or [ui.Image] matches a
/// reference image identified by [image].
/// reference image identified by [image].
///
///
...
@@ -1712,6 +1749,53 @@ class _MatchesGoldenFile extends AsyncMatcher {
...
@@ -1712,6 +1749,53 @@ class _MatchesGoldenFile extends AsyncMatcher {
description
.
add
(
'one widget whose rasterized image matches golden image "
$key
"'
);
description
.
add
(
'one widget whose rasterized image matches golden image "
$key
"'
);
}
}
class
_MatchesSkiaGoldFile
extends
AsyncMatcher
{
const
_MatchesSkiaGoldFile
(
this
.
key
);
_MatchesSkiaGoldFile
.
forStringPath
(
String
path
)
:
key
=
Uri
.
parse
(
path
);
final
Uri
key
;
@override
Future
<
String
>
matchAsync
(
dynamic
item
)
async
{
Future
<
ui
.
Image
>
imageFuture
;
if
(
item
is
Future
<
ui
.
Image
>)
{
imageFuture
=
item
;
}
else
if
(
item
is
ui
.
Image
)
{
imageFuture
=
Future
<
ui
.
Image
>.
value
(
item
);
}
else
{
final
Finder
finder
=
item
;
final
Iterable
<
Element
>
elements
=
finder
.
evaluate
();
if
(
elements
.
isEmpty
)
{
return
'could not be rendered because no widget was found.'
;
}
else
if
(
elements
.
length
>
1
)
{
return
'matched too many widgets.'
;
}
imageFuture
=
_captureImage
(
elements
.
single
);
}
final
TestWidgetsFlutterBinding
binding
=
TestWidgetsFlutterBinding
.
ensureInitialized
();
return
binding
.
runAsync
<
String
>(()
async
{
final
ui
.
Image
image
=
await
imageFuture
;
final
ByteData
bytes
=
await
image
.
toByteData
(
format:
ui
.
ImageByteFormat
.
png
)
.
timeout
(
const
Duration
(
seconds:
10
),
onTimeout:
()
=>
null
);
if
(
bytes
==
null
)
return
'Failed to generate screenshot from engine within the 10,000ms timeout'
;
await
goldenFileComparator
.
update
(
key
,
bytes
.
buffer
.
asUint8List
());
try
{
final
bool
success
=
await
goldenFileComparator
.
compare
(
null
,
key
);
return
success
?
null
:
'Skia Gold test fail.'
;
}
on
TestFailure
catch
(
ex
)
{
return
ex
.
message
;
}
},
additionalTime:
const
Duration
(
seconds:
11
));
}
@override
Description
describe
(
Description
description
)
=>
description
.
add
(
'one widget whose rasterized images matches Skia Gold image
$key
'
);
}
class
_MatchesSemanticsData
extends
Matcher
{
class
_MatchesSemanticsData
extends
Matcher
{
_MatchesSemanticsData
({
_MatchesSemanticsData
({
this
.
label
,
this
.
label
,
...
...
packages/flutter_test/test/matchers_test.dart
View file @
4676c66b
...
@@ -402,6 +402,88 @@ void main() {
...
@@ -402,6 +402,88 @@ void main() {
});
});
});
});
group
(
'matchesSkiaGoldFile'
,
()
{
_FakeComparator
comparator
;
Widget
boilerplate
(
Widget
child
)
{
return
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
child
,
);
}
setUp
(()
{
comparator
=
_FakeComparator
();
goldenFileComparator
=
comparator
;
});
group
(
'matches'
,
()
{
testWidgets
(
'if comparator succeeds'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
boilerplate
(
const
Text
(
'hello'
)));
final
Finder
finder
=
find
.
byType
(
Text
);
await
expectLater
(
finder
,
matchesSkiaGoldFile
(
'foo.png'
));
expect
(
comparator
.
invocation
,
_ComparatorInvocation
.
compare
);
expect
(
comparator
.
imageBytes
,
null
);
expect
(
comparator
.
golden
,
Uri
.
parse
(
'foo.png'
));
});
});
group
(
'does not match'
,
()
{
testWidgets
(
'if comparator returns false'
,
(
WidgetTester
tester
)
async
{
comparator
.
behavior
=
_ComparatorBehavior
.
returnFalse
;
await
tester
.
pumpWidget
(
boilerplate
(
const
Text
(
'hello'
)));
final
Finder
finder
=
find
.
byType
(
Text
);
try
{
await
expectLater
(
finder
,
matchesSkiaGoldFile
(
'foo.png'
));
fail
(
'TestFailure expected but not thrown'
);
}
on
TestFailure
catch
(
error
)
{
expect
(
comparator
.
invocation
,
_ComparatorInvocation
.
compare
);
expect
(
error
.
message
,
contains
(
'does not match'
));
}
});
testWidgets
(
'if comparator throws'
,
(
WidgetTester
tester
)
async
{
comparator
.
behavior
=
_ComparatorBehavior
.
throwTestFailure
;
await
tester
.
pumpWidget
(
boilerplate
(
const
Text
(
'hello'
)));
final
Finder
finder
=
find
.
byType
(
Text
);
try
{
await
expectLater
(
finder
,
matchesSkiaGoldFile
(
'foo.png'
));
fail
(
'TestFailure expected but not thrown'
);
}
on
TestFailure
catch
(
error
)
{
expect
(
comparator
.
invocation
,
_ComparatorInvocation
.
compare
);
expect
(
error
.
message
,
contains
(
'fake message'
));
}
});
testWidgets
(
'if finder finds no widgets'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
boilerplate
(
Container
()));
final
Finder
finder
=
find
.
byType
(
Text
);
try
{
await
expectLater
(
finder
,
matchesSkiaGoldFile
(
'foo.png'
));
fail
(
'TestFailure expected but not thrown'
);
}
on
TestFailure
catch
(
error
)
{
expect
(
comparator
.
invocation
,
isNull
);
expect
(
error
.
message
,
contains
(
'no widget was found'
));
}
});
testWidgets
(
'if finder finds multiple widgets'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
boilerplate
(
Column
(
children:
const
<
Widget
>[
Text
(
'hello'
),
Text
(
'world'
)],
)));
final
Finder
finder
=
find
.
byType
(
Text
);
try
{
await
expectLater
(
finder
,
matchesSkiaGoldFile
(
'foo.png'
));
fail
(
'TestFailure expected but not thrown'
);
}
on
TestFailure
catch
(
error
)
{
expect
(
comparator
.
invocation
,
isNull
);
expect
(
error
.
message
,
contains
(
'too many widgets'
));
}
});
});
});
group
(
'matchesSemanticsData'
,
()
{
group
(
'matchesSemanticsData'
,
()
{
testWidgets
(
'matches SemanticsData'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'matches SemanticsData'
,
(
WidgetTester
tester
)
async
{
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
...
...
packages/flutter_tools/lib/src/commands/update_packages.dart
View file @
4676c66b
...
@@ -6,7 +6,6 @@ import 'dart:async';
...
@@ -6,7 +6,6 @@ import 'dart:async';
import
'dart:collection'
;
import
'dart:collection'
;
import
'package:meta/meta.dart'
;
import
'package:meta/meta.dart'
;
import
'package:flutter_goldens_client/client.dart'
;
import
'../base/common.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/file_system.dart'
;
...
@@ -137,13 +136,14 @@ class UpdatePackagesCommand extends FlutterCommand {
...
@@ -137,13 +136,14 @@ class UpdatePackagesCommand extends FlutterCommand {
// The dev/integration_tests/android_views integration test depends on an assets
// The dev/integration_tests/android_views integration test depends on an assets
// package that is in the goldens repository. We need to make sure that the goldens
// package that is in the goldens repository. We need to make sure that the goldens
// repository is cloned locally before we verify or update pubspecs.
// repository is cloned locally before we verify or update pubspecs.
printStatus
(
'Cloning goldens repository...'
);
// TODO(katelovett): Resolve dependency for android_views living in goldens repository
try
{
// printStatus('Cloning goldens repository...');
final
GoldensClient
goldensClient
=
GoldensClient
();
// try {
await
goldensClient
.
prepare
();
// final GoldensClient goldensClient = GoldensClient();
}
on
NonZeroExitCode
catch
(
e
)
{
// await goldensClient.prepare();
throwToolExit
(
e
.
stderr
,
exitCode:
e
.
exitCode
);
// } on NonZeroExitCode catch (e) {
}
// throwToolExit(e.stderr, exitCode: e.exitCode);
// }
if
(
isVerifyOnly
)
{
if
(
isVerifyOnly
)
{
bool
needsUpdate
=
false
;
bool
needsUpdate
=
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