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
0c7fe40e
Commit
0c7fe40e
authored
Mar 06, 2019
by
TruongSinh Tran-Nguyen
Committed by
Michael Goderbauer
Mar 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #19175 How should addTime be used from a test? (#25202)
parent
ec27e045
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
67 deletions
+53
-67
accessibility_test.dart
examples/flutter_gallery/test/accessibility_test.dart
+33
-66
binding.dart
packages/flutter_test/lib/src/binding.dart
+7
-1
widget_tester.dart
packages/flutter_test/lib/src/widget_tester.dart
+13
-0
No files found.
examples/flutter_gallery/test/accessibility_test.dart
View file @
0c7fe40e
...
@@ -488,8 +488,7 @@ void main() {
...
@@ -488,8 +488,7 @@ void main() {
final
String
themeName
=
themeNames
[
themeIndex
];
final
String
themeName
=
themeNames
[
themeIndex
];
testWidgets
(
'backdrop_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'backdrop_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
BackdropDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
BackdropDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -497,8 +496,7 @@ void main() {
...
@@ -497,8 +496,7 @@ void main() {
});
});
testWidgets
(
'bottom_app_bar_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'bottom_app_bar_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
BottomAppBarDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
BottomAppBarDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -506,8 +504,7 @@ void main() {
...
@@ -506,8 +504,7 @@ void main() {
});
});
testWidgets
(
'bottom_navigation_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'bottom_navigation_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
BottomNavigationDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
BottomNavigationDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -515,8 +512,7 @@ void main() {
...
@@ -515,8 +512,7 @@ void main() {
});
});
testWidgets
(
'buttons_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'buttons_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ButtonsDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ButtonsDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -524,8 +520,7 @@ void main() {
...
@@ -524,8 +520,7 @@ void main() {
});
});
testWidgets
(
'cards_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'cards_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
CardsDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
CardsDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -533,8 +528,7 @@ void main() {
...
@@ -533,8 +528,7 @@ void main() {
});
});
testWidgets
(
'chip_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'chip_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ChipDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ChipDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -542,8 +536,7 @@ void main() {
...
@@ -542,8 +536,7 @@ void main() {
},
skip:
true
);
// https://github.com/flutter/flutter/issues/21647
},
skip:
true
);
// https://github.com/flutter/flutter/issues/21647
testWidgets
(
'data_table_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'data_table_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
DataTableDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
DataTableDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -551,8 +544,7 @@ void main() {
...
@@ -551,8 +544,7 @@ void main() {
},
skip:
true
);
// https://github.com/flutter/flutter/issues/21647
},
skip:
true
);
// https://github.com/flutter/flutter/issues/21647
testWidgets
(
'date_and_time_picker_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'date_and_time_picker_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
DateAndTimePickerDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
DateAndTimePickerDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -560,8 +552,7 @@ void main() {
...
@@ -560,8 +552,7 @@ void main() {
},
skip:
true
);
// https://github.com/flutter/flutter/issues/21647
},
skip:
true
);
// https://github.com/flutter/flutter/issues/21647
testWidgets
(
'dialog_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'dialog_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
DialogDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
DialogDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -569,8 +560,7 @@ void main() {
...
@@ -569,8 +560,7 @@ void main() {
});
});
testWidgets
(
'drawer_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'drawer_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
DrawerDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
DrawerDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -578,8 +568,7 @@ void main() {
...
@@ -578,8 +568,7 @@ void main() {
});
});
testWidgets
(
'elevation_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'elevation_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ElevationDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ElevationDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -587,8 +576,7 @@ void main() {
...
@@ -587,8 +576,7 @@ void main() {
});
});
testWidgets
(
'expansion_panels_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'expansion_panels_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ExpansionPanelsDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ExpansionPanelsDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -596,8 +584,7 @@ void main() {
...
@@ -596,8 +584,7 @@ void main() {
});
});
testWidgets
(
'grid_list_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'grid_list_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
const
GridListDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
const
GridListDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -605,8 +592,7 @@ void main() {
...
@@ -605,8 +592,7 @@ void main() {
});
});
testWidgets
(
'icons_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'icons_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
IconsDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
IconsDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -614,8 +600,7 @@ void main() {
...
@@ -614,8 +600,7 @@ void main() {
},
skip:
true
);
// https://github.com/flutter/flutter/issues/21647
},
skip:
true
);
// https://github.com/flutter/flutter/issues/21647
testWidgets
(
'leave_behind_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'leave_behind_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
const
LeaveBehindDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
const
LeaveBehindDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -623,8 +608,7 @@ void main() {
...
@@ -623,8 +608,7 @@ void main() {
});
});
testWidgets
(
'list_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'list_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
const
ListDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
const
ListDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -632,8 +616,7 @@ void main() {
...
@@ -632,8 +616,7 @@ void main() {
});
});
testWidgets
(
'menu_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'menu_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
const
MenuDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
const
MenuDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -641,8 +624,7 @@ void main() {
...
@@ -641,8 +624,7 @@ void main() {
});
});
testWidgets
(
'modal_bottom_sheet_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'modal_bottom_sheet_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ModalBottomSheetDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ModalBottomSheetDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -650,8 +632,7 @@ void main() {
...
@@ -650,8 +632,7 @@ void main() {
});
});
testWidgets
(
'overscroll_demo'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'overscroll_demo'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
OverscrollDemo
()));
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
OverscrollDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -659,8 +640,7 @@ void main() {
...
@@ -659,8 +640,7 @@ void main() {
});
});
testWidgets
(
'page_selector_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'page_selector_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
PageSelectorDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
PageSelectorDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -668,8 +648,7 @@ void main() {
...
@@ -668,8 +648,7 @@ void main() {
});
});
testWidgets
(
'persistent_bottom_sheet_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'persistent_bottom_sheet_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
PersistentBottomSheetDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
PersistentBottomSheetDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -677,8 +656,7 @@ void main() {
...
@@ -677,8 +656,7 @@ void main() {
});
});
testWidgets
(
'progress_indicator_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'progress_indicator_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ProgressIndicatorDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ProgressIndicatorDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -686,8 +664,7 @@ void main() {
...
@@ -686,8 +664,7 @@ void main() {
});
});
testWidgets
(
'reorderable_list_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'reorderable_list_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
const
ReorderableListDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
const
ReorderableListDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -695,8 +672,7 @@ void main() {
...
@@ -695,8 +672,7 @@ void main() {
});
});
testWidgets
(
'scrollable_tabs_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'scrollable_tabs_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ScrollableTabsDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ScrollableTabsDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -704,8 +680,7 @@ void main() {
...
@@ -704,8 +680,7 @@ void main() {
});
});
testWidgets
(
'search_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'search_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
SearchDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
SearchDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -713,8 +688,7 @@ void main() {
...
@@ -713,8 +688,7 @@ void main() {
},
skip:
true
);
// https://github.com/flutter/flutter/issues/21651
},
skip:
true
);
// https://github.com/flutter/flutter/issues/21651
testWidgets
(
'selection_controls_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'selection_controls_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
SelectionControlsDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
SelectionControlsDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -722,8 +696,7 @@ void main() {
...
@@ -722,8 +696,7 @@ void main() {
});
});
testWidgets
(
'slider_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'slider_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
SliderDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
SliderDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -731,8 +704,7 @@ void main() {
...
@@ -731,8 +704,7 @@ void main() {
});
});
testWidgets
(
'snack_bar_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'snack_bar_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
const
SnackBarDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
const
SnackBarDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -740,8 +712,7 @@ void main() {
...
@@ -740,8 +712,7 @@ void main() {
});
});
testWidgets
(
'tabs_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'tabs_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
TabsDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
TabsDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -749,8 +720,7 @@ void main() {
...
@@ -749,8 +720,7 @@ void main() {
});
});
testWidgets
(
'tabs_fab_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'tabs_fab_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
TabsFabDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
TabsFabDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -758,8 +728,7 @@ void main() {
...
@@ -758,8 +728,7 @@ void main() {
});
});
testWidgets
(
'text_form_field_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'text_form_field_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
const
TextFormFieldDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
const
TextFormFieldDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -767,8 +736,7 @@ void main() {
...
@@ -767,8 +736,7 @@ void main() {
});
});
testWidgets
(
'tooltip_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'tooltip_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
TooltipDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
TooltipDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
@@ -776,8 +744,7 @@ void main() {
...
@@ -776,8 +744,7 @@ void main() {
});
});
testWidgets
(
'expansion_tile_list_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'expansion_tile_list_demo
$themeName
'
,
(
WidgetTester
tester
)
async
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
tester
.
binding
;
tester
.
binding
.
addTime
(
const
Duration
(
seconds:
3
));
binding
.
addTime
(
const
Duration
(
seconds:
3
));
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ExpansionTileListDemo
()));
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
theme
,
home:
ExpansionTileListDemo
()));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
await
expectLater
(
tester
,
meetsGuideline
(
textContrastGuideline
));
...
...
packages/flutter_test/lib/src/binding.dart
View file @
0c7fe40e
...
@@ -125,6 +125,11 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
...
@@ -125,6 +125,11 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
@protected
@protected
bool
get
disableShadows
=>
false
;
bool
get
disableShadows
=>
false
;
/// Increase the timeout for the current test by the given duration.
void
addTime
(
Duration
duration
)
{
// Noop, see [AutomatedTestWidgetsFlutterBinding. addTime] for an actual implementation.
}
/// The value to set [debugCheckIntrinsicSizes] to while tests are running.
/// The value to set [debugCheckIntrinsicSizes] to while tests are running.
///
///
/// This can be used to enable additional checks. For example,
/// This can be used to enable additional checks. For example,
...
@@ -843,7 +848,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
...
@@ -843,7 +848,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
_timeoutCompleter
.
completeError
(
_timeoutCompleter
.
completeError
(
TimeoutException
(
TimeoutException
(
'The test exceeded the timeout. It may have hung.
\n
'
'The test exceeded the timeout. It may have hung.
\n
'
'Consider using "addTime" to increase the timeout before expensive operations.'
,
'Consider using "
tester.binding.
addTime" to increase the timeout before expensive operations.'
,
_timeout
,
_timeout
,
),
),
);
);
...
@@ -873,6 +878,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
...
@@ -873,6 +878,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
///
///
/// * [defaultTestTimeout], the maximum that the timeout can reach.
/// * [defaultTestTimeout], the maximum that the timeout can reach.
/// (That timeout is implemented by the test package.)
/// (That timeout is implemented by the test package.)
@override
void
addTime
(
Duration
duration
)
{
void
addTime
(
Duration
duration
)
{
assert
(
_timeout
!=
null
,
'addTime can only be called during a test.'
);
assert
(
_timeout
!=
null
,
'addTime can only be called during a test.'
);
_timeout
+=
duration
;
_timeout
+=
duration
;
...
...
packages/flutter_test/lib/src/widget_tester.dart
View file @
0c7fe40e
...
@@ -49,6 +49,14 @@ typedef WidgetTesterCallback = Future<void> Function(WidgetTester widgetTester);
...
@@ -49,6 +49,14 @@ typedef WidgetTesterCallback = Future<void> Function(WidgetTester widgetTester);
///
///
/// The callback can be asynchronous (using `async`/`await` or
/// The callback can be asynchronous (using `async`/`await` or
/// using explicit [Future]s).
/// using explicit [Future]s).
/// Tests using the [AutomatedTestWidgetsFlutterBinding]
/// have a default time out of two seconds,
/// which is automatically increased for some expensive operations,
/// and can also be manually increased by calling
/// [AutomatedTestWidgetsFlutterBinding.addTime].
/// The maximum that this timeout can reach (automatically or manually increased)
/// is defined by the timeout property,
/// which defaults to [TestWidgetsFlutterBinding.defaultTestTimeout].
///
///
/// This function uses the [test] function in the test package to
/// This function uses the [test] function in the test package to
/// register the given callback as a test. The callback, when run,
/// register the given callback as a test. The callback, when run,
...
@@ -56,6 +64,11 @@ typedef WidgetTesterCallback = Future<void> Function(WidgetTester widgetTester);
...
@@ -56,6 +64,11 @@ typedef WidgetTesterCallback = Future<void> Function(WidgetTester widgetTester);
/// provides convenient widget [Finder]s for use with the
/// provides convenient widget [Finder]s for use with the
/// [WidgetTester].
/// [WidgetTester].
///
///
/// See also:
///
/// * [AutomatedTestWidgetsFlutterBinding.addTime] to learn more about
/// timeout and how to manually increase timeouts.
///
/// ## Sample code
/// ## Sample code
///
///
/// ```dart
/// ```dart
...
...
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