• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2017 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5import 'package:flutter_test/flutter_test.dart';
6import 'package:flutter/widgets.dart';
7
8void main() {
9  test('ClampingScrollSimulation has a stable initial conditions', () {
10    void checkInitialConditions(double position, double velocity) {
11      final ClampingScrollSimulation simulation = ClampingScrollSimulation(position: position, velocity: velocity);
12      expect(simulation.x(0.0), moreOrLessEquals(position));
13      expect(simulation.dx(0.0), moreOrLessEquals(velocity));
14    }
15
16    checkInitialConditions(51.0, 2866.91537);
17    checkInitialConditions(584.0, 2617.294734);
18    checkInitialConditions(345.0, 1982.785934);
19    checkInitialConditions(0.0, 1831.366634);
20    checkInitialConditions(-156.2, 1541.57665);
21    checkInitialConditions(4.0, 1139.250439);
22    checkInitialConditions(4534.0, 1073.553798);
23    checkInitialConditions(75.0, 614.2093);
24    checkInitialConditions(5469.0, 182.114534);
25  });
26}
27