scrollable_dispose_test.dart 1002 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
// Copyright 2016 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 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart';

import 'test_widgets.dart';

void main() {
  testWidgets('simultaneously dispose a widget and end the scroll animation', (WidgetTester tester) async {
12
    final List<Widget> textWidgets = <Widget>[];
13 14
    for (int i = 0; i < 250; i++)
      textWidgets.add(new Text('$i'));
15 16 17 18 19 20 21 22 23
    await tester.pumpWidget(
      new Directionality(
        textDirection: TextDirection.ltr,
        child: new FlipWidget(
          left: new ListView(children: textWidgets),
          right: new Container()
        ),
      ),
    );
24

25
    await tester.fling(find.byType(ListView), const Offset(0.0, -200.0), 1000.0);
26 27
    await tester.pump();

28
    tester.state<FlipWidgetState>(find.byType(FlipWidget)).flip();
29
    await tester.pump(const Duration(hours: 5));
30 31
  });
}