mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Changes in this patch: - iOS now uses a different scrollDrag constant than Android. - ScrollConfigurationDelegate now knows about target platforms. - ScrollBehaviors now know about target platforms. - RawInputLine now has to be told what platform it's targetting. - PageableList now has a concept of target platform. - make debugPrintStack filter its stack. - move debugPrintStack to `assertions.dart`. - add support for limiting the number of frames to debugPrintStack. - make defaultTargetPlatform default to android in test environments. - remove OverscrollStyle and MaterialApp's overscrollStyle argument. You can now control the overscroll style using Theme.platform. - the default scroll configuration is now private to avoid people relying on the defaultTargetPlatform getter in their subclasses (since they really should use Theme.of(context).platform). - fix some typos I noticed in some tests. - added a test for flinging scrollables, that checks that the behavior differs on the two target platforms. - made flingFrom and fling in the test API pump the frames. - added more docs to the test API. - made the TestAsyncUtils.guard() method report uncaught errors to help debug errors when using that API.
39 lines
1.1 KiB
Dart
39 lines
1.1 KiB
Dart
// 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 'package:flutter/widgets.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
test('BoundedBehavior min scroll offset', () {
|
|
BoundedBehavior behavior = new BoundedBehavior(
|
|
contentExtent: 150.0,
|
|
containerExtent: 75.0,
|
|
minScrollOffset: -100.0,
|
|
platform: TargetPlatform.iOS
|
|
);
|
|
expect(behavior.minScrollOffset, equals(-100.0));
|
|
expect(behavior.maxScrollOffset, equals(-25.0));
|
|
|
|
double scrollOffset = behavior.updateExtents(
|
|
contentExtent: 125.0,
|
|
containerExtent: 50.0,
|
|
scrollOffset: -80.0
|
|
);
|
|
|
|
expect(behavior.minScrollOffset, equals(-100.0));
|
|
expect(behavior.maxScrollOffset, equals(-25.0));
|
|
expect(scrollOffset, equals(-80.0));
|
|
|
|
scrollOffset = behavior.updateExtents(
|
|
minScrollOffset: 50.0,
|
|
scrollOffset: scrollOffset
|
|
);
|
|
|
|
expect(behavior.minScrollOffset, equals(50.0));
|
|
expect(behavior.maxScrollOffset, equals(125.0));
|
|
expect(scrollOffset, equals(50.0));
|
|
});
|
|
}
|