From dbb7c2e8509434996247f251c3dbd479e891f9e6 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Thu, 31 Mar 2016 09:43:54 -0700 Subject: [PATCH] Add a scrolling test now that it passes We fixed this issue a different way but the test is still valuable. --- .../test/widget/scroll_events_test.dart | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/flutter/test/widget/scroll_events_test.dart b/packages/flutter/test/widget/scroll_events_test.dart index 7a127206f2..b5bab6b4f9 100644 --- a/packages/flutter/test/widget/scroll_events_test.dart +++ b/packages/flutter/test/widget/scroll_events_test.dart @@ -136,4 +136,23 @@ void main() { expect(log, equals(['scrollstart', 'scrollend'])); }); }); + + test('fling up ends', () { + testWidgets((WidgetTester tester) { + GlobalKey> scrollKey = new GlobalKey>(); + List log = []; + tester.pumpWidget(_buildScroller(key: scrollKey, log: log)); + + expect(log, equals([])); + tester.flingFrom(new Point(100.0, 100.0), new Offset(50.0, 50.0), 500.0); + tester.pump(new Duration(seconds: 1)); + tester.pump(new Duration(seconds: 1)); + tester.pump(new Duration(seconds: 1)); + expect(log.first, equals('scrollstart')); + expect(log.last, equals('scrollend')); + log.removeWhere((String value) => value == 'scroll'); + expect(log.length, equals(2)); + expect(scrollKey.currentState.scrollOffset, equals(0.0)); + }); + }); }