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
f36566fa
Commit
f36566fa
authored
Feb 14, 2017
by
Adam Barth
Committed by
GitHub
Feb 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove snap scrolling test (#8117)
The new scrolling machinery doesn't support snap scrolling.
parent
73518545
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
131 deletions
+0
-131
snap_scrolling_test.dart
packages/flutter/test/widgets/snap_scrolling_test.dart
+0
-131
No files found.
packages/flutter/test/widgets/snap_scrolling_test.dart
deleted
100644 → 0
View file @
73518545
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/widgets.dart'
;
const
double
itemExtent
=
200.0
;
Axis
scrollDirection
=
Axis
.
vertical
;
Widget
buildItem
(
int
item
)
{
return
new
Container
(
width:
itemExtent
,
height:
itemExtent
,
child:
new
Text
(
item
.
toString
())
);
}
double
snapOffsetCallback
(
double
offset
,
Size
size
)
{
return
(
offset
/
itemExtent
).
floor
()
*
itemExtent
;
}
class
TestScrollConfigurationDelegate
extends
ScrollConfigurationDelegate
{
const
TestScrollConfigurationDelegate
();
// Not testing platform-specific fling scrolling, use the default fling
// decleration simulation.
@override
TargetPlatform
get
platform
=>
null
;
@override
ExtentScrollBehavior
createScrollBehavior
()
=>
new
OverscrollWhenScrollableBehavior
(
platform:
platform
);
@override
bool
updateShouldNotify
(
ScrollConfigurationDelegate
old
)
=>
false
;
}
Widget
buildFrame
(
)
{
return
new
ScrollConfiguration
(
delegate:
const
TestScrollConfigurationDelegate
(),
child:
new
Center
(
child:
new
Container
(
height:
itemExtent
*
2.0
,
child:
new
ScrollableList
(
snapOffsetCallback:
snapOffsetCallback
,
scrollDirection:
scrollDirection
,
itemExtent:
itemExtent
,
children:
<
int
>[
0
,
1
,
2
,
3
,
4
,
5
,
7
,
8
,
9
].
map
(
buildItem
)
)
)
)
);
}
void
main
(
)
{
testWidgets
(
'ScrollableList snap scrolling'
,
(
WidgetTester
tester
)
async
{
ScrollableState
getScrollableState
()
=>
tester
.
state
(
find
.
byType
(
Scrollable
));
double
getScrollOffset
()
=>
getScrollableState
().
scrollOffset
;
void
setScrollOffset
(
double
value
)
{
getScrollableState
().
scrollTo
(
value
);
}
Completer
<
Null
>
fling
(
double
velocity
)
{
Completer
<
Null
>
completer
=
new
Completer
<
Null
>();
getScrollableState
().
fling
(
velocity
).
whenComplete
(
completer
.
complete
);
return
completer
;
}
await
tester
.
pumpWidget
(
buildFrame
());
setScrollOffset
(
0.0
);
await
tester
.
pump
();
expect
(
getScrollOffset
(),
0.0
);
Duration
dt
=
const
Duration
(
seconds:
2
);
Completer
<
Null
>
completer
=
fling
(
1000.0
);
expect
(
completer
.
isCompleted
,
isFalse
);
await
tester
.
pump
();
// Start the scheduler at 0.0
await
tester
.
pump
(
dt
);
expect
(
getScrollOffset
(),
closeTo
(
200.0
,
1.0
));
expect
(
completer
.
isCompleted
,
isTrue
);
setScrollOffset
(
0.0
);
await
tester
.
pump
();
expect
(
getScrollOffset
(),
0.0
);
completer
=
fling
(
2000.0
);
expect
(
completer
.
isCompleted
,
isFalse
);
await
tester
.
pump
();
await
tester
.
pump
(
dt
);
expect
(
getScrollOffset
(),
closeTo
(
400.0
,
1.0
));
expect
(
completer
.
isCompleted
,
isTrue
);
setScrollOffset
(
400.0
);
await
tester
.
pump
();
expect
(
getScrollOffset
(),
400.0
);
completer
=
fling
(-
800.0
);
expect
(
completer
.
isCompleted
,
isFalse
);
await
tester
.
pump
();
await
tester
.
pump
(
dt
);
expect
(
getScrollOffset
(),
closeTo
(
0.0
,
1.0
));
expect
(
completer
.
isCompleted
,
isTrue
);
setScrollOffset
(
800.0
);
await
tester
.
pump
();
expect
(
getScrollOffset
(),
800.0
);
completer
=
fling
(-
2000.0
);
expect
(
completer
.
isCompleted
,
isFalse
);
await
tester
.
pump
();
await
tester
.
pump
(
dt
);
expect
(
getScrollOffset
(),
closeTo
(
200.0
,
1.0
));
expect
(
completer
.
isCompleted
,
isTrue
);
setScrollOffset
(
800.0
);
await
tester
.
pump
();
expect
(
getScrollOffset
(),
800.0
);
completer
=
fling
(-
2000.0
);
expect
(
completer
.
isCompleted
,
isFalse
);
await
tester
.
pump
();
await
tester
.
pump
(
dt
);
expect
(
completer
.
isCompleted
,
isTrue
);
expectSync
(
getScrollOffset
(),
closeTo
(
200.0
,
1.0
));
});
}
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