@@ -48,6 +48,7 @@ public class ScrollAnimatorTest {
48
48
private static final int TOTAL_ITEM_COUNT = 10 ;
49
49
private static final int ANY_FIRST_VISIBLE_ITEM = 2 ;
50
50
private static final int ANY_VISIBLE_ITEM_COUNT = 3 ;
51
+ private static final int ANY_SCROLL_ACTION = 0 ;
51
52
private static final int HIDDEN_Y_POSITION = 0 ;
52
53
private static final int SHOW_Y_POSITION = ANIMATED_VIEW_HEIGHT ;
53
54
@@ -103,6 +104,17 @@ public void shouldNotifyAdditionalScrollListenerOnScroll() {
103
104
verify (mockedScrollListener ).onScroll (listView , ANY_FIRST_VISIBLE_ITEM , ANY_VISIBLE_ITEM_COUNT , TOTAL_ITEM_COUNT );
104
105
}
105
106
107
+ @ Test
108
+ public void shouldNotifyAdditionalScrollListenerOnScrollStateChanged () {
109
+ OnScrollListener mockedScrollListener = mock (OnScrollListener .class );
110
+ scrollAnimator .setAdditionalScrollListener (mockedScrollListener );
111
+ scrollAnimator .configureListView (listView );
112
+
113
+ doAnyScrollAction ();
114
+
115
+ verify (mockedScrollListener ).onScrollStateChanged (listView , ANY_SCROLL_ACTION );
116
+ }
117
+
106
118
@ Test
107
119
public void shouldReleaseListViewScrollListener () {
108
120
scrollAnimator .configureListView (listView );
@@ -152,6 +164,12 @@ private void scrollToAnyPosition(int firstVisibleItem, int visibleItemCount, int
152
164
scrollListener .onScroll (listView , firstVisibleItem , visibleItemCount , totalItemCount );
153
165
}
154
166
167
+ private void doAnyScrollAction () {
168
+ verify (listView ).setOnScrollListener (scrollListenerCaptor .capture ());
169
+ scrollListener = scrollListenerCaptor .getValue ();
170
+ scrollListener .onScrollStateChanged (listView , ANY_SCROLL_ACTION );
171
+ }
172
+
155
173
private void setUpListView () {
156
174
View topChild = mock (View .class );
157
175
when (topChild .getHeight ()).thenReturn (ANIMATED_VIEW_HEIGHT );
0 commit comments