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
36c63e70
Commit
36c63e70
authored
Feb 09, 2017
by
Ian Hickson
Committed by
GitHub
Feb 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Align the flutter_gallery test to the middle for better results (#8015)
parent
4f05643c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
22 deletions
+12
-22
transitions_perf_test.dart
...es/flutter_gallery/test_driver/transitions_perf_test.dart
+1
-14
driver.dart
packages/flutter_driver/lib/src/driver.dart
+2
-2
extension.dart
packages/flutter_driver/lib/src/extension.dart
+1
-1
gesture.dart
packages/flutter_driver/lib/src/gesture.dart
+8
-5
No files found.
examples/flutter_gallery/test_driver/transitions_perf_test.dart
View file @
36c63e70
...
...
@@ -11,14 +11,6 @@ import 'package:flutter_driver/flutter_driver.dart';
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
// Warning: this list must be kept in sync with the value of
// kAllGalleryItems.map((GalleryItem item) => item.category)).toList();
final
List
<
String
>
demoCategories
=
<
String
>[
'Demos'
,
'Components'
,
'Style'
];
// Warning: this list must be kept in sync with the value of
// kAllGalleryItems.map((GalleryItem item) => item.title).toList();
final
List
<
String
>
demoTitles
=
<
String
>[
...
...
@@ -148,17 +140,12 @@ void main() {
test
(
'all demos'
,
()
async
{
Timeline
timeline
=
await
driver
.
traceAction
(()
async
{
// Expand the demo category submenus.
for
(
String
category
in
demoCategories
.
reversed
)
{
await
driver
.
tap
(
find
.
text
(
category
));
await
new
Future
<
Null
>.
delayed
(
kWaitBetweenActions
);
}
// Scroll each demo menu item into view, launch the demo and
// return to the demo menu 2x.
for
(
String
demoTitle
in
demoTitles
)
{
print
(
'Testing "
$demoTitle
" demo'
);
SerializableFinder
menuItem
=
find
.
text
(
demoTitle
);
await
driver
.
scrollIntoView
(
menuItem
);
await
driver
.
scrollIntoView
(
menuItem
,
alignment:
0.5
);
await
new
Future
<
Null
>.
delayed
(
kWaitBetweenActions
);
for
(
int
i
=
0
;
i
<
2
;
i
+=
1
)
{
...
...
packages/flutter_driver/lib/src/driver.dart
View file @
36c63e70
...
...
@@ -357,8 +357,8 @@ class FlutterDriver {
/// Scrolls the Scrollable ancestor of the widget located by [finder]
/// until the widget is completely visible.
Future
<
Null
>
scrollIntoView
(
SerializableFinder
finder
)
async
{
return
await
_sendCommand
(
new
ScrollIntoView
(
finder
)).
then
((
Map
<
String
,
dynamic
>
_
)
=>
null
);
Future
<
Null
>
scrollIntoView
(
SerializableFinder
finder
,
{
double
alignment:
0.0
}
)
async
{
return
await
_sendCommand
(
new
ScrollIntoView
(
finder
,
alignment:
alignment
)).
then
((
Map
<
String
,
dynamic
>
_
)
=>
null
);
}
/// Returns the text in the `Text` widget located by [finder].
...
...
packages/flutter_driver/lib/src/extension.dart
View file @
36c63e70
...
...
@@ -249,7 +249,7 @@ class _FlutterDriverExtension {
ScrollIntoView
scrollIntoViewCommand
=
command
;
Finder
target
=
await
_waitForElement
(
_createFinder
(
scrollIntoViewCommand
.
finder
));
await
Scrollable
.
ensureVisible
(
target
.
evaluate
().
single
,
duration:
const
Duration
(
milliseconds:
100
));
await
Scrollable2
.
ensureVisible
(
target
.
evaluate
().
single
,
duration:
const
Duration
(
milliseconds:
100
));
await
Scrollable2
.
ensureVisible
(
target
.
evaluate
().
single
,
duration:
const
Duration
(
milliseconds:
100
)
,
alignment:
scrollIntoViewCommand
.
alignment
??
0.0
);
return
new
ScrollResult
();
}
...
...
packages/flutter_driver/lib/src/gesture.dart
View file @
36c63e70
...
...
@@ -95,14 +95,17 @@ class ScrollIntoView extends CommandWithTarget {
/// Creates this command given a [finder] used to locate the widget to be
/// scrolled into view.
ScrollIntoView
(
SerializableFinder
finder
)
:
super
(
finder
);
ScrollIntoView
(
SerializableFinder
finder
,
{
this
.
alignment
:
0.0
}
)
:
super
(
finder
);
/// Deserializes this command from JSON generated by [serialize].
ScrollIntoView
.
deserialize
(
Map
<
String
,
String
>
json
)
:
super
.
deserialize
(
json
);
:
this
.
alignment
=
double
.
parse
(
json
[
'alignment'
]),
super
.
deserialize
(
json
);
final
double
alignment
;
// This is here just to be clear that this command isn't adding any extra
// fields.
@override
Map
<
String
,
String
>
serialize
()
=>
super
.
serialize
();
Map
<
String
,
String
>
serialize
()
=>
super
.
serialize
()..
addAll
(<
String
,
String
>{
'alignment'
:
'
$alignment
'
,
});
}
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