mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
* 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
71 lines
1.8 KiB
Dart
71 lines
1.8 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_test/flutter_test.dart';
|
|
import 'package:flutter/gestures.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
void main() {
|
|
testWidgets('Can tap a hyperlink', (WidgetTester tester) async {
|
|
bool didTapLeft = false;
|
|
final TapGestureRecognizer tapLeft = new TapGestureRecognizer()
|
|
..onTap = () {
|
|
didTapLeft = true;
|
|
};
|
|
|
|
bool didTapRight = false;
|
|
final TapGestureRecognizer tapRight = new TapGestureRecognizer()
|
|
..onTap = () {
|
|
didTapRight = true;
|
|
};
|
|
|
|
final Key textKey = const Key('text');
|
|
|
|
await tester.pumpWidget(
|
|
new Center(
|
|
child: new RichText(
|
|
key: textKey,
|
|
text: new TextSpan(
|
|
children: <TextSpan>[
|
|
new TextSpan(
|
|
text: 'xxxxxxxx',
|
|
recognizer: tapLeft
|
|
),
|
|
const TextSpan(text: 'yyyyyyyy'),
|
|
new TextSpan(
|
|
text: 'zzzzzzzzz',
|
|
recognizer: tapRight
|
|
),
|
|
]
|
|
)
|
|
)
|
|
)
|
|
);
|
|
|
|
final RenderBox box = tester.renderObject(find.byKey(textKey));
|
|
|
|
expect(didTapLeft, isFalse);
|
|
expect(didTapRight, isFalse);
|
|
|
|
await tester.tapAt(box.localToGlobal(Offset.zero) + const Offset(2.0, 2.0));
|
|
|
|
expect(didTapLeft, isTrue);
|
|
expect(didTapRight, isFalse);
|
|
|
|
didTapLeft = false;
|
|
|
|
await tester.tapAt(box.localToGlobal(Offset.zero) + const Offset(30.0, 2.0));
|
|
|
|
expect(didTapLeft, isTrue);
|
|
expect(didTapRight, isFalse);
|
|
|
|
didTapLeft = false;
|
|
|
|
await tester.tapAt(box.localToGlobal(new Offset(box.size.width, 0.0)) + const Offset(-2.0, 2.0));
|
|
|
|
expect(didTapLeft, isFalse);
|
|
expect(didTapRight, isTrue);
|
|
});
|
|
}
|