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
8cde68d7
Commit
8cde68d7
authored
Feb 10, 2017
by
Adam Barth
Committed by
GitHub
Feb 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate some tests from Block to ListView (#8055)
parent
63964f48
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
17 deletions
+16
-17
drawer_test.dart
packages/flutter/test/widgets/drawer_test.dart
+2
-2
list_view_misc_test.dart
packages/flutter/test/widgets/list_view_misc_test.dart
+14
-15
No files found.
packages/flutter/test/widgets/drawer_test.dart
View file @
8cde68d7
...
...
@@ -78,7 +78,7 @@ void main() {
home:
new
Scaffold
(
key:
scaffoldKey
,
drawer:
new
Drawer
(
child:
new
Block
(
child:
new
ListView
(
children:
<
Widget
>[
new
Text
(
'drawer'
),
new
Container
(
...
...
@@ -115,7 +115,7 @@ void main() {
await
tester
.
pump
(
const
Duration
(
milliseconds:
10
));
expect
(
textBox
.
localToGlobal
(
Point
.
origin
).
x
,
equals
(
textLeft
));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
50.0
));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
50.0
));
// drawer should be returning to visible
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
...
...
packages/flutter/test/widgets/
block
_test.dart
→
packages/flutter/test/widgets/
list_view_misc
_test.dart
View file @
8cde68d7
...
...
@@ -62,19 +62,19 @@ void main() {
await
gesture
.
up
();
});
testWidgets
(
'
Scroll anchor
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'
ListView reverse
'
,
(
WidgetTester
tester
)
async
{
int
first
=
0
;
int
second
=
0
;
Widget
buildBlock
(
ViewportAnchor
scrollAnchor
)
{
return
new
Block
(
Widget
buildBlock
(
{
bool
reverse:
false
}
)
{
return
new
ListView
(
key:
new
UniqueKey
(),
scrollAnchor:
scrollAnchor
,
reverse:
reverse
,
children:
<
Widget
>[
new
GestureDetector
(
onTap:
()
{
++
first
;
},
child:
new
Container
(
height:
2000.0
,
// more than 600,
the height of the test area
height:
350.0
,
// more than half
the height of the test area
decoration:
const
BoxDecoration
(
backgroundColor:
const
Color
(
0xFF00FF00
)
)
...
...
@@ -83,7 +83,7 @@ void main() {
new
GestureDetector
(
onTap:
()
{
++
second
;
},
child:
new
Container
(
height:
2000.0
,
// more than 600,
the height of the test area
height:
350.0
,
// more than half
the height of the test area
decoration:
const
BoxDecoration
(
backgroundColor:
const
Color
(
0xFF0000FF
)
)
...
...
@@ -93,32 +93,31 @@ void main() {
);
}
await
tester
.
pumpWidget
(
buildBlock
(
ViewportAnchor
.
end
));
await
tester
.
pumpWidget
(
buildBlock
(
reverse:
true
));
Point
target
=
const
Point
(
200.0
,
200.0
);
await
tester
.
tapAt
(
target
);
expect
(
first
,
equals
(
0
));
expect
(
second
,
equals
(
1
));
await
tester
.
pumpWidget
(
buildBlock
(
ViewportAnchor
.
start
));
await
tester
.
pumpWidget
(
buildBlock
(
reverse:
false
));
await
tester
.
tapAt
(
target
);
expect
(
first
,
equals
(
1
));
expect
(
second
,
equals
(
1
));
});
testWidgets
(
'Block scrollableKey'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/4046
// The Block's scrollableKey needs to become its Scrollable descendant's key.
final
GlobalKey
<
ScrollableState
<
Scrollable
>>
key
=
new
GlobalKey
<
ScrollableState
<
Scrollable
>>();
testWidgets
(
'ListView controller'
,
(
WidgetTester
tester
)
async
{
ScrollController
controller
=
new
ScrollController
();
Widget
buildBlock
()
{
return
new
Block
(
scrollableKey:
key
,
return
new
ListView
(
controller:
controller
,
children:
<
Widget
>[
new
Text
(
"A"
),
new
Text
(
"B"
),
new
Text
(
"C"
)]
);
}
await
tester
.
pumpWidget
(
buildBlock
());
expect
(
key
.
currentState
.
scrollOffset
,
0.0
);
expect
(
controller
.
offset
,
equals
(
0.0
)
);
});
testWidgets
(
'SliverBlockChildListDelegate.estimateMaxScrollOffset hits end'
,
(
WidgetTester
tester
)
async
{
...
...
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