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
986b0174
Commit
986b0174
authored
Apr 21, 2016
by
Hans Muller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gallery Smoke Test (#3446)
* Gallery Smoke Test
parent
161f945e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
43 deletions
+111
-43
page_selector_demo.dart
examples/material_gallery/lib/demo/page_selector_demo.dart
+2
-2
home.dart
examples/material_gallery/lib/gallery/home.dart
+7
-7
smoke_test.dart
examples/material_gallery/test/smoke_test.dart
+101
-33
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+1
-1
No files found.
examples/material_gallery/lib/demo/page_selector_demo.dart
View file @
986b0174
...
...
@@ -40,14 +40,14 @@ class PageSelectorDemo extends StatelessWidget {
icon:
Icons
.
arrow_back
,
color:
color
,
onPressed:
()
{
_handleArrowButtonPress
(
context
,
-
1
);
},
tooltip:
'
B
ack'
tooltip:
'
Page b
ack'
),
new
TabPageSelector
<
IconData
>(),
new
IconButton
(
icon:
Icons
.
arrow_forward
,
color:
color
,
onPressed:
()
{
_handleArrowButtonPress
(
context
,
1
);
},
tooltip:
'
F
orward'
tooltip:
'
Page f
orward'
)
],
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
...
...
examples/material_gallery/lib/gallery/home.dart
View file @
986b0174
...
...
@@ -93,7 +93,7 @@ class GalleryHomeState extends State<GalleryHome> {
appBar:
new
AppBar
(
expandedHeight:
_kFlexibleSpaceMaxHeight
,
flexibleSpace:
new
FlexibleSpaceBar
(
title:
new
Text
(
"Flutter gallery"
),
title:
new
Text
(
'Flutter gallery'
),
background:
new
GalleryHeader
()
)
),
...
...
@@ -104,18 +104,18 @@ class GalleryHomeState extends State<GalleryHome> {
children:
<
Widget
>[
new
TwoLevelSublist
(
leading:
new
Icon
(
icon:
Icons
.
star
),
title:
new
Text
(
"Demos"
),
title:
new
Text
(
'Demos'
),
children:
<
Widget
>[
new
GalleryItem
(
title:
"Weather"
,
builder:
()
=>
new
WeatherDemo
()),
new
GalleryItem
(
title:
"Fitness"
,
builder:
()
=>
new
FitnessDemo
()),
new
GalleryItem
(
title:
"Fancy lines"
,
builder:
()
=>
new
DrawingDemo
()),
new
GalleryItem
(
title:
'Weather'
,
builder:
()
=>
new
WeatherDemo
()),
new
GalleryItem
(
title:
'Fitness'
,
builder:
()
=>
new
FitnessDemo
()),
new
GalleryItem
(
title:
'Fancy lines'
,
builder:
()
=>
new
DrawingDemo
()),
new
GalleryItem
(
title:
'Flexible space toolbar'
,
builder:
()
=>
new
FlexibleSpaceDemo
()),
new
GalleryItem
(
title:
'Floating action button'
,
builder:
()
=>
new
TabsFabDemo
()),
]
),
new
TwoLevelSublist
(
leading:
new
Icon
(
icon:
Icons
.
extension
),
title:
new
Text
(
"Components"
),
title:
new
Text
(
'Components'
),
children:
<
Widget
>[
new
GalleryItem
(
title:
'Buttons'
,
builder:
()
=>
new
ButtonsDemo
()),
new
GalleryItem
(
title:
'Cards'
,
builder:
()
=>
new
CardsDemo
()),
...
...
@@ -147,7 +147,7 @@ class GalleryHomeState extends State<GalleryHome> {
),
new
TwoLevelSublist
(
leading:
new
Icon
(
icon:
Icons
.
color_lens
),
title:
new
Text
(
"Style"
),
title:
new
Text
(
'Style'
),
children:
<
Widget
>[
new
GalleryItem
(
title:
'Colors'
,
builder:
()
=>
new
ColorsDemo
()),
new
GalleryItem
(
title:
'Typography'
,
builder:
()
=>
new
TypographyDemo
()),
...
...
examples/material_gallery/test/smoke_test.dart
View file @
986b0174
...
...
@@ -8,6 +8,77 @@ import 'package:test/test.dart';
import
'../lib/main.dart'
as
material_gallery
;
// Warning: the following strings must be kept in sync with GalleryHome.
const
List
<
String
>
demoCategories
=
const
<
String
>[
'Demos'
,
'Components'
,
'Style'
];
const
List
<
String
>
demoNames
=
const
<
String
>[
'Weather'
,
'Fitness'
,
'Fancy lines'
,
'Flexible space toolbar'
,
'Floating action button'
,
'Buttons'
,
'Cards'
,
'Chips'
,
'Date picker'
,
'Data tables'
,
'Dialog'
,
'Drop-down button'
,
'Expand/collapse list control'
,
'Grid'
,
'Icons'
,
'Leave-behind list items'
,
'List'
,
'Menus'
,
'Modal bottom sheet'
,
'Over-scroll'
,
'Page selector'
,
'Persistent bottom sheet'
,
'Progress indicators'
,
'Scrollable tabs'
,
'Selection controls'
,
'Sliders'
,
'Snackbar'
,
'Tabs'
,
'Text fields'
,
'Time picker'
,
'Tooltips'
,
'Colors'
,
'Typography'
];
Finder
byTooltip
(
WidgetTester
tester
,
String
message
)
{
return
find
.
byElement
((
Element
element
)
{
Widget
widget
=
element
.
widget
;
if
(
widget
is
Tooltip
)
return
widget
.
message
==
message
;
return
false
;
});
}
Finder
findNavigationMenuButton
(
WidgetTester
tester
)
=>
byTooltip
(
tester
,
'Open navigation menu'
);
Finder
findBackButton
(
WidgetTester
tester
)
=>
byTooltip
(
tester
,
'Back'
);
// Start a gallery demo and then go back. This function assumes that the
// we're starting on home route and that the submenu that contains the demo
// called 'name' is already open.
void
smokeDemo
(
WidgetTester
tester
,
String
menuItemText
)
{
// Ensure that we're (likely to be) on the home page
final
Finder
navigationMenuButton
=
findNavigationMenuButton
(
tester
);
expect
(
tester
,
hasWidget
(
navigationMenuButton
));
tester
.
tap
(
find
.
text
(
menuItemText
));
tester
.
pump
();
// Launch the demo.
tester
.
pump
(
const
Duration
(
seconds:
1
));
// Wait until the demo has opened.
// Go back
Finder
backButton
=
findBackButton
(
tester
);
expect
(
tester
,
hasWidget
(
backButton
));
tester
.
tap
(
backButton
);
tester
.
pump
();
// Start the navigator pop "back" operation.
tester
.
pump
(
const
Duration
(
seconds:
1
));
// Wait until it has finished.
}
void
main
(
)
{
test
(
'Material Gallery app smoke test'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
...
...
@@ -15,48 +86,45 @@ void main() {
tester
.
pump
();
// see https://github.com/flutter/flutter/issues/1865
tester
.
pump
();
// triggers a frame
// Try loading Weather demo
tester
.
tap
(
find
.
text
(
'Demos'
));
tester
.
pump
();
tester
.
pump
(
const
Duration
(
seconds:
1
));
// wait til it's really opened
// Expand the demo category submenus.
for
(
String
category
in
demoCategories
.
reversed
)
{
tester
.
tap
(
find
.
text
(
category
));
tester
.
pump
();
tester
.
pump
(
const
Duration
(
seconds:
1
));
// Wait until the menu has expanded.
}
tester
.
tap
(
find
.
text
(
'Weather'
));
tester
.
pump
();
tester
.
pump
(
const
Duration
(
seconds:
1
));
// wait til it's really opened
// Go back
Finder
backButton
=
find
.
byElement
((
Element
element
)
{
Widget
widget
=
element
.
widget
;
if
(
widget
is
Tooltip
)
return
widget
.
message
==
'Back'
;
return
false
;
});
expect
(
tester
,
hasWidget
(
backButton
));
tester
.
tap
(
backButton
);
tester
.
pump
();
// start going back
tester
.
pump
(
const
Duration
(
seconds:
1
));
// wait til it's finished
// Open menu
Finder
navigationMenu
=
find
.
byElement
((
Element
element
)
{
Widget
widget
=
element
.
widget
;
if
(
widget
is
Tooltip
)
return
widget
.
message
==
'Open navigation menu'
;
return
false
;
});
expect
(
tester
,
hasWidget
(
navigationMenu
));
tester
.
tap
(
navigationMenu
);
tester
.
pump
();
// start opening menu
tester
.
pump
(
const
Duration
(
seconds:
1
));
// wait til it's really opened
final
List
<
double
>
scrollDeltas
=
new
List
<
double
>();
double
previousY
=
tester
.
getTopRight
(
find
.
text
(
demoCategories
[
0
])).
y
;
for
(
String
name
in
demoNames
)
{
final
double
y
=
tester
.
getTopRight
(
find
.
text
(
name
)).
y
;
scrollDeltas
.
add
(
previousY
-
y
);
previousY
=
y
;
}
// Launch each demo and then scroll that item out of the way.
for
(
int
i
=
0
;
i
<
demoNames
.
length
;
i
+=
1
)
{
final
String
name
=
demoNames
[
i
];
print
(
"
$name
"
);
smokeDemo
(
tester
,
name
);
tester
.
scroll
(
find
.
text
(
name
),
new
Offset
(
0.0
,
scrollDeltas
[
i
]));
tester
.
pump
();
}
Finder
navigationMenuButton
=
findNavigationMenuButton
(
tester
);
expect
(
tester
,
hasWidget
(
navigationMenuButton
));
tester
.
tap
(
navigationMenuButton
);
tester
.
pump
();
// Start opening drawer.
tester
.
pump
(
const
Duration
(
seconds:
1
));
// Wait until it's really opened.
// switch theme
tester
.
tap
(
find
.
text
(
'Dark'
));
tester
.
pump
();
tester
.
pump
(
const
Duration
(
seconds:
1
));
//
wait til it's changed
tester
.
pump
(
const
Duration
(
seconds:
1
));
//
Wait until it's changed.
// switch theme
tester
.
tap
(
find
.
text
(
'Light'
));
tester
.
pump
();
tester
.
pump
(
const
Duration
(
seconds:
1
));
//
wait til it's changed
tester
.
pump
(
const
Duration
(
seconds:
1
));
//
Wait until it's changed.
});
});
}
packages/flutter/lib/src/material/scaffold.dart
View file @
986b0174
...
...
@@ -215,7 +215,7 @@ class Scaffold extends StatefulWidget {
this
.
scrollableKey
,
this
.
appBarBehavior
:
AppBarBehavior
.
anchor
})
:
super
(
key:
key
)
{
assert
(
(
appBarBehavior
==
AppBarBehavior
.
scroll
)
?
scrollableKey
!=
null
:
true
);
assert
(
scrollableKey
!=
null
?
(
appBarBehavior
!=
AppBarBehavior
.
anchor
)
:
true
);
}
final
AppBar
appBar
;
...
...
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