
* Manually fix every use of Point.x and Point.y Some of these were moved to dx/dy, but not all. * Manually convert uses of the old gradient API * Remove old reference to Point. * Mechanical changes I applied the following at the root of the Flutter repository: git ls-files -z | xargs -0 sed -i 's/\bPoint[.]origin\b/Offset.zero/g' git ls-files -z | xargs -0 sed -i 's/\bPoint[.]lerp\b/Offset.lerp/g' git ls-files -z | xargs -0 sed -i 's/\bnew Point\b/new Offset/g' git ls-files -z | xargs -0 sed -i 's/\bconst Point\b/const Offset/g' git ls-files -z | xargs -0 sed -i 's/\bstatic Point /static Offset /g' git ls-files -z | xargs -0 sed -i 's/\bfinal Point /final Offset /g' git ls-files -z | xargs -0 sed -i 's/^\( *\)Point /\1Offset /g' git ls-files -z | xargs -0 sed -i 's/ui[.]Point\b/ui.Offset/g' git ls-files -z | xargs -0 sed -i 's/(Point\b/(Offset/g' git ls-files -z | xargs -0 sed -i 's/\([[{,]\) Point\b/\1 Offset/g' git ls-files -z | xargs -0 sed -i 's/@required Point\b/@required Offset/g' git ls-files -z | xargs -0 sed -i 's/<Point>/<Offset>/g' git ls-files -z | xargs -0 sed -i 's/[.]toOffset()//g' git ls-files -z | xargs -0 sed -i 's/[.]toPoint()//g' git ls-files -z | xargs -0 sed -i 's/\bshow Point, /show /g' git ls-files -z | xargs -0 sed -i 's/\bshow Point;/show Offset;/g' * Mechanical changes - dartdocs I applied the following at the root of the Flutter repository: git ls-files -z | xargs -0 sed -i 's/\ba \[Point\]/an [Offset]/g' git ls-files -z | xargs -0 sed -i 's/\[Point\]/[Offset]/g' * Further improvements and a test * Fix minor errors from rebasing... * Roll engine
73 lines
2.1 KiB
Dart
73 lines
2.1 KiB
Dart
// Copyright 2017 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/gestures.dart';
|
|
|
|
import 'gesture_tester.dart';
|
|
|
|
class TestDrag extends Drag {
|
|
}
|
|
|
|
void main() {
|
|
setUp(ensureGestureBinding);
|
|
|
|
testGesture('Should recognize pan', (GestureTester tester) {
|
|
final MultiTapGestureRecognizer tap = new MultiTapGestureRecognizer(longTapDelay: kLongPressTimeout);
|
|
|
|
final List<String> log = <String>[];
|
|
|
|
tap.onTapDown = (int pointer, TapDownDetails details) { log.add('tap-down $pointer'); };
|
|
tap.onTapUp = (int pointer, TapUpDetails details) { log.add('tap-up $pointer'); };
|
|
tap.onTap = (int pointer) { log.add('tap $pointer'); };
|
|
tap.onLongTapDown = (int pointer, TapDownDetails details) { log.add('long-tap-down $pointer'); };
|
|
tap.onTapCancel = (int pointer) { log.add('tap-cancel $pointer'); };
|
|
|
|
|
|
final TestPointer pointer5 = new TestPointer(5);
|
|
final PointerDownEvent down5 = pointer5.down(const Offset(10.0, 10.0));
|
|
tap.addPointer(down5);
|
|
tester.closeArena(5);
|
|
expect(log, <String>['tap-down 5']);
|
|
log.clear();
|
|
tester.route(down5);
|
|
expect(log, isEmpty);
|
|
|
|
final TestPointer pointer6 = new TestPointer(6);
|
|
final PointerDownEvent down6 = pointer6.down(const Offset(15.0, 15.0));
|
|
tap.addPointer(down6);
|
|
tester.closeArena(6);
|
|
expect(log, <String>['tap-down 6']);
|
|
log.clear();
|
|
tester.route(down6);
|
|
expect(log, isEmpty);
|
|
|
|
tester.route(pointer5.move(const Offset(11.0, 12.0)));
|
|
expect(log, isEmpty);
|
|
|
|
tester.route(pointer6.move(const Offset(14.0, 13.0)));
|
|
expect(log, isEmpty);
|
|
|
|
tester.route(pointer5.up());
|
|
expect(log, <String>[
|
|
'tap-up 5',
|
|
'tap 5',
|
|
]);
|
|
log.clear();
|
|
|
|
tester.async.elapse(kLongPressTimeout + kPressTimeout);
|
|
expect(log, <String>['long-tap-down 6']);
|
|
log.clear();
|
|
|
|
tester.route(pointer6.move(const Offset(4.0, 3.0)));
|
|
expect(log, <String>['tap-cancel 6']);
|
|
log.clear();
|
|
|
|
tester.route(pointer6.up());
|
|
expect(log, isEmpty);
|
|
|
|
tap.dispose();
|
|
});
|
|
}
|