Commit 46291903 authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Declare locals final where not reassigned (tests) (#8566)

parent 27e8cc37
...@@ -13,7 +13,7 @@ void main() { ...@@ -13,7 +13,7 @@ void main() {
}); });
test('Can set value during status callback', () { test('Can set value during status callback', () {
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
vsync: const TestVSync(), vsync: const TestVSync(),
); );
...@@ -45,12 +45,12 @@ void main() { ...@@ -45,12 +45,12 @@ void main() {
}); });
test('Receives status callbacks for forward and reverse', () { test('Receives status callbacks for forward and reverse', () {
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
vsync: const TestVSync(), vsync: const TestVSync(),
); );
List<double> valueLog = <double>[]; final List<double> valueLog = <double>[];
List<AnimationStatus> log = <AnimationStatus>[]; final List<AnimationStatus> log = <AnimationStatus>[];
controller controller
..addStatusListener((AnimationStatus status) { ..addStatusListener((AnimationStatus status) {
log.add(status); log.add(status);
...@@ -108,12 +108,12 @@ void main() { ...@@ -108,12 +108,12 @@ void main() {
}); });
test('Forward and reverse from values', () { test('Forward and reverse from values', () {
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
vsync: const TestVSync(), vsync: const TestVSync(),
); );
List<double> valueLog = <double>[]; final List<double> valueLog = <double>[];
List<AnimationStatus> statusLog = <AnimationStatus>[]; final List<AnimationStatus> statusLog = <AnimationStatus>[];
controller controller
..addStatusListener((AnimationStatus status) { ..addStatusListener((AnimationStatus status) {
statusLog.add(status); statusLog.add(status);
...@@ -136,12 +136,12 @@ void main() { ...@@ -136,12 +136,12 @@ void main() {
}); });
test('Forward only from value', () { test('Forward only from value', () {
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
vsync: const TestVSync(), vsync: const TestVSync(),
); );
List<double> valueLog = <double>[]; final List<double> valueLog = <double>[];
List<AnimationStatus> statusLog = <AnimationStatus>[]; final List<AnimationStatus> statusLog = <AnimationStatus>[];
controller controller
..addStatusListener((AnimationStatus status) { ..addStatusListener((AnimationStatus status) {
statusLog.add(status); statusLog.add(status);
...@@ -157,7 +157,7 @@ void main() { ...@@ -157,7 +157,7 @@ void main() {
}); });
test('Can fling to upper and lower bounds', () { test('Can fling to upper and lower bounds', () {
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
vsync: const TestVSync(), vsync: const TestVSync(),
); );
...@@ -168,7 +168,7 @@ void main() { ...@@ -168,7 +168,7 @@ void main() {
expect(controller.value, 1.0); expect(controller.value, 1.0);
controller.stop(); controller.stop();
AnimationController largeRangeController = new AnimationController( final AnimationController largeRangeController = new AnimationController(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
lowerBound: -30.0, lowerBound: -30.0,
upperBound: 45.0, upperBound: 45.0,
...@@ -187,7 +187,7 @@ void main() { ...@@ -187,7 +187,7 @@ void main() {
}); });
test('lastElapsedDuration control test', () { test('lastElapsedDuration control test', () {
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
vsync: const TestVSync(), vsync: const TestVSync(),
); );
...@@ -200,7 +200,7 @@ void main() { ...@@ -200,7 +200,7 @@ void main() {
}); });
test('toString control test', () { test('toString control test', () {
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
vsync: const TestVSync(), vsync: const TestVSync(),
); );
...@@ -219,7 +219,7 @@ void main() { ...@@ -219,7 +219,7 @@ void main() {
}); });
test('velocity test - linear', () { test('velocity test - linear', () {
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
duration: const Duration(milliseconds: 1000), duration: const Duration(milliseconds: 1000),
vsync: const TestVSync(), vsync: const TestVSync(),
); );
...@@ -262,7 +262,7 @@ void main() { ...@@ -262,7 +262,7 @@ void main() {
}); });
test('Disposed AnimationController toString works', () { test('Disposed AnimationController toString works', () {
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
duration: const Duration(milliseconds: 100), duration: const Duration(milliseconds: 100),
vsync: const TestVSync(), vsync: const TestVSync(),
); );
...@@ -271,7 +271,7 @@ void main() { ...@@ -271,7 +271,7 @@ void main() {
}); });
test('AnimationController error handling', () { test('AnimationController error handling', () {
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
vsync: const TestVSync(), vsync: const TestVSync(),
); );
......
...@@ -28,7 +28,7 @@ void main() { ...@@ -28,7 +28,7 @@ void main() {
expect(curvedAnimation, hasOneLineDescription); expect(curvedAnimation, hasOneLineDescription);
curvedAnimation.reverseCurve = Curves.elasticOut; curvedAnimation.reverseCurve = Curves.elasticOut;
expect(curvedAnimation, hasOneLineDescription); expect(curvedAnimation, hasOneLineDescription);
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
duration: const Duration(milliseconds: 500), duration: const Duration(milliseconds: 500),
vsync: const TestVSync(), vsync: const TestVSync(),
); );
...@@ -45,7 +45,7 @@ void main() { ...@@ -45,7 +45,7 @@ void main() {
}); });
test('ProxyAnimation.toString control test', () { test('ProxyAnimation.toString control test', () {
ProxyAnimation animation = new ProxyAnimation(); final ProxyAnimation animation = new ProxyAnimation();
expect(animation.value, 0.0); expect(animation.value, 0.0);
expect(animation.status, AnimationStatus.dismissed); expect(animation.status, AnimationStatus.dismissed);
expect(animation, hasOneLineDescription); expect(animation, hasOneLineDescription);
...@@ -54,12 +54,12 @@ void main() { ...@@ -54,12 +54,12 @@ void main() {
}); });
test('ProxyAnimation set parent generates value changed', () { test('ProxyAnimation set parent generates value changed', () {
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
vsync: const TestVSync(), vsync: const TestVSync(),
); );
controller.value = 0.5; controller.value = 0.5;
bool didReceiveCallback = false; bool didReceiveCallback = false;
ProxyAnimation animation = new ProxyAnimation() final ProxyAnimation animation = new ProxyAnimation()
..addListener(() { ..addListener(() {
didReceiveCallback = true; didReceiveCallback = true;
}); });
...@@ -73,7 +73,7 @@ void main() { ...@@ -73,7 +73,7 @@ void main() {
}); });
test('ReverseAnimation calls listeners', () { test('ReverseAnimation calls listeners', () {
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
vsync: const TestVSync(), vsync: const TestVSync(),
); );
controller.value = 0.5; controller.value = 0.5;
...@@ -81,7 +81,7 @@ void main() { ...@@ -81,7 +81,7 @@ void main() {
void listener() { void listener() {
didReceiveCallback = true; didReceiveCallback = true;
} }
ReverseAnimation animation = new ReverseAnimation(controller) final ReverseAnimation animation = new ReverseAnimation(controller)
..addListener(listener); ..addListener(listener);
expect(didReceiveCallback, isFalse); expect(didReceiveCallback, isFalse);
controller.value = 0.6; controller.value = 0.6;
...@@ -95,16 +95,16 @@ void main() { ...@@ -95,16 +95,16 @@ void main() {
}); });
test('TrainHoppingAnimation', () { test('TrainHoppingAnimation', () {
AnimationController currentTrain = new AnimationController( final AnimationController currentTrain = new AnimationController(
vsync: const TestVSync(), vsync: const TestVSync(),
); );
AnimationController nextTrain = new AnimationController( final AnimationController nextTrain = new AnimationController(
vsync: const TestVSync(), vsync: const TestVSync(),
); );
currentTrain.value = 0.5; currentTrain.value = 0.5;
nextTrain.value = 0.75; nextTrain.value = 0.75;
bool didSwitchTrains = false; bool didSwitchTrains = false;
TrainHoppingAnimation animation = new TrainHoppingAnimation( final TrainHoppingAnimation animation = new TrainHoppingAnimation(
currentTrain, nextTrain, onSwitchedTrain: () { currentTrain, nextTrain, onSwitchedTrain: () {
didSwitchTrains = true; didSwitchTrains = true;
}); });
...@@ -119,20 +119,20 @@ void main() { ...@@ -119,20 +119,20 @@ void main() {
}); });
test('AnimationMean control test', () { test('AnimationMean control test', () {
AnimationController left = new AnimationController( final AnimationController left = new AnimationController(
value: 0.5, value: 0.5,
vsync: const TestVSync(), vsync: const TestVSync(),
); );
AnimationController right = new AnimationController( final AnimationController right = new AnimationController(
vsync: const TestVSync(), vsync: const TestVSync(),
); );
AnimationMean mean = new AnimationMean(left: left, right: right); final AnimationMean mean = new AnimationMean(left: left, right: right);
expect(mean, hasOneLineDescription); expect(mean, hasOneLineDescription);
expect(mean.value, equals(0.25)); expect(mean.value, equals(0.25));
List<double> log = <double>[]; final List<double> log = <double>[];
void logValue() { void logValue() {
log.add(mean.value); log.add(mean.value);
} }
...@@ -154,10 +154,10 @@ void main() { ...@@ -154,10 +154,10 @@ void main() {
}); });
test('CurvedAnimation with bogus curve', () { test('CurvedAnimation with bogus curve', () {
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
vsync: const TestVSync(), vsync: const TestVSync(),
); );
CurvedAnimation curved = new CurvedAnimation(parent: controller, curve: new BogusCurve()); final CurvedAnimation curved = new CurvedAnimation(parent: controller, curve: new BogusCurve());
expect(() { curved.value; }, throwsFlutterError); expect(() { curved.value; }, throwsFlutterError);
}); });
......
...@@ -17,8 +17,8 @@ void main() { ...@@ -17,8 +17,8 @@ void main() {
}); });
test('Curve flipped control test', () { test('Curve flipped control test', () {
Curve ease = Curves.ease; final Curve ease = Curves.ease;
Curve flippedEase = ease.flipped; final Curve flippedEase = ease.flipped;
expect(flippedEase.transform(0.0), lessThan(0.001)); expect(flippedEase.transform(0.0), lessThan(0.001));
expect(flippedEase.transform(0.5), lessThan(ease.transform(0.5))); expect(flippedEase.transform(0.5), lessThan(ease.transform(0.5)));
expect(flippedEase.transform(1.0), greaterThan(0.999)); expect(flippedEase.transform(1.0), greaterThan(0.999));
...@@ -26,7 +26,7 @@ void main() { ...@@ -26,7 +26,7 @@ void main() {
}); });
test('Threshold has a threshold', () { test('Threshold has a threshold', () {
Curve step = const Threshold(0.25); final Curve step = const Threshold(0.25);
expect(step.transform(0.0), 0.0); expect(step.transform(0.0), 0.0);
expect(step.transform(0.24), 0.0); expect(step.transform(0.24), 0.0);
expect(step.transform(0.25), 1.0); expect(step.transform(0.25), 1.0);
...@@ -55,7 +55,7 @@ void main() { ...@@ -55,7 +55,7 @@ void main() {
}); });
List<double> estimateBounds(Curve curve) { List<double> estimateBounds(Curve curve) {
List<double> values = <double>[]; final List<double> values = <double>[];
values.add(curve.transform(0.0)); values.add(curve.transform(0.0));
values.add(curve.transform(0.1)); values.add(curve.transform(0.1));
...@@ -95,12 +95,12 @@ void main() { ...@@ -95,12 +95,12 @@ void main() {
test('Decelerate does so', () { test('Decelerate does so', () {
expect(Curves.decelerate, hasOneLineDescription); expect(Curves.decelerate, hasOneLineDescription);
List<double> bounds = estimateBounds(Curves.decelerate); final List<double> bounds = estimateBounds(Curves.decelerate);
expect(bounds[0], greaterThanOrEqualTo(0.0)); expect(bounds[0], greaterThanOrEqualTo(0.0));
expect(bounds[1], lessThanOrEqualTo(1.0)); expect(bounds[1], lessThanOrEqualTo(1.0));
double d1 = Curves.decelerate.transform(0.2) - Curves.decelerate.transform(0.0); final double d1 = Curves.decelerate.transform(0.2) - Curves.decelerate.transform(0.0);
double d2 = Curves.decelerate.transform(1.0) - Curves.decelerate.transform(0.8); final double d2 = Curves.decelerate.transform(1.0) - Curves.decelerate.transform(0.8);
expect(d2, lessThan(d1)); expect(d2, lessThan(d1));
}); });
......
...@@ -8,10 +8,10 @@ import 'package:flutter/widgets.dart'; ...@@ -8,10 +8,10 @@ import 'package:flutter/widgets.dart';
void main() { void main() {
test('Can chain tweens', () { test('Can chain tweens', () {
Tween<double> tween = new Tween<double>(begin: 0.30, end: 0.50); final Tween<double> tween = new Tween<double>(begin: 0.30, end: 0.50);
expect(tween, hasOneLineDescription); expect(tween, hasOneLineDescription);
Animatable<double> chain = tween.chain(new Tween<double>(begin: 0.50, end: 1.0)); final Animatable<double> chain = tween.chain(new Tween<double>(begin: 0.50, end: 1.0));
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
vsync: const TestVSync(), vsync: const TestVSync(),
); );
expect(chain.evaluate(controller), 0.40); expect(chain.evaluate(controller), 0.40);
...@@ -19,11 +19,11 @@ void main() { ...@@ -19,11 +19,11 @@ void main() {
}); });
test('Can animated tweens', () { test('Can animated tweens', () {
Tween<double> tween = new Tween<double>(begin: 0.30, end: 0.50); final Tween<double> tween = new Tween<double>(begin: 0.30, end: 0.50);
AnimationController controller = new AnimationController( final AnimationController controller = new AnimationController(
vsync: const TestVSync(), vsync: const TestVSync(),
); );
Animation<double> animation = tween.animate(controller); final Animation<double> animation = tween.animate(controller);
controller.value = 0.50; controller.value = 0.50;
expect(animation.value, 0.40); expect(animation.value, 0.40);
expect(animation, hasOneLineDescription); expect(animation, hasOneLineDescription);
...@@ -31,21 +31,21 @@ void main() { ...@@ -31,21 +31,21 @@ void main() {
}); });
test('SizeTween', () { test('SizeTween', () {
SizeTween tween = new SizeTween(begin: Size.zero, end: const Size(20.0, 30.0)); final SizeTween tween = new SizeTween(begin: Size.zero, end: const Size(20.0, 30.0));
expect(tween.lerp(0.5), equals(const Size(10.0, 15.0))); expect(tween.lerp(0.5), equals(const Size(10.0, 15.0)));
expect(tween, hasOneLineDescription); expect(tween, hasOneLineDescription);
}); });
test('IntTween', () { test('IntTween', () {
IntTween tween = new IntTween(begin: 5, end: 9); final IntTween tween = new IntTween(begin: 5, end: 9);
expect(tween.lerp(0.5), 7); expect(tween.lerp(0.5), 7);
expect(tween.lerp(0.7), 8); expect(tween.lerp(0.7), 8);
}); });
test('RectTween', () { test('RectTween', () {
Rect a = new Rect.fromLTWH(5.0, 3.0, 7.0, 11.0); final Rect a = new Rect.fromLTWH(5.0, 3.0, 7.0, 11.0);
Rect b = new Rect.fromLTWH(8.0, 12.0, 14.0, 18.0); final Rect b = new Rect.fromLTWH(8.0, 12.0, 14.0, 18.0);
RectTween tween = new RectTween(begin: a, end: b); final RectTween tween = new RectTween(begin: a, end: b);
expect(tween.lerp(0.5), equals(Rect.lerp(a, b, 0.5))); expect(tween.lerp(0.5), equals(Rect.lerp(a, b, 0.5)));
expect(tween, hasOneLineDescription); expect(tween, hasOneLineDescription);
}); });
......
...@@ -20,7 +20,7 @@ void main() { ...@@ -20,7 +20,7 @@ void main() {
onPressed: null, onPressed: null,
)) ))
); );
RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton)); final RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton));
expect( expect(
buttonBox.size, buttonBox.size,
// 1 10px character + 16px * 2 is smaller than the 48px minimum. // 1 10px character + 16px * 2 is smaller than the 48px minimum.
...@@ -35,7 +35,7 @@ void main() { ...@@ -35,7 +35,7 @@ void main() {
onPressed: null, onPressed: null,
)) ))
); );
RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton)); final RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton));
expect( expect(
buttonBox.size.width, buttonBox.size.width,
// 4 10px character + 16px * 2 = 72. // 4 10px character + 16px * 2 = 72.
...@@ -49,7 +49,7 @@ void main() { ...@@ -49,7 +49,7 @@ void main() {
onPressed: null, onPressed: null,
color: new Color(0xFFFFFFFF), color: new Color(0xFFFFFFFF),
))); )));
RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton)); final RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton));
expect( expect(
buttonBox.size.width, buttonBox.size.width,
// 1 10px character + 64 * 2 = 138 for buttons with background. // 1 10px character + 64 * 2 = 138 for buttons with background.
...@@ -63,7 +63,7 @@ void main() { ...@@ -63,7 +63,7 @@ void main() {
onPressed: null, onPressed: null,
padding: new EdgeInsets.all(100.0), padding: new EdgeInsets.all(100.0),
))); )));
RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton)); final RenderBox buttonBox = tester.renderObject(find.byType(CupertinoButton));
expect( expect(
buttonBox.size, buttonBox.size,
const Size.square(210.0), const Size.square(210.0),
......
...@@ -69,7 +69,7 @@ void main() { ...@@ -69,7 +69,7 @@ void main() {
child: new Text('Ok'), child: new Text('Ok'),
)); ));
DefaultTextStyle widget = tester.widget(find.byType(DefaultTextStyle)); final DefaultTextStyle widget = tester.widget(find.byType(DefaultTextStyle));
expect(widget.style.color.red, greaterThan(widget.style.color.blue)); expect(widget.style.color.red, greaterThan(widget.style.color.blue));
expect(widget.style.color.alpha, lessThan(255)); expect(widget.style.color.alpha, lessThan(255));
......
...@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
testWidgets('Switch can toggle on tap', (WidgetTester tester) async { testWidgets('Switch can toggle on tap', (WidgetTester tester) async {
Key switchKey = new UniqueKey(); final Key switchKey = new UniqueKey();
bool value = false; bool value = false;
await tester.pumpWidget( await tester.pumpWidget(
new StatefulBuilder( new StatefulBuilder(
......
...@@ -8,7 +8,7 @@ import 'package:test/test.dart'; ...@@ -8,7 +8,7 @@ import 'package:test/test.dart';
void main() { void main() {
test("color accessors should work", () { test("color accessors should work", () {
Color foo = const Color(0x12345678); final Color foo = const Color(0x12345678);
expect(foo.alpha, equals(0x12)); expect(foo.alpha, equals(0x12));
expect(foo.red, equals(0x34)); expect(foo.red, equals(0x34));
expect(foo.green, equals(0x56)); expect(foo.green, equals(0x56));
...@@ -16,16 +16,16 @@ void main() { ...@@ -16,16 +16,16 @@ void main() {
}); });
test("paint set to black", () { test("paint set to black", () {
Color c = const Color(0x00000000); final Color c = const Color(0x00000000);
Paint p = new Paint(); final Paint p = new Paint();
p.color = c; p.color = c;
expect(c.toString(), equals('Color(0x00000000)')); expect(c.toString(), equals('Color(0x00000000)'));
}); });
test("color created with out of bounds value", () { test("color created with out of bounds value", () {
try { try {
Color c = const Color(0x100 << 24); final Color c = const Color(0x100 << 24);
Paint p = new Paint(); final Paint p = new Paint();
p.color = c; p.color = c;
} catch (e) { } catch (e) {
expect(e != null, equals(true)); expect(e != null, equals(true));
...@@ -34,8 +34,8 @@ void main() { ...@@ -34,8 +34,8 @@ void main() {
test("color created with wildly out of bounds value", () { test("color created with wildly out of bounds value", () {
try { try {
Color c = const Color(1 << 1000000); final Color c = const Color(1 << 1000000);
Paint p = new Paint(); final Paint p = new Paint();
p.color = c; p.color = c;
} catch (e) { } catch (e) {
expect(e != null, equals(true)); expect(e != null, equals(true));
......
...@@ -8,9 +8,9 @@ import 'package:test/test.dart'; ...@@ -8,9 +8,9 @@ import 'package:test/test.dart';
void main() { void main() {
test("Should be able to build and layout a paragraph", () { test("Should be able to build and layout a paragraph", () {
ParagraphBuilder builder = new ParagraphBuilder(new ParagraphStyle()); final ParagraphBuilder builder = new ParagraphBuilder(new ParagraphStyle());
builder.addText('Hello'); builder.addText('Hello');
Paragraph paragraph = builder.build(); final Paragraph paragraph = builder.build();
expect(paragraph, isNotNull); expect(paragraph, isNotNull);
paragraph.layout(new ParagraphConstraints(width: 800.0)); paragraph.layout(new ParagraphConstraints(width: 800.0));
......
...@@ -8,7 +8,7 @@ import 'package:test/test.dart'; ...@@ -8,7 +8,7 @@ import 'package:test/test.dart';
void main() { void main() {
test("rect accessors", () { test("rect accessors", () {
Rect r = new Rect.fromLTRB(1.0, 3.0, 5.0, 7.0); final Rect r = new Rect.fromLTRB(1.0, 3.0, 5.0, 7.0);
expect(r.left, equals(1.0)); expect(r.left, equals(1.0));
expect(r.top, equals(3.0)); expect(r.top, equals(3.0));
expect(r.right, equals(5.0)); expect(r.right, equals(5.0));
...@@ -16,7 +16,7 @@ void main() { ...@@ -16,7 +16,7 @@ void main() {
}); });
test("rect created by width and height", () { test("rect created by width and height", () {
Rect r = new Rect.fromLTWH(1.0, 3.0, 5.0, 7.0); final Rect r = new Rect.fromLTWH(1.0, 3.0, 5.0, 7.0);
expect(r.left, equals(1.0)); expect(r.left, equals(1.0));
expect(r.top, equals(3.0)); expect(r.top, equals(3.0));
expect(r.right, equals(6.0)); expect(r.right, equals(6.0));
...@@ -24,14 +24,14 @@ void main() { ...@@ -24,14 +24,14 @@ void main() {
}); });
test("rect intersection", () { test("rect intersection", () {
Rect r1 = new Rect.fromLTRB(0.0, 0.0, 100.0, 100.0); final Rect r1 = new Rect.fromLTRB(0.0, 0.0, 100.0, 100.0);
Rect r2 = new Rect.fromLTRB(50.0, 50.0, 200.0, 200.0); final Rect r2 = new Rect.fromLTRB(50.0, 50.0, 200.0, 200.0);
Rect r3 = r1.intersect(r2); final Rect r3 = r1.intersect(r2);
expect(r3.left, equals(50.0)); expect(r3.left, equals(50.0));
expect(r3.top, equals(50.0)); expect(r3.top, equals(50.0));
expect(r3.right, equals(100.0)); expect(r3.right, equals(100.0));
expect(r3.bottom, equals(100.0)); expect(r3.bottom, equals(100.0));
Rect r4 = r2.intersect(r1); final Rect r4 = r2.intersect(r1);
expect(r4, equals(r3)); expect(r4, equals(r3));
}); });
} }
...@@ -11,7 +11,7 @@ enum _TestEnum { ...@@ -11,7 +11,7 @@ enum _TestEnum {
void main() { void main() {
test('BitField control test', () { test('BitField control test', () {
BitField<_TestEnum> field = new BitField<_TestEnum>(8); final BitField<_TestEnum> field = new BitField<_TestEnum>(8);
expect(field[_TestEnum.d], isFalse); expect(field[_TestEnum.d], isFalse);
...@@ -42,11 +42,11 @@ void main() { ...@@ -42,11 +42,11 @@ void main() {
}); });
test('BitField.filed control test', () { test('BitField.filed control test', () {
BitField<_TestEnum> field1 = new BitField<_TestEnum>.filled(8, true); final BitField<_TestEnum> field1 = new BitField<_TestEnum>.filled(8, true);
expect(field1[_TestEnum.d], isTrue); expect(field1[_TestEnum.d], isTrue);
BitField<_TestEnum> field2 = new BitField<_TestEnum>.filled(8, false); final BitField<_TestEnum> field2 = new BitField<_TestEnum>.filled(8, false);
expect(field2[_TestEnum.d], isFalse); expect(field2[_TestEnum.d], isFalse);
}); });
......
...@@ -21,7 +21,7 @@ void main() { ...@@ -21,7 +21,7 @@ void main() {
}); });
test('The Caching Iterable: length caches', () { test('The Caching Iterable: length caches', () {
Iterable<int> i = new CachingIterable<int>(range(1, 5).iterator); final Iterable<int> i = new CachingIterable<int>(range(1, 5).iterator);
expect(yieldCount, equals(0)); expect(yieldCount, equals(0));
expect(i.length, equals(5)); expect(i.length, equals(5));
expect(yieldCount, equals(5)); expect(yieldCount, equals(5));
...@@ -37,7 +37,7 @@ void main() { ...@@ -37,7 +37,7 @@ void main() {
}); });
test('The Caching Iterable: laziness', () { test('The Caching Iterable: laziness', () {
Iterable<int> i = new CachingIterable<int>(range(1, 5).iterator); final Iterable<int> i = new CachingIterable<int>(range(1, 5).iterator);
expect(yieldCount, equals(0)); expect(yieldCount, equals(0));
expect(i.first, equals(1)); expect(i.first, equals(1));
...@@ -51,10 +51,10 @@ void main() { ...@@ -51,10 +51,10 @@ void main() {
}); });
test('The Caching Iterable: where and map', () { test('The Caching Iterable: where and map', () {
Iterable<int> integers = new CachingIterable<int>(range(1, 5).iterator); final Iterable<int> integers = new CachingIterable<int>(range(1, 5).iterator);
expect(yieldCount, equals(0)); expect(yieldCount, equals(0));
Iterable<int> evens = integers.where((int i) => i % 2 == 0); final Iterable<int> evens = integers.where((int i) => i % 2 == 0);
expect(yieldCount, equals(0)); expect(yieldCount, equals(0));
expect(evens.first, equals(2)); expect(evens.first, equals(2));
...@@ -74,16 +74,16 @@ void main() { ...@@ -74,16 +74,16 @@ void main() {
}); });
test('The Caching Iterable: take and skip', () { test('The Caching Iterable: take and skip', () {
Iterable<int> integers = new CachingIterable<int>(range(1, 5).iterator); final Iterable<int> integers = new CachingIterable<int>(range(1, 5).iterator);
expect(yieldCount, equals(0)); expect(yieldCount, equals(0));
Iterable<int> secondTwo = integers.skip(1).take(2); final Iterable<int> secondTwo = integers.skip(1).take(2);
expect(yieldCount, equals(0)); expect(yieldCount, equals(0));
expect(secondTwo, equals(<int>[2, 3])); expect(secondTwo, equals(<int>[2, 3]));
expect(yieldCount, equals(3)); expect(yieldCount, equals(3));
Iterable<int> result = integers.takeWhile((int i) => i < 4).skipWhile((int i) => i < 3); final Iterable<int> result = integers.takeWhile((int i) => i < 4).skipWhile((int i) => i < 3);
expect(result, equals(<int>[3])); expect(result, equals(<int>[3]));
expect(yieldCount, equals(4)); expect(yieldCount, equals(4));
...@@ -92,16 +92,16 @@ void main() { ...@@ -92,16 +92,16 @@ void main() {
}); });
test('The Caching Iterable: expand', () { test('The Caching Iterable: expand', () {
Iterable<int> integers = new CachingIterable<int>(range(1, 5).iterator); final Iterable<int> integers = new CachingIterable<int>(range(1, 5).iterator);
expect(yieldCount, equals(0)); expect(yieldCount, equals(0));
Iterable<int> expanded1 = integers.expand((int i) => <int>[i, i]); final Iterable<int> expanded1 = integers.expand((int i) => <int>[i, i]);
expect(yieldCount, equals(0)); expect(yieldCount, equals(0));
expect(expanded1, equals(<int>[1, 1, 2, 2, 3, 3, 4, 4, 5, 5])); expect(expanded1, equals(<int>[1, 1, 2, 2, 3, 3, 4, 4, 5, 5]));
expect(yieldCount, equals(5)); expect(yieldCount, equals(5));
Iterable<int> expanded2 = integers.expand((int i) => <int>[i, i]); final Iterable<int> expanded2 = integers.expand((int i) => <int>[i, i]);
expect(yieldCount, equals(5)); expect(yieldCount, equals(5));
expect(expanded2, equals(<int>[1, 1, 2, 2, 3, 3, 4, 4, 5, 5])); expect(expanded2, equals(<int>[1, 1, 2, 2, 3, 3, 4, 4, 5, 5]));
......
...@@ -6,7 +6,7 @@ import 'dart:async'; ...@@ -6,7 +6,7 @@ import 'dart:async';
import 'dart:ui' show VoidCallback; import 'dart:ui' show VoidCallback;
List<String> captureOutput(VoidCallback fn) { List<String> captureOutput(VoidCallback fn) {
List<String> log = <String>[]; final List<String> log = <String>[];
runZoned<Null>(fn, zoneSpecification: new ZoneSpecification( runZoned<Null>(fn, zoneSpecification: new ZoneSpecification(
print: (Zone self, print: (Zone self,
......
...@@ -14,8 +14,8 @@ class A<U extends X> { ...@@ -14,8 +14,8 @@ class A<U extends X> {
void main() { void main() {
test('Assignment through a covariant template throws exception', () { test('Assignment through a covariant template throws exception', () {
A<Y> ay = new A<Y>(); final A<Y> ay = new A<Y>();
A<X> ayAsAx = ay; final A<X> ayAsAx = ay;
expect(() { expect(() {
ayAsAx.u = new X(); ayAsAx.u = new X();
}, throwsAssertionError); }, throwsAssertionError);
......
...@@ -9,7 +9,7 @@ void main() { ...@@ -9,7 +9,7 @@ void main() {
test('LicenseEntryWithLineBreaks - most cases', () { test('LicenseEntryWithLineBreaks - most cases', () {
// There's some trailing spaces in this string. // There's some trailing spaces in this string.
// To avoid IDEs stripping them, I've escaped them as \u0020. // To avoid IDEs stripping them, I've escaped them as \u0020.
List<LicenseParagraph> paragraphs = const LicenseEntryWithLineBreaks(null, ''' final List<LicenseParagraph> paragraphs = const LicenseEntryWithLineBreaks(null, '''
A A
A A
A A
...@@ -183,7 +183,7 @@ S ...@@ -183,7 +183,7 @@ S
yield const LicenseEntryWithLineBreaks(null, 'D'); yield const LicenseEntryWithLineBreaks(null, 'D');
}); });
expect(await LicenseRegistry.licenses.toList(), hasLength(4)); expect(await LicenseRegistry.licenses.toList(), hasLength(4));
List<LicenseEntry> licenses = await LicenseRegistry.licenses.toList(); final List<LicenseEntry> licenses = await LicenseRegistry.licenses.toList();
expect(licenses, hasLength(4)); expect(licenses, hasLength(4));
expect(licenses[0].paragraphs.single.text, 'A'); expect(licenses[0].paragraphs.single.text, 'A');
expect(licenses[1].paragraphs.single.text, 'B'); expect(licenses[1].paragraphs.single.text, 'B');
......
...@@ -57,7 +57,7 @@ class TestServiceExtensionsBinding extends BindingBase ...@@ -57,7 +57,7 @@ class TestServiceExtensionsBinding extends BindingBase
} }
Future<Null> flushMicrotasks() { Future<Null> flushMicrotasks() {
Completer<Null> completer = new Completer<Null>(); final Completer<Null> completer = new Completer<Null>();
new Timer(const Duration(), () { new Timer(const Duration(), () {
completer.complete(); completer.complete();
}); });
...@@ -82,7 +82,7 @@ Future<Map<String, String>> hasReassemble(Future<Map<String, String>> pendingRes ...@@ -82,7 +82,7 @@ Future<Map<String, String>> hasReassemble(Future<Map<String, String>> pendingRes
} }
void main() { void main() {
List<String> console = <String>[]; final List<String> console = <String>[];
test('Service extensions - pretest', () async { test('Service extensions - pretest', () async {
binding = new TestServiceExtensionsBinding(); binding = new TestServiceExtensionsBinding();
......
...@@ -9,7 +9,7 @@ void main() { ...@@ -9,7 +9,7 @@ void main() {
// TODO(8128): These tests and the filtering mechanism should be revisited to account for causal async stack traces. // TODO(8128): These tests and the filtering mechanism should be revisited to account for causal async stack traces.
test('FlutterError.defaultStackFilter', () { test('FlutterError.defaultStackFilter', () {
List<String> filtered = FlutterError.defaultStackFilter(StackTrace.current.toString().trimRight().split('\n')).toList(); final List<String> filtered = FlutterError.defaultStackFilter(StackTrace.current.toString().trimRight().split('\n')).toList();
expect(filtered.length, greaterThanOrEqualTo(4)); expect(filtered.length, greaterThanOrEqualTo(4));
expect(filtered[0], matches(r'^#0 +main\.<anonymous closure> \(.*stack_trace_test\.dart:[0-9]+:[0-9]+\)$')); expect(filtered[0], matches(r'^#0 +main\.<anonymous closure> \(.*stack_trace_test\.dart:[0-9]+:[0-9]+\)$'));
expect(filtered[1], matches(r'^#1 +Declarer\.test\.<anonymous closure>.<anonymous closure> \(package:test/.+:[0-9]+:[0-9]+\)$')); expect(filtered[1], matches(r'^#1 +Declarer\.test\.<anonymous closure>.<anonymous closure> \(package:test/.+:[0-9]+:[0-9]+\)$'));
...@@ -18,7 +18,7 @@ void main() { ...@@ -18,7 +18,7 @@ void main() {
}); });
test('FlutterError.defaultStackFilter (async test body)', () async { test('FlutterError.defaultStackFilter (async test body)', () async {
List<String> filtered = FlutterError.defaultStackFilter(StackTrace.current.toString().trimRight().split('\n')).toList(); final List<String> filtered = FlutterError.defaultStackFilter(StackTrace.current.toString().trimRight().split('\n')).toList();
expect(filtered.length, greaterThanOrEqualTo(3)); expect(filtered.length, greaterThanOrEqualTo(3));
expect(filtered[0], matches(r'^#0 +main\.<anonymous closure> \(.*stack_trace_test\.dart:[0-9]+:[0-9]+\)$')); expect(filtered[0], matches(r'^#0 +main\.<anonymous closure> \(.*stack_trace_test\.dart:[0-9]+:[0-9]+\)$'));
expect(filtered[1], equals('<asynchronous suspension>')); expect(filtered[1], equals('<asynchronous suspension>'));
......
...@@ -9,7 +9,7 @@ import 'package:test/test.dart'; ...@@ -9,7 +9,7 @@ import 'package:test/test.dart';
void main() { void main() {
test('SynchronousFuture control test', () async { test('SynchronousFuture control test', () async {
Future<int> future = new SynchronousFuture<int>(42); final Future<int> future = new SynchronousFuture<int>(42);
int result; int result;
future.then<Null>((int value) { result = value; }); future.then<Null>((int value) { result = value; });
...@@ -17,19 +17,19 @@ void main() { ...@@ -17,19 +17,19 @@ void main() {
expect(result, equals(42)); expect(result, equals(42));
result = null; result = null;
Future<int> futureWithTimeout = future.timeout(const Duration(milliseconds: 1)); final Future<int> futureWithTimeout = future.timeout(const Duration(milliseconds: 1));
futureWithTimeout.then<Null>((int value) { result = value; }); futureWithTimeout.then<Null>((int value) { result = value; });
expect(result, isNull); expect(result, isNull);
await futureWithTimeout; await futureWithTimeout;
expect(result, equals(42)); expect(result, equals(42));
result = null; result = null;
Stream<int> stream = future.asStream(); final Stream<int> stream = future.asStream();
expect(await stream.single, equals(42)); expect(await stream.single, equals(42));
bool ranAction = false; bool ranAction = false;
Future<int> completeResult = future.whenComplete(() { final Future<int> completeResult = future.whenComplete(() {
ranAction = true; ranAction = true;
return new Future<int>.value(31); return new Future<int>.value(31);
}); });
......
...@@ -65,7 +65,7 @@ class GestureTester { ...@@ -65,7 +65,7 @@ class GestureTester {
void main() { void main() {
test('Should win by accepting', () { test('Should win by accepting', () {
GestureTester tester = new GestureTester(); final GestureTester tester = new GestureTester();
tester.addFirst(); tester.addFirst();
tester.addSecond(); tester.addSecond();
tester.arena.close(primaryKey); tester.arena.close(primaryKey);
...@@ -75,7 +75,7 @@ void main() { ...@@ -75,7 +75,7 @@ void main() {
}); });
test('Should win by sweep', () { test('Should win by sweep', () {
GestureTester tester = new GestureTester(); final GestureTester tester = new GestureTester();
tester.addFirst(); tester.addFirst();
tester.addSecond(); tester.addSecond();
tester.arena.close(primaryKey); tester.arena.close(primaryKey);
...@@ -85,7 +85,7 @@ void main() { ...@@ -85,7 +85,7 @@ void main() {
}); });
test('Should win on release after hold sweep release', () { test('Should win on release after hold sweep release', () {
GestureTester tester = new GestureTester(); final GestureTester tester = new GestureTester();
tester.addFirst(); tester.addFirst();
tester.addSecond(); tester.addSecond();
tester.arena.close(primaryKey); tester.arena.close(primaryKey);
...@@ -99,7 +99,7 @@ void main() { ...@@ -99,7 +99,7 @@ void main() {
}); });
test('Should win on sweep after hold release sweep', () { test('Should win on sweep after hold release sweep', () {
GestureTester tester = new GestureTester(); final GestureTester tester = new GestureTester();
tester.addFirst(); tester.addFirst();
tester.addSecond(); tester.addSecond();
tester.arena.close(primaryKey); tester.arena.close(primaryKey);
...@@ -113,7 +113,7 @@ void main() { ...@@ -113,7 +113,7 @@ void main() {
}); });
test('Only first winner should win', () { test('Only first winner should win', () {
GestureTester tester = new GestureTester(); final GestureTester tester = new GestureTester();
tester.addFirst(); tester.addFirst();
tester.addSecond(); tester.addSecond();
tester.arena.close(primaryKey); tester.arena.close(primaryKey);
...@@ -124,7 +124,7 @@ void main() { ...@@ -124,7 +124,7 @@ void main() {
}); });
test('Only first winner should win, regardless of order', () { test('Only first winner should win, regardless of order', () {
GestureTester tester = new GestureTester(); final GestureTester tester = new GestureTester();
tester.addFirst(); tester.addFirst();
tester.addSecond(); tester.addSecond();
tester.arena.close(primaryKey); tester.arena.close(primaryKey);
...@@ -135,7 +135,7 @@ void main() { ...@@ -135,7 +135,7 @@ void main() {
}); });
test('Win before close is delayed to close', () { test('Win before close is delayed to close', () {
GestureTester tester = new GestureTester(); final GestureTester tester = new GestureTester();
tester.addFirst(); tester.addFirst();
tester.addSecond(); tester.addSecond();
tester.expectNothing(); tester.expectNothing();
...@@ -146,7 +146,7 @@ void main() { ...@@ -146,7 +146,7 @@ void main() {
}); });
test('Win before close is delayed to close, and only first winner should win', () { test('Win before close is delayed to close, and only first winner should win', () {
GestureTester tester = new GestureTester(); final GestureTester tester = new GestureTester();
tester.addFirst(); tester.addFirst();
tester.addSecond(); tester.addSecond();
tester.expectNothing(); tester.expectNothing();
...@@ -158,7 +158,7 @@ void main() { ...@@ -158,7 +158,7 @@ void main() {
}); });
test('Win before close is delayed to close, and only first winner should win, regardless of order', () { test('Win before close is delayed to close, and only first winner should win, regardless of order', () {
GestureTester tester = new GestureTester(); final GestureTester tester = new GestureTester();
tester.addFirst(); tester.addFirst();
tester.addSecond(); tester.addSecond();
tester.expectNothing(); tester.expectNothing();
......
...@@ -87,7 +87,7 @@ void main() { ...@@ -87,7 +87,7 @@ void main() {
); );
testGesture('Should recognize double tap', (GestureTester tester) { testGesture('Should recognize double tap', (GestureTester tester) {
DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer(); final DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer();
bool doubleTapRecognized = false; bool doubleTapRecognized = false;
tap.onDoubleTap = () { tap.onDoubleTap = () {
...@@ -120,7 +120,7 @@ void main() { ...@@ -120,7 +120,7 @@ void main() {
}); });
testGesture('Inter-tap distance cancels double tap', (GestureTester tester) { testGesture('Inter-tap distance cancels double tap', (GestureTester tester) {
DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer(); final DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer();
bool doubleTapRecognized = false; bool doubleTapRecognized = false;
tap.onDoubleTap = () { tap.onDoubleTap = () {
...@@ -153,7 +153,7 @@ void main() { ...@@ -153,7 +153,7 @@ void main() {
}); });
testGesture('Intra-tap distance cancels double tap', (GestureTester tester) { testGesture('Intra-tap distance cancels double tap', (GestureTester tester) {
DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer(); final DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer();
bool doubleTapRecognized = false; bool doubleTapRecognized = false;
tap.onDoubleTap = () { tap.onDoubleTap = () {
...@@ -188,7 +188,7 @@ void main() { ...@@ -188,7 +188,7 @@ void main() {
}); });
testGesture('Inter-tap delay cancels double tap', (GestureTester tester) { testGesture('Inter-tap delay cancels double tap', (GestureTester tester) {
DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer(); final DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer();
bool doubleTapRecognized = false; bool doubleTapRecognized = false;
tap.onDoubleTap = () { tap.onDoubleTap = () {
...@@ -222,7 +222,7 @@ void main() { ...@@ -222,7 +222,7 @@ void main() {
}); });
testGesture('Inter-tap delay resets double tap, allowing third tap to be a double-tap', (GestureTester tester) { testGesture('Inter-tap delay resets double tap, allowing third tap to be a double-tap', (GestureTester tester) {
DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer(); final DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer();
bool doubleTapRecognized = false; bool doubleTapRecognized = false;
tap.onDoubleTap = () { tap.onDoubleTap = () {
...@@ -268,7 +268,7 @@ void main() { ...@@ -268,7 +268,7 @@ void main() {
}); });
testGesture('Intra-tap delay does not cancel double tap', (GestureTester tester) { testGesture('Intra-tap delay does not cancel double tap', (GestureTester tester) {
DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer(); final DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer();
bool doubleTapRecognized = false; bool doubleTapRecognized = false;
tap.onDoubleTap = () { tap.onDoubleTap = () {
...@@ -302,7 +302,7 @@ void main() { ...@@ -302,7 +302,7 @@ void main() {
}); });
testGesture('Should not recognize two overlapping taps', (GestureTester tester) { testGesture('Should not recognize two overlapping taps', (GestureTester tester) {
DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer(); final DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer();
bool doubleTapRecognized = false; bool doubleTapRecognized = false;
tap.onDoubleTap = () { tap.onDoubleTap = () {
...@@ -335,7 +335,7 @@ void main() { ...@@ -335,7 +335,7 @@ void main() {
}); });
testGesture('Should recognize one tap of group followed by second tap', (GestureTester tester) { testGesture('Should recognize one tap of group followed by second tap', (GestureTester tester) {
DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer(); final DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer();
bool doubleTapRecognized = false; bool doubleTapRecognized = false;
tap.onDoubleTap = () { tap.onDoubleTap = () {
...@@ -380,7 +380,7 @@ void main() { ...@@ -380,7 +380,7 @@ void main() {
}); });
testGesture('Should cancel on arena reject during first tap', (GestureTester tester) { testGesture('Should cancel on arena reject during first tap', (GestureTester tester) {
DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer(); final DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer();
bool doubleTapRecognized = false; bool doubleTapRecognized = false;
tap.onDoubleTap = () { tap.onDoubleTap = () {
...@@ -388,8 +388,8 @@ void main() { ...@@ -388,8 +388,8 @@ void main() {
}; };
tap.addPointer(down1); tap.addPointer(down1);
TestGestureArenaMember member = new TestGestureArenaMember(); final TestGestureArenaMember member = new TestGestureArenaMember();
GestureArenaEntry entry = GestureBinding.instance.gestureArena.add(1, member); final GestureArenaEntry entry = GestureBinding.instance.gestureArena.add(1, member);
tester.closeArena(1); tester.closeArena(1);
expect(doubleTapRecognized, isFalse); expect(doubleTapRecognized, isFalse);
tester.route(down1); tester.route(down1);
...@@ -418,7 +418,7 @@ void main() { ...@@ -418,7 +418,7 @@ void main() {
}); });
testGesture('Should cancel on arena reject between taps', (GestureTester tester) { testGesture('Should cancel on arena reject between taps', (GestureTester tester) {
DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer(); final DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer();
bool doubleTapRecognized = false; bool doubleTapRecognized = false;
tap.onDoubleTap = () { tap.onDoubleTap = () {
...@@ -426,8 +426,8 @@ void main() { ...@@ -426,8 +426,8 @@ void main() {
}; };
tap.addPointer(down1); tap.addPointer(down1);
TestGestureArenaMember member = new TestGestureArenaMember(); final TestGestureArenaMember member = new TestGestureArenaMember();
GestureArenaEntry entry = GestureBinding.instance.gestureArena.add(1, member); final GestureArenaEntry entry = GestureBinding.instance.gestureArena.add(1, member);
tester.closeArena(1); tester.closeArena(1);
expect(doubleTapRecognized, isFalse); expect(doubleTapRecognized, isFalse);
tester.route(down1); tester.route(down1);
...@@ -456,7 +456,7 @@ void main() { ...@@ -456,7 +456,7 @@ void main() {
}); });
testGesture('Should cancel on arena reject during last tap', (GestureTester tester) { testGesture('Should cancel on arena reject during last tap', (GestureTester tester) {
DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer(); final DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer();
bool doubleTapRecognized = false; bool doubleTapRecognized = false;
tap.onDoubleTap = () { tap.onDoubleTap = () {
...@@ -464,8 +464,8 @@ void main() { ...@@ -464,8 +464,8 @@ void main() {
}; };
tap.addPointer(down1); tap.addPointer(down1);
TestGestureArenaMember member = new TestGestureArenaMember(); final TestGestureArenaMember member = new TestGestureArenaMember();
GestureArenaEntry entry = GestureBinding.instance.gestureArena.add(1, member); final GestureArenaEntry entry = GestureBinding.instance.gestureArena.add(1, member);
tester.closeArena(1); tester.closeArena(1);
expect(doubleTapRecognized, isFalse); expect(doubleTapRecognized, isFalse);
tester.route(down1); tester.route(down1);
...@@ -494,7 +494,7 @@ void main() { ...@@ -494,7 +494,7 @@ void main() {
}); });
testGesture('Passive gesture should trigger on double tap cancel', (GestureTester tester) { testGesture('Passive gesture should trigger on double tap cancel', (GestureTester tester) {
DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer(); final DoubleTapGestureRecognizer tap = new DoubleTapGestureRecognizer();
bool doubleTapRecognized = false; bool doubleTapRecognized = false;
tap.onDoubleTap = () { tap.onDoubleTap = () {
...@@ -503,7 +503,7 @@ void main() { ...@@ -503,7 +503,7 @@ void main() {
new FakeAsync().run((FakeAsync async) { new FakeAsync().run((FakeAsync async) {
tap.addPointer(down1); tap.addPointer(down1);
TestGestureArenaMember member = new TestGestureArenaMember(); final TestGestureArenaMember member = new TestGestureArenaMember();
GestureBinding.instance.gestureArena.add(1, member); GestureBinding.instance.gestureArena.add(1, member);
tester.closeArena(1); tester.closeArena(1);
expect(doubleTapRecognized, isFalse); expect(doubleTapRecognized, isFalse);
......
...@@ -11,8 +11,8 @@ void main() { ...@@ -11,8 +11,8 @@ void main() {
setUp(ensureGestureBinding); setUp(ensureGestureBinding);
testGesture('Should recognize pan', (GestureTester tester) { testGesture('Should recognize pan', (GestureTester tester) {
PanGestureRecognizer pan = new PanGestureRecognizer(); final PanGestureRecognizer pan = new PanGestureRecognizer();
TapGestureRecognizer tap = new TapGestureRecognizer(); final TapGestureRecognizer tap = new TapGestureRecognizer();
bool didStartPan = false; bool didStartPan = false;
pan.onStart = (_) { pan.onStart = (_) {
...@@ -34,8 +34,8 @@ void main() { ...@@ -34,8 +34,8 @@ void main() {
didTap = true; didTap = true;
}; };
TestPointer pointer = new TestPointer(5); final TestPointer pointer = new TestPointer(5);
PointerDownEvent down = pointer.down(const Point(10.0, 10.0)); final PointerDownEvent down = pointer.down(const Point(10.0, 10.0));
pan.addPointer(down); pan.addPointer(down);
tap.addPointer(down); tap.addPointer(down);
tester.closeArena(5); tester.closeArena(5);
...@@ -77,7 +77,7 @@ void main() { ...@@ -77,7 +77,7 @@ void main() {
}); });
testGesture('Should recognize drag', (GestureTester tester) { testGesture('Should recognize drag', (GestureTester tester) {
HorizontalDragGestureRecognizer drag = new HorizontalDragGestureRecognizer(); final HorizontalDragGestureRecognizer drag = new HorizontalDragGestureRecognizer();
bool didStartDrag = false; bool didStartDrag = false;
drag.onStart = (_) { drag.onStart = (_) {
...@@ -94,8 +94,8 @@ void main() { ...@@ -94,8 +94,8 @@ void main() {
didEndDrag = true; didEndDrag = true;
}; };
TestPointer pointer = new TestPointer(5); final TestPointer pointer = new TestPointer(5);
PointerDownEvent down = pointer.down(const Point(10.0, 10.0)); final PointerDownEvent down = pointer.down(const Point(10.0, 10.0));
drag.addPointer(down); drag.addPointer(down);
tester.closeArena(5); tester.closeArena(5);
expect(didStartDrag, isFalse); expect(didStartDrag, isFalse);
...@@ -130,7 +130,7 @@ void main() { ...@@ -130,7 +130,7 @@ void main() {
}); });
testGesture('Clamp max velocity', (GestureTester tester) { testGesture('Clamp max velocity', (GestureTester tester) {
HorizontalDragGestureRecognizer drag = new HorizontalDragGestureRecognizer(); final HorizontalDragGestureRecognizer drag = new HorizontalDragGestureRecognizer();
Velocity velocity; Velocity velocity;
double primaryVelocity; double primaryVelocity;
...@@ -139,8 +139,8 @@ void main() { ...@@ -139,8 +139,8 @@ void main() {
primaryVelocity = details.primaryVelocity; primaryVelocity = details.primaryVelocity;
}; };
TestPointer pointer = new TestPointer(5); final TestPointer pointer = new TestPointer(5);
PointerDownEvent down = pointer.down(const Point(10.0, 25.0), timeStamp: const Duration(milliseconds: 10)); final PointerDownEvent down = pointer.down(const Point(10.0, 25.0), timeStamp: const Duration(milliseconds: 10));
drag.addPointer(down); drag.addPointer(down);
tester.closeArena(5); tester.closeArena(5);
tester.route(down); tester.route(down);
......
...@@ -33,14 +33,14 @@ void main() { ...@@ -33,14 +33,14 @@ void main() {
setUp(ensureTestGestureBinding); setUp(ensureTestGestureBinding);
test('Pointer tap events', () { test('Pointer tap events', () {
ui.PointerDataPacket packet = const ui.PointerDataPacket( final ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[ data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.down), const ui.PointerData(change: ui.PointerChange.down),
const ui.PointerData(change: ui.PointerChange.up), const ui.PointerData(change: ui.PointerChange.up),
] ]
); );
List<PointerEvent> events = <PointerEvent>[]; final List<PointerEvent> events = <PointerEvent>[];
_binding.callback = (PointerEvent event) => events.add(event); _binding.callback = (PointerEvent event) => events.add(event);
ui.window.onPointerDataPacket(packet); ui.window.onPointerDataPacket(packet);
...@@ -50,7 +50,7 @@ void main() { ...@@ -50,7 +50,7 @@ void main() {
}); });
test('Pointer move events', () { test('Pointer move events', () {
ui.PointerDataPacket packet = const ui.PointerDataPacket( final ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[ data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.down), const ui.PointerData(change: ui.PointerChange.down),
const ui.PointerData(change: ui.PointerChange.move), const ui.PointerData(change: ui.PointerChange.move),
...@@ -58,7 +58,7 @@ void main() { ...@@ -58,7 +58,7 @@ void main() {
] ]
); );
List<PointerEvent> events = <PointerEvent>[]; final List<PointerEvent> events = <PointerEvent>[];
_binding.callback = (PointerEvent event) => events.add(event); _binding.callback = (PointerEvent event) => events.add(event);
ui.window.onPointerDataPacket(packet); ui.window.onPointerDataPacket(packet);
...@@ -69,7 +69,7 @@ void main() { ...@@ -69,7 +69,7 @@ void main() {
}); });
test('Synthetic move events', () { test('Synthetic move events', () {
ui.PointerDataPacket packet = const ui.PointerDataPacket( final ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[ data: const <ui.PointerData>[
const ui.PointerData( const ui.PointerData(
change: ui.PointerChange.down, change: ui.PointerChange.down,
...@@ -84,7 +84,7 @@ void main() { ...@@ -84,7 +84,7 @@ void main() {
] ]
); );
List<PointerEvent> events = <PointerEvent>[]; final List<PointerEvent> events = <PointerEvent>[];
_binding.callback = (PointerEvent event) => events.add(event); _binding.callback = (PointerEvent event) => events.add(event);
ui.window.onPointerDataPacket(packet); ui.window.onPointerDataPacket(packet);
...@@ -96,14 +96,14 @@ void main() { ...@@ -96,14 +96,14 @@ void main() {
}); });
test('Pointer cancel events', () { test('Pointer cancel events', () {
ui.PointerDataPacket packet = const ui.PointerDataPacket( final ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[ data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.down), const ui.PointerData(change: ui.PointerChange.down),
const ui.PointerData(change: ui.PointerChange.cancel), const ui.PointerData(change: ui.PointerChange.cancel),
] ]
); );
List<PointerEvent> events = <PointerEvent>[]; final List<PointerEvent> events = <PointerEvent>[];
_binding.callback = (PointerEvent event) => events.add(event); _binding.callback = (PointerEvent event) => events.add(event);
ui.window.onPointerDataPacket(packet); ui.window.onPointerDataPacket(packet);
...@@ -113,14 +113,14 @@ void main() { ...@@ -113,14 +113,14 @@ void main() {
}); });
test('Can cancel pointers', () { test('Can cancel pointers', () {
ui.PointerDataPacket packet = const ui.PointerDataPacket( final ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[ data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.down), const ui.PointerData(change: ui.PointerChange.down),
const ui.PointerData(change: ui.PointerChange.up), const ui.PointerData(change: ui.PointerChange.up),
] ]
); );
List<PointerEvent> events = <PointerEvent>[]; final List<PointerEvent> events = <PointerEvent>[];
_binding.callback = (PointerEvent event) { _binding.callback = (PointerEvent event) {
events.add(event); events.add(event);
if (event is PointerDownEvent) if (event is PointerDownEvent)
...@@ -134,7 +134,7 @@ void main() { ...@@ -134,7 +134,7 @@ void main() {
}); });
test('Can expand add and hover pointers', () { test('Can expand add and hover pointers', () {
ui.PointerDataPacket packet = const ui.PointerDataPacket( final ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[ data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.add, device: 24), const ui.PointerData(change: ui.PointerChange.add, device: 24),
const ui.PointerData(change: ui.PointerChange.hover, device: 24), const ui.PointerData(change: ui.PointerChange.hover, device: 24),
...@@ -143,7 +143,7 @@ void main() { ...@@ -143,7 +143,7 @@ void main() {
] ]
); );
List<PointerEvent> events = PointerEventConverter.expand( final List<PointerEvent> events = PointerEventConverter.expand(
packet.data, ui.window.devicePixelRatio).toList(); packet.data, ui.window.devicePixelRatio).toList();
expect(events.length, 5); expect(events.length, 5);
...@@ -155,7 +155,7 @@ void main() { ...@@ -155,7 +155,7 @@ void main() {
}); });
test('Synthetic hover and cancel for misplaced down and remove', () { test('Synthetic hover and cancel for misplaced down and remove', () {
ui.PointerDataPacket packet = const ui.PointerDataPacket( final ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: const <ui.PointerData>[ data: const <ui.PointerData>[
const ui.PointerData(change: ui.PointerChange.add, device: 25, physicalX: 10.0, physicalY: 10.0), const ui.PointerData(change: ui.PointerChange.add, device: 25, physicalX: 10.0, physicalY: 10.0),
const ui.PointerData(change: ui.PointerChange.down, device: 25, physicalX: 15.0, physicalY: 17.0), const ui.PointerData(change: ui.PointerChange.down, device: 25, physicalX: 15.0, physicalY: 17.0),
...@@ -163,7 +163,7 @@ void main() { ...@@ -163,7 +163,7 @@ void main() {
] ]
); );
List<PointerEvent> events = PointerEventConverter.expand( final List<PointerEvent> events = PointerEventConverter.expand(
packet.data, ui.window.devicePixelRatio).toList(); packet.data, ui.window.devicePixelRatio).toList();
expect(events.length, 5); expect(events.length, 5);
......
...@@ -21,7 +21,7 @@ void main() { ...@@ -21,7 +21,7 @@ void main() {
setUp(ensureGestureBinding); setUp(ensureGestureBinding);
testGesture('Should recognize long press', (GestureTester tester) { testGesture('Should recognize long press', (GestureTester tester) {
LongPressGestureRecognizer longPress = new LongPressGestureRecognizer(); final LongPressGestureRecognizer longPress = new LongPressGestureRecognizer();
bool longPressRecognized = false; bool longPressRecognized = false;
longPress.onLongPress = () { longPress.onLongPress = () {
...@@ -42,7 +42,7 @@ void main() { ...@@ -42,7 +42,7 @@ void main() {
}); });
testGesture('Up cancels long press', (GestureTester tester) { testGesture('Up cancels long press', (GestureTester tester) {
LongPressGestureRecognizer longPress = new LongPressGestureRecognizer(); final LongPressGestureRecognizer longPress = new LongPressGestureRecognizer();
bool longPressRecognized = false; bool longPressRecognized = false;
longPress.onLongPress = () { longPress.onLongPress = () {
...@@ -65,8 +65,8 @@ void main() { ...@@ -65,8 +65,8 @@ void main() {
}); });
testGesture('Should recognize both tap down and long press', (GestureTester tester) { testGesture('Should recognize both tap down and long press', (GestureTester tester) {
LongPressGestureRecognizer longPress = new LongPressGestureRecognizer(); final LongPressGestureRecognizer longPress = new LongPressGestureRecognizer();
TapGestureRecognizer tap = new TapGestureRecognizer(); final TapGestureRecognizer tap = new TapGestureRecognizer();
bool tapDownRecognized = false; bool tapDownRecognized = false;
tap.onTapDown = (_) { tap.onTapDown = (_) {
...@@ -98,8 +98,8 @@ void main() { ...@@ -98,8 +98,8 @@ void main() {
}); });
testGesture('Drag start delayed by microtask', (GestureTester tester) { testGesture('Drag start delayed by microtask', (GestureTester tester) {
LongPressGestureRecognizer longPress = new LongPressGestureRecognizer(); final LongPressGestureRecognizer longPress = new LongPressGestureRecognizer();
HorizontalDragGestureRecognizer drag = new HorizontalDragGestureRecognizer(); final HorizontalDragGestureRecognizer drag = new HorizontalDragGestureRecognizer();
bool isDangerousStack = false; bool isDangerousStack = false;
......
...@@ -13,12 +13,12 @@ void main() { ...@@ -13,12 +13,12 @@ void main() {
} }
test('Least-squares fit: linear polynomial to line', () { test('Least-squares fit: linear polynomial to line', () {
List<double> x = <double>[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]; final List<double> x = <double>[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0];
List<double> y = <double>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]; final List<double> y = <double>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0];
List<double> w = <double>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]; final List<double> w = <double>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0];
LeastSquaresSolver solver = new LeastSquaresSolver(x, y, w); final LeastSquaresSolver solver = new LeastSquaresSolver(x, y, w);
PolynomialFit fit = solver.solve(1); final PolynomialFit fit = solver.solve(1);
expect(fit.coefficients.length, 2); expect(fit.coefficients.length, 2);
expect(approx(fit.coefficients[0], 1.0), isTrue); expect(approx(fit.coefficients[0], 1.0), isTrue);
...@@ -27,12 +27,12 @@ void main() { ...@@ -27,12 +27,12 @@ void main() {
}); });
test('Least-squares fit: linear polynomial to sloped line', () { test('Least-squares fit: linear polynomial to sloped line', () {
List<double> x = <double>[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]; final List<double> x = <double>[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0];
List<double> y = <double>[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]; final List<double> y = <double>[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0];
List<double> w = <double>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]; final List<double> w = <double>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0];
LeastSquaresSolver solver = new LeastSquaresSolver(x, y, w); final LeastSquaresSolver solver = new LeastSquaresSolver(x, y, w);
PolynomialFit fit = solver.solve(1); final PolynomialFit fit = solver.solve(1);
expect(fit.coefficients.length, 2); expect(fit.coefficients.length, 2);
expect(approx(fit.coefficients[0], 1.0), isTrue); expect(approx(fit.coefficients[0], 1.0), isTrue);
...@@ -41,12 +41,12 @@ void main() { ...@@ -41,12 +41,12 @@ void main() {
}); });
test('Least-squares fit: quadratic polynomial to line', () { test('Least-squares fit: quadratic polynomial to line', () {
List<double> x = <double>[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]; final List<double> x = <double>[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0];
List<double> y = <double>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]; final List<double> y = <double>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0];
List<double> w = <double>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]; final List<double> w = <double>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0];
LeastSquaresSolver solver = new LeastSquaresSolver(x, y, w); final LeastSquaresSolver solver = new LeastSquaresSolver(x, y, w);
PolynomialFit fit = solver.solve(2); final PolynomialFit fit = solver.solve(2);
expect(fit.coefficients.length, 3); expect(fit.coefficients.length, 3);
expect(approx(fit.coefficients[0], 1.0), isTrue); expect(approx(fit.coefficients[0], 1.0), isTrue);
...@@ -56,12 +56,12 @@ void main() { ...@@ -56,12 +56,12 @@ void main() {
}); });
test('Least-squares fit: quadratic polynomial to sloped line', () { test('Least-squares fit: quadratic polynomial to sloped line', () {
List<double> x = <double>[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]; final List<double> x = <double>[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0];
List<double> y = <double>[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]; final List<double> y = <double>[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0];
List<double> w = <double>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]; final List<double> w = <double>[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0];
LeastSquaresSolver solver = new LeastSquaresSolver(x, y, w); final LeastSquaresSolver solver = new LeastSquaresSolver(x, y, w);
PolynomialFit fit = solver.solve(2); final PolynomialFit fit = solver.solve(2);
expect(fit.coefficients.length, 3); expect(fit.coefficients.length, 3);
expect(approx(fit.coefficients[0], 1.0), isTrue); expect(approx(fit.coefficients[0], 1.0), isTrue);
......
...@@ -14,7 +14,7 @@ void main() { ...@@ -14,7 +14,7 @@ void main() {
setUp(ensureGestureBinding); setUp(ensureGestureBinding);
testGesture('MultiDrag control test', (GestureTester tester) { testGesture('MultiDrag control test', (GestureTester tester) {
DelayedMultiDragGestureRecognizer drag = new DelayedMultiDragGestureRecognizer(); final DelayedMultiDragGestureRecognizer drag = new DelayedMultiDragGestureRecognizer();
bool didStartDrag = false; bool didStartDrag = false;
drag.onStart = (Point position) { drag.onStart = (Point position) {
...@@ -22,8 +22,8 @@ void main() { ...@@ -22,8 +22,8 @@ void main() {
return new TestDrag(); return new TestDrag();
}; };
TestPointer pointer = new TestPointer(5); final TestPointer pointer = new TestPointer(5);
PointerDownEvent down = pointer.down(const Point(10.0, 10.0)); final PointerDownEvent down = pointer.down(const Point(10.0, 10.0));
drag.addPointer(down); drag.addPointer(down);
tester.closeArena(5); tester.closeArena(5);
expect(didStartDrag, isFalse); expect(didStartDrag, isFalse);
......
...@@ -14,9 +14,9 @@ void main() { ...@@ -14,9 +14,9 @@ void main() {
setUp(ensureGestureBinding); setUp(ensureGestureBinding);
testGesture('Should recognize pan', (GestureTester tester) { testGesture('Should recognize pan', (GestureTester tester) {
MultiTapGestureRecognizer tap = new MultiTapGestureRecognizer(longTapDelay: kLongPressTimeout); final MultiTapGestureRecognizer tap = new MultiTapGestureRecognizer(longTapDelay: kLongPressTimeout);
List<String> log = <String>[]; final List<String> log = <String>[];
tap.onTapDown = (int pointer, TapDownDetails details) { log.add('tap-down $pointer'); }; tap.onTapDown = (int pointer, TapDownDetails details) { log.add('tap-down $pointer'); };
tap.onTapUp = (int pointer, TapUpDetails details) { log.add('tap-up $pointer'); }; tap.onTapUp = (int pointer, TapUpDetails details) { log.add('tap-up $pointer'); };
...@@ -25,8 +25,8 @@ void main() { ...@@ -25,8 +25,8 @@ void main() {
tap.onTapCancel = (int pointer) { log.add('tap-cancel $pointer'); }; tap.onTapCancel = (int pointer) { log.add('tap-cancel $pointer'); };
TestPointer pointer5 = new TestPointer(5); final TestPointer pointer5 = new TestPointer(5);
PointerDownEvent down5 = pointer5.down(const Point(10.0, 10.0)); final PointerDownEvent down5 = pointer5.down(const Point(10.0, 10.0));
tap.addPointer(down5); tap.addPointer(down5);
tester.closeArena(5); tester.closeArena(5);
expect(log, <String>['tap-down 5']); expect(log, <String>['tap-down 5']);
...@@ -34,8 +34,8 @@ void main() { ...@@ -34,8 +34,8 @@ void main() {
tester.route(down5); tester.route(down5);
expect(log, isEmpty); expect(log, isEmpty);
TestPointer pointer6 = new TestPointer(6); final TestPointer pointer6 = new TestPointer(6);
PointerDownEvent down6 = pointer6.down(const Point(15.0, 15.0)); final PointerDownEvent down6 = pointer6.down(const Point(15.0, 15.0));
tap.addPointer(down6); tap.addPointer(down6);
tester.closeArena(6); tester.closeArena(6);
expect(log, <String>['tap-down 6']); expect(log, <String>['tap-down 6']);
......
...@@ -13,10 +13,10 @@ void main() { ...@@ -13,10 +13,10 @@ void main() {
callbackRan = true; callbackRan = true;
} }
TestPointer pointer2 = new TestPointer(2); final TestPointer pointer2 = new TestPointer(2);
TestPointer pointer3 = new TestPointer(3); final TestPointer pointer3 = new TestPointer(3);
PointerRouter router = new PointerRouter(); final PointerRouter router = new PointerRouter();
router.addRoute(3, callback); router.addRoute(3, callback);
router.route(pointer2.down(Point.origin)); router.route(pointer2.down(Point.origin));
expect(callbackRan, isFalse); expect(callbackRan, isFalse);
...@@ -33,12 +33,12 @@ void main() { ...@@ -33,12 +33,12 @@ void main() {
void callback(PointerEvent event) { void callback(PointerEvent event) {
callbackRan = true; callbackRan = true;
} }
PointerRouter router = new PointerRouter(); final PointerRouter router = new PointerRouter();
router.addRoute(2, (PointerEvent event) { router.addRoute(2, (PointerEvent event) {
router.removeRoute(2, callback); router.removeRoute(2, callback);
}); });
router.addRoute(2, callback); router.addRoute(2, callback);
TestPointer pointer2 = new TestPointer(2); final TestPointer pointer2 = new TestPointer(2);
router.route(pointer2.down(Point.origin)); router.route(pointer2.down(Point.origin));
expect(callbackRan, isFalse); expect(callbackRan, isFalse);
}); });
...@@ -50,13 +50,13 @@ void main() { ...@@ -50,13 +50,13 @@ void main() {
} }
bool firstCallbackRan = false; bool firstCallbackRan = false;
PointerRouter router = new PointerRouter(); final PointerRouter router = new PointerRouter();
router.addGlobalRoute((PointerEvent event) { router.addGlobalRoute((PointerEvent event) {
firstCallbackRan = true; firstCallbackRan = true;
router.addGlobalRoute(secondCallback); router.addGlobalRoute(secondCallback);
}); });
TestPointer pointer2 = new TestPointer(2); final TestPointer pointer2 = new TestPointer(2);
router.route(pointer2.down(Point.origin)); router.route(pointer2.down(Point.origin));
expect(firstCallbackRan, isTrue); expect(firstCallbackRan, isTrue);
expect(secondCallbackRan, isFalse); expect(secondCallbackRan, isFalse);
...@@ -67,12 +67,12 @@ void main() { ...@@ -67,12 +67,12 @@ void main() {
void callback(PointerEvent event) { void callback(PointerEvent event) {
callbackRan = true; callbackRan = true;
} }
PointerRouter router = new PointerRouter(); final PointerRouter router = new PointerRouter();
router.addGlobalRoute((PointerEvent event) { router.addGlobalRoute((PointerEvent event) {
router.removeGlobalRoute(callback); router.removeGlobalRoute(callback);
}); });
router.addGlobalRoute(callback); router.addGlobalRoute(callback);
TestPointer pointer2 = new TestPointer(2); final TestPointer pointer2 = new TestPointer(2);
router.route(pointer2.down(Point.origin)); router.route(pointer2.down(Point.origin));
expect(callbackRan, isFalse); expect(callbackRan, isFalse);
}); });
...@@ -82,21 +82,21 @@ void main() { ...@@ -82,21 +82,21 @@ void main() {
void callback(PointerEvent event) { void callback(PointerEvent event) {
callbackRan = true; callbackRan = true;
} }
PointerRouter router = new PointerRouter(); final PointerRouter router = new PointerRouter();
bool perPointerCallbackRan = false; bool perPointerCallbackRan = false;
router.addRoute(2, (PointerEvent event) { router.addRoute(2, (PointerEvent event) {
perPointerCallbackRan = true; perPointerCallbackRan = true;
router.addGlobalRoute(callback); router.addGlobalRoute(callback);
}); });
TestPointer pointer2 = new TestPointer(2); final TestPointer pointer2 = new TestPointer(2);
router.route(pointer2.down(Point.origin)); router.route(pointer2.down(Point.origin));
expect(perPointerCallbackRan, isTrue); expect(perPointerCallbackRan, isTrue);
expect(callbackRan, isFalse); expect(callbackRan, isFalse);
}); });
test('Per-pointer callbacks happen before global callbacks', () { test('Per-pointer callbacks happen before global callbacks', () {
List<String> log = <String>[]; final List<String> log = <String>[];
PointerRouter router = new PointerRouter(); final PointerRouter router = new PointerRouter();
router.addGlobalRoute((PointerEvent event) { router.addGlobalRoute((PointerEvent event) {
log.add('global 1'); log.add('global 1');
}); });
...@@ -109,7 +109,7 @@ void main() { ...@@ -109,7 +109,7 @@ void main() {
router.addRoute(2, (PointerEvent event) { router.addRoute(2, (PointerEvent event) {
log.add('per-pointer 2'); log.add('per-pointer 2');
}); });
TestPointer pointer2 = new TestPointer(2); final TestPointer pointer2 = new TestPointer(2);
router.route(pointer2.down(Point.origin)); router.route(pointer2.down(Point.origin));
expect(log, equals(<String>[ expect(log, equals(<String>[
'per-pointer 1', 'per-pointer 1',
...@@ -120,8 +120,8 @@ void main() { ...@@ -120,8 +120,8 @@ void main() {
}); });
test('Exceptions do not stop pointer routing', () { test('Exceptions do not stop pointer routing', () {
List<String> log = <String>[]; final List<String> log = <String>[];
PointerRouter router = new PointerRouter(); final PointerRouter router = new PointerRouter();
router.addRoute(2, (PointerEvent event) { router.addRoute(2, (PointerEvent event) {
log.add('per-pointer 1'); log.add('per-pointer 1');
}); });
...@@ -133,12 +133,12 @@ void main() { ...@@ -133,12 +133,12 @@ void main() {
log.add('per-pointer 3'); log.add('per-pointer 3');
}); });
FlutterExceptionHandler previousErrorHandler = FlutterError.onError; final FlutterExceptionHandler previousErrorHandler = FlutterError.onError;
FlutterError.onError = (FlutterErrorDetails details) { FlutterError.onError = (FlutterErrorDetails details) {
log.add('error report'); log.add('error report');
}; };
TestPointer pointer2 = new TestPointer(2); final TestPointer pointer2 = new TestPointer(2);
router.route(pointer2.down(Point.origin)); router.route(pointer2.down(Point.origin));
expect(log, equals(<String>[ expect(log, equals(<String>[
'per-pointer 1', 'per-pointer 1',
......
...@@ -21,7 +21,7 @@ class TestGestureRecognizer extends GestureRecognizer { ...@@ -21,7 +21,7 @@ class TestGestureRecognizer extends GestureRecognizer {
void main() { void main() {
test('GestureRecognizer.toStringShort defaults to toString', () { test('GestureRecognizer.toStringShort defaults to toString', () {
TestGestureRecognizer recognizer = new TestGestureRecognizer(); final TestGestureRecognizer recognizer = new TestGestureRecognizer();
expect(recognizer.toStringShort(), equals(recognizer.toString())); expect(recognizer.toStringShort(), equals(recognizer.toString()));
}); });
} }
...@@ -11,8 +11,8 @@ void main() { ...@@ -11,8 +11,8 @@ void main() {
setUp(ensureGestureBinding); setUp(ensureGestureBinding);
testGesture('Should recognize scale gestures', (GestureTester tester) { testGesture('Should recognize scale gestures', (GestureTester tester) {
ScaleGestureRecognizer scale = new ScaleGestureRecognizer(); final ScaleGestureRecognizer scale = new ScaleGestureRecognizer();
TapGestureRecognizer tap = new TapGestureRecognizer(); final TapGestureRecognizer tap = new TapGestureRecognizer();
bool didStartScale = false; bool didStartScale = false;
Point updatedFocalPoint; Point updatedFocalPoint;
...@@ -37,9 +37,9 @@ void main() { ...@@ -37,9 +37,9 @@ void main() {
didTap = true; didTap = true;
}; };
TestPointer pointer1 = new TestPointer(1); final TestPointer pointer1 = new TestPointer(1);
PointerDownEvent down = pointer1.down(const Point(10.0, 10.0)); final PointerDownEvent down = pointer1.down(const Point(10.0, 10.0));
scale.addPointer(down); scale.addPointer(down);
tap.addPointer(down); tap.addPointer(down);
...@@ -69,8 +69,8 @@ void main() { ...@@ -69,8 +69,8 @@ void main() {
expect(didTap, isFalse); expect(didTap, isFalse);
// Two-finger scaling // Two-finger scaling
TestPointer pointer2 = new TestPointer(2); final TestPointer pointer2 = new TestPointer(2);
PointerDownEvent down2 = pointer2.down(const Point(10.0, 20.0)); final PointerDownEvent down2 = pointer2.down(const Point(10.0, 20.0));
scale.addPointer(down2); scale.addPointer(down2);
tap.addPointer(down2); tap.addPointer(down2);
tester.closeArena(2); tester.closeArena(2);
...@@ -102,8 +102,8 @@ void main() { ...@@ -102,8 +102,8 @@ void main() {
expect(didTap, isFalse); expect(didTap, isFalse);
// Three-finger scaling // Three-finger scaling
TestPointer pointer3 = new TestPointer(3); final TestPointer pointer3 = new TestPointer(3);
PointerDownEvent down3 = pointer3.down(const Point(25.0, 35.0)); final PointerDownEvent down3 = pointer3.down(const Point(25.0, 35.0));
scale.addPointer(down3); scale.addPointer(down3);
tap.addPointer(down3); tap.addPointer(down3);
tester.closeArena(3); tester.closeArena(3);
......
...@@ -58,7 +58,7 @@ void main() { ...@@ -58,7 +58,7 @@ void main() {
); );
testGesture('Should recognize tap', (GestureTester tester) { testGesture('Should recognize tap', (GestureTester tester) {
TapGestureRecognizer tap = new TapGestureRecognizer(); final TapGestureRecognizer tap = new TapGestureRecognizer();
bool tapRecognized = false; bool tapRecognized = false;
tap.onTap = () { tap.onTap = () {
...@@ -80,7 +80,7 @@ void main() { ...@@ -80,7 +80,7 @@ void main() {
}); });
testGesture('No duplicate tap events', (GestureTester tester) { testGesture('No duplicate tap events', (GestureTester tester) {
TapGestureRecognizer tap = new TapGestureRecognizer(); final TapGestureRecognizer tap = new TapGestureRecognizer();
int tapsRecognized = 0; int tapsRecognized = 0;
tap.onTap = () { tap.onTap = () {
...@@ -113,7 +113,7 @@ void main() { ...@@ -113,7 +113,7 @@ void main() {
}); });
testGesture('Should not recognize two overlapping taps', (GestureTester tester) { testGesture('Should not recognize two overlapping taps', (GestureTester tester) {
TapGestureRecognizer tap = new TapGestureRecognizer(); final TapGestureRecognizer tap = new TapGestureRecognizer();
int tapsRecognized = 0; int tapsRecognized = 0;
tap.onTap = () { tap.onTap = () {
...@@ -147,7 +147,7 @@ void main() { ...@@ -147,7 +147,7 @@ void main() {
}); });
testGesture('Distance cancels tap', (GestureTester tester) { testGesture('Distance cancels tap', (GestureTester tester) {
TapGestureRecognizer tap = new TapGestureRecognizer(); final TapGestureRecognizer tap = new TapGestureRecognizer();
bool tapRecognized = false; bool tapRecognized = false;
tap.onTap = () { tap.onTap = () {
...@@ -180,7 +180,7 @@ void main() { ...@@ -180,7 +180,7 @@ void main() {
}); });
testGesture('Timeout does not cancel tap', (GestureTester tester) { testGesture('Timeout does not cancel tap', (GestureTester tester) {
TapGestureRecognizer tap = new TapGestureRecognizer(); final TapGestureRecognizer tap = new TapGestureRecognizer();
bool tapRecognized = false; bool tapRecognized = false;
tap.onTap = () { tap.onTap = () {
...@@ -204,7 +204,7 @@ void main() { ...@@ -204,7 +204,7 @@ void main() {
}); });
testGesture('Should yield to other arena members', (GestureTester tester) { testGesture('Should yield to other arena members', (GestureTester tester) {
TapGestureRecognizer tap = new TapGestureRecognizer(); final TapGestureRecognizer tap = new TapGestureRecognizer();
bool tapRecognized = false; bool tapRecognized = false;
tap.onTap = () { tap.onTap = () {
...@@ -212,8 +212,8 @@ void main() { ...@@ -212,8 +212,8 @@ void main() {
}; };
tap.addPointer(down1); tap.addPointer(down1);
TestGestureArenaMember member = new TestGestureArenaMember(); final TestGestureArenaMember member = new TestGestureArenaMember();
GestureArenaEntry entry = GestureBinding.instance.gestureArena.add(1, member); final GestureArenaEntry entry = GestureBinding.instance.gestureArena.add(1, member);
GestureBinding.instance.gestureArena.hold(1); GestureBinding.instance.gestureArena.hold(1);
tester.closeArena(1); tester.closeArena(1);
expect(tapRecognized, isFalse); expect(tapRecognized, isFalse);
...@@ -232,7 +232,7 @@ void main() { ...@@ -232,7 +232,7 @@ void main() {
}); });
testGesture('Should trigger on release of held arena', (GestureTester tester) { testGesture('Should trigger on release of held arena', (GestureTester tester) {
TapGestureRecognizer tap = new TapGestureRecognizer(); final TapGestureRecognizer tap = new TapGestureRecognizer();
bool tapRecognized = false; bool tapRecognized = false;
tap.onTap = () { tap.onTap = () {
...@@ -240,8 +240,8 @@ void main() { ...@@ -240,8 +240,8 @@ void main() {
}; };
tap.addPointer(down1); tap.addPointer(down1);
TestGestureArenaMember member = new TestGestureArenaMember(); final TestGestureArenaMember member = new TestGestureArenaMember();
GestureArenaEntry entry = GestureBinding.instance.gestureArena.add(1, member); final GestureArenaEntry entry = GestureBinding.instance.gestureArena.add(1, member);
GestureBinding.instance.gestureArena.hold(1); GestureBinding.instance.gestureArena.hold(1);
tester.closeArena(1); tester.closeArena(1);
expect(tapRecognized, isFalse); expect(tapRecognized, isFalse);
...@@ -261,13 +261,13 @@ void main() { ...@@ -261,13 +261,13 @@ void main() {
}); });
testGesture('Should log exceptions from callbacks', (GestureTester tester) { testGesture('Should log exceptions from callbacks', (GestureTester tester) {
TapGestureRecognizer tap = new TapGestureRecognizer(); final TapGestureRecognizer tap = new TapGestureRecognizer();
tap.onTap = () { tap.onTap = () {
throw new Exception(test); throw new Exception(test);
}; };
FlutterExceptionHandler previousErrorHandler = FlutterError.onError; final FlutterExceptionHandler previousErrorHandler = FlutterError.onError;
bool gotError = false; bool gotError = false;
FlutterError.onError = (FlutterErrorDetails details) { FlutterError.onError = (FlutterErrorDetails details) {
gotError = true; gotError = true;
......
...@@ -12,25 +12,25 @@ void main() { ...@@ -12,25 +12,25 @@ void main() {
testGesture('GestureArenaTeam rejection test', (GestureTester tester) { testGesture('GestureArenaTeam rejection test', (GestureTester tester) {
GestureArenaTeam team = new GestureArenaTeam(); final GestureArenaTeam team = new GestureArenaTeam();
HorizontalDragGestureRecognizer horizontalDrag = new HorizontalDragGestureRecognizer()..team = team; final HorizontalDragGestureRecognizer horizontalDrag = new HorizontalDragGestureRecognizer()..team = team;
VerticalDragGestureRecognizer verticalDrag = new VerticalDragGestureRecognizer()..team = team; final VerticalDragGestureRecognizer verticalDrag = new VerticalDragGestureRecognizer()..team = team;
TapGestureRecognizer tap = new TapGestureRecognizer(); final TapGestureRecognizer tap = new TapGestureRecognizer();
expect(horizontalDrag.team, equals(team)); expect(horizontalDrag.team, equals(team));
expect(verticalDrag.team, equals(team)); expect(verticalDrag.team, equals(team));
expect(tap.team, isNull); expect(tap.team, isNull);
List<String> log = <String>[]; final List<String> log = <String>[];
horizontalDrag.onStart = (DragStartDetails details) { log.add('hoizontal-drag-start'); }; horizontalDrag.onStart = (DragStartDetails details) { log.add('hoizontal-drag-start'); };
verticalDrag.onStart = (DragStartDetails details) { log.add('vertical-drag-start'); }; verticalDrag.onStart = (DragStartDetails details) { log.add('vertical-drag-start'); };
tap.onTap = () { log.add('tap'); }; tap.onTap = () { log.add('tap'); };
void test(Offset delta) { void test(Offset delta) {
Point origin = const Point(10.0, 10.0); final Point origin = const Point(10.0, 10.0);
TestPointer pointer = new TestPointer(5); final TestPointer pointer = new TestPointer(5);
PointerDownEvent down = pointer.down(origin); final PointerDownEvent down = pointer.down(origin);
horizontalDrag.addPointer(down); horizontalDrag.addPointer(down);
verticalDrag.addPointer(down); verticalDrag.addPointer(down);
tap.addPointer(down); tap.addPointer(down);
......
...@@ -8,7 +8,7 @@ import 'velocity_tracker_data.dart'; ...@@ -8,7 +8,7 @@ import 'velocity_tracker_data.dart';
bool _withinTolerance(double actual, double expected) { bool _withinTolerance(double actual, double expected) {
const double kTolerance = 0.001; // Within .1% of expected value const double kTolerance = 0.001; // Within .1% of expected value
double diff = (actual - expected)/expected; final double diff = (actual - expected)/expected;
return diff.abs() < kTolerance; return diff.abs() < kTolerance;
} }
...@@ -19,7 +19,7 @@ bool _checkVelocity(Velocity actual, Offset expected) { ...@@ -19,7 +19,7 @@ bool _checkVelocity(Velocity actual, Offset expected) {
} }
void main() { void main() {
List<Offset> expected = const <Offset>[ final List<Offset> expected = const <Offset>[
const Offset(219.5762939453125, 1304.6705322265625), const Offset(219.5762939453125, 1304.6705322265625),
const Offset(355.6900939941406, 967.1700439453125), const Offset(355.6900939941406, 967.1700439453125),
const Offset(12.651158332824707, -36.9227180480957), const Offset(12.651158332824707, -36.9227180480957),
...@@ -36,7 +36,7 @@ void main() { ...@@ -36,7 +36,7 @@ void main() {
]; ];
test('Velocity tracker gives expected results', () { test('Velocity tracker gives expected results', () {
VelocityTracker tracker = new VelocityTracker(); final VelocityTracker tracker = new VelocityTracker();
int i = 0; int i = 0;
for (PointerEvent event in velocityEventData) { for (PointerEvent event in velocityEventData) {
if (event is PointerDownEvent || event is PointerMoveEvent) if (event is PointerDownEvent || event is PointerMoveEvent)
...@@ -49,8 +49,8 @@ void main() { ...@@ -49,8 +49,8 @@ void main() {
}); });
test('Velocity control test', () { test('Velocity control test', () {
Velocity velocity1 = const Velocity(pixelsPerSecond: const Offset(7.0, 0.0)); final Velocity velocity1 = const Velocity(pixelsPerSecond: const Offset(7.0, 0.0));
Velocity velocity2 = const Velocity(pixelsPerSecond: const Offset(12.0, 0.0)); final Velocity velocity2 = const Velocity(pixelsPerSecond: const Offset(12.0, 0.0));
expect(velocity1, equals(const Velocity(pixelsPerSecond: const Offset(7.0, 0.0)))); expect(velocity1, equals(const Velocity(pixelsPerSecond: const Offset(7.0, 0.0))));
expect(velocity1, isNot(equals(velocity2))); expect(velocity1, isNot(equals(velocity2)));
expect(velocity2 - velocity1, equals(const Velocity(pixelsPerSecond: const Offset(5.0, 0.0)))); expect(velocity2 - velocity1, equals(const Velocity(pixelsPerSecond: const Offset(5.0, 0.0))));
...@@ -62,7 +62,7 @@ void main() { ...@@ -62,7 +62,7 @@ void main() {
test('Interrupted velocity estimation', () { test('Interrupted velocity estimation', () {
// Regression test for https://github.com/flutter/flutter/pull/7510 // Regression test for https://github.com/flutter/flutter/pull/7510
VelocityTracker tracker = new VelocityTracker(); final VelocityTracker tracker = new VelocityTracker();
for (PointerEvent event in interruptedVelocityEventData) { for (PointerEvent event in interruptedVelocityEventData) {
if (event is PointerDownEvent || event is PointerMoveEvent) if (event is PointerDownEvent || event is PointerMoveEvent)
tracker.addPosition(event.timeStamp, event.position); tracker.addPosition(event.timeStamp, event.position);
......
...@@ -73,7 +73,7 @@ void main() { ...@@ -73,7 +73,7 @@ void main() {
}); });
testWidgets('AboutDrawerItem control test', (WidgetTester tester) async { testWidgets('AboutDrawerItem control test', (WidgetTester tester) async {
List<String> log = <String>[]; final List<String> log = <String>[];
Future<Null> licenseFuture; Future<Null> licenseFuture;
LicenseRegistry.addLicense(() { LicenseRegistry.addLicense(() {
......
...@@ -66,7 +66,7 @@ void main() { ...@@ -66,7 +66,7 @@ void main() {
), ),
); );
Finder title = find.text('X'); final Finder title = find.text('X');
Point center = tester.getCenter(title); Point center = tester.getCenter(title);
Size size = tester.getSize(title); Size size = tester.getSize(title);
expect(center.x, lessThan(400 - size.width / 2.0)); expect(center.x, lessThan(400 - size.width / 2.0));
...@@ -105,9 +105,9 @@ void main() { ...@@ -105,9 +105,9 @@ void main() {
); );
Finder title = find.text('X'); final Finder title = find.text('X');
Point center = tester.getCenter(title); final Point center = tester.getCenter(title);
Size size = tester.getSize(title); final Size size = tester.getSize(title);
expect(center.x, greaterThan(400 - size.width / 2.0)); expect(center.x, greaterThan(400 - size.width / 2.0));
expect(center.x, lessThan(400 + size.width / 2.0)); expect(center.x, lessThan(400 + size.width / 2.0));
}); });
...@@ -150,7 +150,7 @@ void main() { ...@@ -150,7 +150,7 @@ void main() {
// The app bar's title should be constrained to fit within the available space // The app bar's title should be constrained to fit within the available space
// between the leading and actions widgets. // between the leading and actions widgets.
Key titleKey = new UniqueKey(); final Key titleKey = new UniqueKey();
Widget leading = new Container(); Widget leading = new Container();
List<Widget> actions; List<Widget> actions;
...@@ -172,7 +172,7 @@ void main() { ...@@ -172,7 +172,7 @@ void main() {
await tester.pumpWidget(buildApp()); await tester.pumpWidget(buildApp());
Finder title = find.byKey(titleKey); final Finder title = find.byKey(titleKey);
expect(tester.getTopLeft(title).x, 72.0); expect(tester.getTopLeft(title).x, 72.0);
// The toolbar's contents are padded on the right by 4.0 // The toolbar's contents are padded on the right by 4.0
expect(tester.getSize(title).width, equals(800.0 - 72.0 - 4.0)); expect(tester.getSize(title).width, equals(800.0 - 72.0 - 4.0));
...@@ -199,7 +199,7 @@ void main() { ...@@ -199,7 +199,7 @@ void main() {
// between the leading and actions widgets. When it's also centered it may // between the leading and actions widgets. When it's also centered it may
// also be left or right justified if it doesn't fit in the overall center. // also be left or right justified if it doesn't fit in the overall center.
Key titleKey = new UniqueKey(); final Key titleKey = new UniqueKey();
double titleWidth = 700.0; double titleWidth = 700.0;
Widget leading = new Container(); Widget leading = new Container();
List<Widget> actions; List<Widget> actions;
...@@ -225,7 +225,7 @@ void main() { ...@@ -225,7 +225,7 @@ void main() {
// that the left edge of the title must be atleast 72. // that the left edge of the title must be atleast 72.
await tester.pumpWidget(buildApp()); await tester.pumpWidget(buildApp());
Finder title = find.byKey(titleKey); final Finder title = find.byKey(titleKey);
expect(tester.getTopLeft(title).x, 72.0); expect(tester.getTopLeft(title).x, 72.0);
expect(tester.getSize(title).width, equals(700.0)); expect(tester.getSize(title).width, equals(700.0));
...@@ -261,16 +261,16 @@ void main() { ...@@ -261,16 +261,16 @@ void main() {
), ),
); );
Finder title = find.text('X'); final Finder title = find.text('X');
expect(tester.getSize(title).isEmpty, isTrue); expect(tester.getSize(title).isEmpty, isTrue);
}); });
testWidgets('AppBar actions are vertically centered', (WidgetTester tester) async { testWidgets('AppBar actions are vertically centered', (WidgetTester tester) async {
UniqueKey appBarKey = new UniqueKey(); final UniqueKey appBarKey = new UniqueKey();
UniqueKey leadingKey = new UniqueKey(); final UniqueKey leadingKey = new UniqueKey();
UniqueKey titleKey = new UniqueKey(); final UniqueKey titleKey = new UniqueKey();
UniqueKey action0Key = new UniqueKey(); final UniqueKey action0Key = new UniqueKey();
UniqueKey action1Key = new UniqueKey(); final UniqueKey action1Key = new UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
new MaterialApp( new MaterialApp(
...@@ -310,7 +310,7 @@ void main() { ...@@ -310,7 +310,7 @@ void main() {
), ),
); );
Finder hamburger = find.byTooltip('Open navigation menu'); final Finder hamburger = find.byTooltip('Open navigation menu');
expect(tester.getTopLeft(hamburger), new Point(0.0, 0.0)); expect(tester.getTopLeft(hamburger), new Point(0.0, 0.0));
expect(tester.getSize(hamburger), new Size(56.0, 56.0)); expect(tester.getSize(hamburger), new Size(56.0, 56.0));
}); });
...@@ -341,13 +341,13 @@ void main() { ...@@ -341,13 +341,13 @@ void main() {
), ),
); );
Finder addButton = find.byTooltip('Add'); final Finder addButton = find.byTooltip('Add');
// Right padding is 4dp. // Right padding is 4dp.
expect(tester.getTopRight(addButton), new Point(800.0 - 4.0, 0.0)); expect(tester.getTopRight(addButton), new Point(800.0 - 4.0, 0.0));
// It's still the size it was plus the 2 * 8dp padding from IconButton. // It's still the size it was plus the 2 * 8dp padding from IconButton.
expect(tester.getSize(addButton), new Size(60.0 + 2 * 8.0, 56.0)); expect(tester.getSize(addButton), new Size(60.0 + 2 * 8.0, 56.0));
Finder shareButton = find.byTooltip('Share'); final Finder shareButton = find.byTooltip('Share');
// The 20dp icon is expanded to fill the IconButton's touch target to 48dp. // The 20dp icon is expanded to fill the IconButton's touch target to 48dp.
expect(tester.getSize(shareButton), new Size(48.0, 56.0)); expect(tester.getSize(shareButton), new Size(48.0, 56.0));
}); });
...@@ -359,7 +359,7 @@ void main() { ...@@ -359,7 +359,7 @@ void main() {
expandedHeight: null, expandedHeight: null,
)); ));
ScrollController controller = primaryScrollController(tester); final ScrollController controller = primaryScrollController(tester);
expect(controller.offset, 0.0); expect(controller.offset, 0.0);
expect(appBarIsVisible(tester), true); expect(appBarIsVisible(tester), true);
...@@ -396,7 +396,7 @@ void main() { ...@@ -396,7 +396,7 @@ void main() {
expandedHeight: 128.0, expandedHeight: 128.0,
)); ));
ScrollController controller = primaryScrollController(tester); final ScrollController controller = primaryScrollController(tester);
expect(controller.offset, 0.0); expect(controller.offset, 0.0);
expect(appBarIsVisible(tester), true); expect(appBarIsVisible(tester), true);
expect(appBarHeight(tester), 128.0); expect(appBarHeight(tester), 128.0);
...@@ -429,7 +429,7 @@ void main() { ...@@ -429,7 +429,7 @@ void main() {
expandedHeight: 128.0, expandedHeight: 128.0,
)); ));
ScrollController controller = primaryScrollController(tester); final ScrollController controller = primaryScrollController(tester);
expect(controller.offset, 0.0); expect(controller.offset, 0.0);
expect(appBarIsVisible(tester), true); expect(appBarIsVisible(tester), true);
expect(appBarHeight(tester), 128.0); expect(appBarHeight(tester), 128.0);
......
...@@ -39,7 +39,7 @@ void main() { ...@@ -39,7 +39,7 @@ void main() {
}); });
testWidgets('Focus handling', (WidgetTester tester) async { testWidgets('Focus handling', (WidgetTester tester) async {
GlobalKey inputKey = new GlobalKey(); final GlobalKey inputKey = new GlobalKey();
await tester.pumpWidget(new MaterialApp( await tester.pumpWidget(new MaterialApp(
home: new Material( home: new Material(
child: new Center( child: new Center(
...@@ -58,7 +58,7 @@ void main() { ...@@ -58,7 +58,7 @@ void main() {
) )
); );
StateMarkerState state1 = tester.state(find.byType(StateMarker)); final StateMarkerState state1 = tester.state(find.byType(StateMarker));
state1.marker = 'original'; state1.marker = 'original';
await tester.pumpWidget( await tester.pumpWidget(
...@@ -68,7 +68,7 @@ void main() { ...@@ -68,7 +68,7 @@ void main() {
) )
); );
StateMarkerState state2 = tester.state(find.byType(StateMarker)); final StateMarkerState state2 = tester.state(find.byType(StateMarker));
expect(state1, equals(state2)); expect(state1, equals(state2));
expect(state2.marker, equals('original')); expect(state2.marker, equals('original'));
}); });
...@@ -122,8 +122,8 @@ void main() { ...@@ -122,8 +122,8 @@ void main() {
expect(find.text('Home'), findsOneWidget); expect(find.text('Home'), findsOneWidget);
NavigatorState navigator = tester.state(find.byType(Navigator)); final NavigatorState navigator = tester.state(find.byType(Navigator));
bool result = await navigator.maybePop(); final bool result = await navigator.maybePop();
expect(result, isFalse); expect(result, isFalse);
......
...@@ -7,12 +7,12 @@ import 'package:flutter/material.dart'; ...@@ -7,12 +7,12 @@ import 'package:flutter/material.dart';
void main() { void main() {
test('MaterialPointArcTween control test', () { test('MaterialPointArcTween control test', () {
MaterialPointArcTween a = new MaterialPointArcTween( final MaterialPointArcTween a = new MaterialPointArcTween(
begin: Point.origin, begin: Point.origin,
end: const Point(0.0, 10.0) end: const Point(0.0, 10.0)
); );
MaterialPointArcTween b = new MaterialPointArcTween( final MaterialPointArcTween b = new MaterialPointArcTween(
begin: Point.origin, begin: Point.origin,
end: const Point(0.0, 10.0) end: const Point(0.0, 10.0)
); );
...@@ -23,12 +23,12 @@ void main() { ...@@ -23,12 +23,12 @@ void main() {
}); });
test('MaterialRectArcTween control test', () { test('MaterialRectArcTween control test', () {
MaterialRectArcTween a = new MaterialRectArcTween( final MaterialRectArcTween a = new MaterialRectArcTween(
begin: new Rect.fromLTWH(0.0, 0.0, 10.0, 10.0), begin: new Rect.fromLTWH(0.0, 0.0, 10.0, 10.0),
end: new Rect.fromLTWH(0.0, 10.0, 10.0, 10.0) end: new Rect.fromLTWH(0.0, 10.0, 10.0, 10.0)
); );
MaterialRectArcTween b = new MaterialRectArcTween( final MaterialRectArcTween b = new MaterialRectArcTween(
begin: new Rect.fromLTWH(0.0, 0.0, 10.0, 10.0), begin: new Rect.fromLTWH(0.0, 0.0, 10.0, 10.0),
end: new Rect.fromLTWH(0.0, 10.0, 10.0, 10.0) end: new Rect.fromLTWH(0.0, 10.0, 10.0, 10.0)
); );
......
...@@ -52,7 +52,7 @@ void main() { ...@@ -52,7 +52,7 @@ void main() {
) )
); );
RenderBox box = tester.renderObject(find.byType(BottomNavigationBar)); final RenderBox box = tester.renderObject(find.byType(BottomNavigationBar));
expect(box.size.height, 60.0); expect(box.size.height, 60.0);
expect(find.text('AC'), findsOneWidget); expect(find.text('AC'), findsOneWidget);
expect(find.text('Alarm'), findsOneWidget); expect(find.text('Alarm'), findsOneWidget);
...@@ -141,7 +141,7 @@ void main() { ...@@ -141,7 +141,7 @@ void main() {
// they grow. // they grow.
Iterable<RenderBox> actions = tester.renderObjectList(find.byType(InkResponse)); Iterable<RenderBox> actions = tester.renderObjectList(find.byType(InkResponse));
Point originalOrigin = actions.elementAt(3).localToGlobal(Point.origin); final Point originalOrigin = actions.elementAt(3).localToGlobal(Point.origin);
await tester.tap(find.text('AC')); await tester.tap(find.text('AC'));
await tester.pump(); await tester.pump();
...@@ -269,7 +269,7 @@ void main() { ...@@ -269,7 +269,7 @@ void main() {
), ),
); );
RenderBox box = tester.renderObject(find.byType(Icon)); final RenderBox box = tester.renderObject(find.byType(Icon));
expect(box.size.width, equals(12.0)); expect(box.size.width, equals(12.0));
expect(box.size.height, equals(12.0)); expect(box.size.height, equals(12.0));
expect(builderIconSize, 12.0); expect(builderIconSize, 12.0);
......
...@@ -17,7 +17,7 @@ void main() { ...@@ -17,7 +17,7 @@ void main() {
) )
); );
RenderBox box = tester.renderObject(find.byType(CircleAvatar)); final RenderBox box = tester.renderObject(find.byType(CircleAvatar));
expect(box.size.width, equals(100.0)); expect(box.size.width, equals(100.0));
expect(box.size.height, equals(100.0)); expect(box.size.height, equals(100.0));
......
...@@ -9,7 +9,7 @@ import 'data_table_test_utils.dart'; ...@@ -9,7 +9,7 @@ import 'data_table_test_utils.dart';
void main() { void main() {
testWidgets('DataTable control test', (WidgetTester tester) async { testWidgets('DataTable control test', (WidgetTester tester) async {
List<String> log = <String>[]; final List<String> log = <String>[];
Widget buildTable({ int sortColumnIndex, bool sortAscending: true }) { Widget buildTable({ int sortColumnIndex, bool sortAscending: true }) {
return new DataTable( return new DataTable(
......
...@@ -20,7 +20,7 @@ void main() { ...@@ -20,7 +20,7 @@ void main() {
}); });
testWidgets('tap-select a day', (WidgetTester tester) async { testWidgets('tap-select a day', (WidgetTester tester) async {
Key _datePickerKey = new UniqueKey(); final Key _datePickerKey = new UniqueKey();
DateTime _selectedDate = new DateTime(2016, DateTime.JULY, 26); DateTime _selectedDate = new DateTime(2016, DateTime.JULY, 26);
await tester.pumpWidget( await tester.pumpWidget(
...@@ -136,7 +136,7 @@ void main() { ...@@ -136,7 +136,7 @@ void main() {
await tester.tap(find.text('Go')); await tester.tap(find.text('Go'));
expect(buttonContext, isNotNull); expect(buttonContext, isNotNull);
Future<DateTime> date = showDatePicker( final Future<DateTime> date = showDatePicker(
context: buttonContext, context: buttonContext,
initialDate: initialDate, initialDate: initialDate,
firstDate: firstDate, firstDate: firstDate,
...@@ -196,7 +196,7 @@ void main() { ...@@ -196,7 +196,7 @@ void main() {
await tester.pump(); await tester.pump();
await tester.tap(find.text('2005')); await tester.tap(find.text('2005'));
await tester.pump(); await tester.pump();
String dayLabel = new DateFormat('E, MMM\u00a0d').format(new DateTime(2005, DateTime.JANUARY, 15)); final String dayLabel = new DateFormat('E, MMM\u00a0d').format(new DateTime(2005, DateTime.JANUARY, 15));
await tester.tap(find.text(dayLabel)); await tester.tap(find.text(dayLabel));
await tester.pump(); await tester.pump();
await tester.tap(find.text('19')); await tester.tap(find.text('19'));
......
...@@ -89,8 +89,8 @@ void main() { ...@@ -89,8 +89,8 @@ void main() {
await tester.pump(); // start animation await tester.pump(); // start animation
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
StatefulElement widget = tester.element(find.byType(Material).last); final StatefulElement widget = tester.element(find.byType(Material).last);
Material materialconfig = widget.state.config; final Material materialconfig = widget.state.config;
//first and second expect check that the material is the dialog's one //first and second expect check that the material is the dialog's one
expect(materialconfig.type, MaterialType.card); expect(materialconfig.type, MaterialType.card);
expect(materialconfig.elevation, 24); expect(materialconfig.elevation, 24);
...@@ -111,9 +111,9 @@ void main() { ...@@ -111,9 +111,9 @@ void main() {
), ),
); );
BuildContext context = tester.element(find.text('Go')); final BuildContext context = tester.element(find.text('Go'));
Future<int> result = showDialog( final Future<int> result = showDialog(
context: context, context: context,
child: new SimpleDialog( child: new SimpleDialog(
title: new Text('Title'), title: new Text('Title'),
...@@ -152,7 +152,7 @@ void main() { ...@@ -152,7 +152,7 @@ void main() {
), ),
); );
BuildContext context = tester.element(find.text('Go')); final BuildContext context = tester.element(find.text('Go'));
showDialog<Null>( showDialog<Null>(
context: context, context: context,
......
...@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
testWidgets('Divider control test', (WidgetTester tester) async { testWidgets('Divider control test', (WidgetTester tester) async {
await tester.pumpWidget(new Center(child: new Divider())); await tester.pumpWidget(new Center(child: new Divider()));
RenderBox box = tester.firstRenderObject(find.byType(Divider)); final RenderBox box = tester.firstRenderObject(find.byType(Divider));
expect(box.size.height, 15.0); expect(box.size.height, 15.0);
}); });
} }
...@@ -31,7 +31,7 @@ void main() { ...@@ -31,7 +31,7 @@ void main() {
); );
expect(find.text('Archive'), findsNothing); expect(find.text('Archive'), findsNothing);
ScaffoldState state = tester.firstState(find.byType(Scaffold)); final ScaffoldState state = tester.firstState(find.byType(Scaffold));
state.openDrawer(); state.openDrawer();
await tester.pump(); await tester.pump();
......
...@@ -153,7 +153,7 @@ void main() { ...@@ -153,7 +153,7 @@ void main() {
testWidgets('Dropdown screen edges', (WidgetTester tester) async { testWidgets('Dropdown screen edges', (WidgetTester tester) async {
int value = 4; int value = 4;
List<DropdownMenuItem<int>> items = <DropdownMenuItem<int>>[]; final List<DropdownMenuItem<int>> items = <DropdownMenuItem<int>>[];
for (int i = 0; i < 20; ++i) for (int i = 0; i < 20; ++i)
items.add(new DropdownMenuItem<int>(value: i, child: new Text('$i'))); items.add(new DropdownMenuItem<int>(value: i, child: new Text('$i')));
...@@ -161,7 +161,7 @@ void main() { ...@@ -161,7 +161,7 @@ void main() {
value = newValue; value = newValue;
} }
DropdownButton<int> button = new DropdownButton<int>( final DropdownButton<int> button = new DropdownButton<int>(
value: value, value: value,
onChanged: handleChanged, onChanged: handleChanged,
items: items, items: items,
...@@ -204,15 +204,15 @@ void main() { ...@@ -204,15 +204,15 @@ void main() {
}); });
testWidgets('Dropdown button aligns selected menu item', (WidgetTester tester) async { testWidgets('Dropdown button aligns selected menu item', (WidgetTester tester) async {
Key buttonKey = new UniqueKey(); final Key buttonKey = new UniqueKey();
String value = 'two'; final String value = 'two';
Widget build() => buildFrame(buttonKey: buttonKey, value: value); Widget build() => buildFrame(buttonKey: buttonKey, value: value);
await tester.pumpWidget(build()); await tester.pumpWidget(build());
RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey)); final RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey));
assert(buttonBox.attached); assert(buttonBox.attached);
Point buttonOriginBeforeTap = buttonBox.localToGlobal(Point.origin); final Point buttonOriginBeforeTap = buttonBox.localToGlobal(Point.origin);
await tester.tap(find.text('two')); await tester.tap(find.text('two'));
await tester.pump(); await tester.pump();
...@@ -224,7 +224,7 @@ void main() { ...@@ -224,7 +224,7 @@ void main() {
// The selected dropdown item is both in menu we just popped up, and in // The selected dropdown item is both in menu we just popped up, and in
// the IndexedStack contained by the dropdown button. Both of them should // the IndexedStack contained by the dropdown button. Both of them should
// have the same origin and height as the dropdown button. // have the same origin and height as the dropdown button.
List<RenderObject> itemBoxes = tester.renderObjectList(find.byKey(const ValueKey<String>('two'))).toList(); final List<RenderObject> itemBoxes = tester.renderObjectList(find.byKey(const ValueKey<String>('two'))).toList();
expect(itemBoxes.length, equals(2)); expect(itemBoxes.length, equals(2));
for(RenderBox itemBox in itemBoxes) { for(RenderBox itemBox in itemBoxes) {
assert(itemBox.attached); assert(itemBox.attached);
...@@ -238,13 +238,13 @@ void main() { ...@@ -238,13 +238,13 @@ void main() {
}); });
testWidgets('Dropdown button with isDense:true aligns selected menu item', (WidgetTester tester) async { testWidgets('Dropdown button with isDense:true aligns selected menu item', (WidgetTester tester) async {
Key buttonKey = new UniqueKey(); final Key buttonKey = new UniqueKey();
String value = 'two'; final String value = 'two';
Widget build() => buildFrame(buttonKey: buttonKey, value: value, isDense: true); Widget build() => buildFrame(buttonKey: buttonKey, value: value, isDense: true);
await tester.pumpWidget(build()); await tester.pumpWidget(build());
RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey)); final RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey));
assert(buttonBox.attached); assert(buttonBox.attached);
await tester.tap(find.text('two')); await tester.tap(find.text('two'));
...@@ -254,18 +254,18 @@ void main() { ...@@ -254,18 +254,18 @@ void main() {
// The selected dropdown item is both in menu we just popped up, and in // The selected dropdown item is both in menu we just popped up, and in
// the IndexedStack contained by the dropdown button. Both of them should // the IndexedStack contained by the dropdown button. Both of them should
// have the same vertical center as the button. // have the same vertical center as the button.
List<RenderBox> itemBoxes = tester.renderObjectList(find.byKey(const ValueKey<String>('two'))).toList(); final List<RenderBox> itemBoxes = tester.renderObjectList(find.byKey(const ValueKey<String>('two'))).toList();
expect(itemBoxes.length, equals(2)); expect(itemBoxes.length, equals(2));
// When isDense is true, the button's height is reduced. The menu items' // When isDense is true, the button's height is reduced. The menu items'
// heights are not. // heights are not.
double menuItemHeight = itemBoxes.map((RenderBox box) => box.size.height).reduce(math.max); final double menuItemHeight = itemBoxes.map((RenderBox box) => box.size.height).reduce(math.max);
expect(menuItemHeight, greaterThan(buttonBox.size.height)); expect(menuItemHeight, greaterThan(buttonBox.size.height));
for(RenderBox itemBox in itemBoxes) { for(RenderBox itemBox in itemBoxes) {
assert(itemBox.attached); assert(itemBox.attached);
Point buttonBoxCenter = buttonBox.size.center(buttonBox.localToGlobal(Point.origin)); final Point buttonBoxCenter = buttonBox.size.center(buttonBox.localToGlobal(Point.origin));
Point itemBoxCenter = itemBox.size.center(itemBox.localToGlobal(Point.origin)); final Point itemBoxCenter = itemBox.size.center(itemBox.localToGlobal(Point.origin));
expect(buttonBoxCenter.y, equals(itemBoxCenter.y)); expect(buttonBoxCenter.y, equals(itemBoxCenter.y));
} }
...@@ -275,19 +275,19 @@ void main() { ...@@ -275,19 +275,19 @@ void main() {
}); });
testWidgets('Size of DropdownButton with null value', (WidgetTester tester) async { testWidgets('Size of DropdownButton with null value', (WidgetTester tester) async {
Key buttonKey = new UniqueKey(); final Key buttonKey = new UniqueKey();
String value; String value;
Widget build() => buildFrame(buttonKey: buttonKey, value: value); Widget build() => buildFrame(buttonKey: buttonKey, value: value);
await tester.pumpWidget(build()); await tester.pumpWidget(build());
RenderBox buttonBoxNullValue = tester.renderObject(find.byKey(buttonKey)); final RenderBox buttonBoxNullValue = tester.renderObject(find.byKey(buttonKey));
assert(buttonBoxNullValue.attached); assert(buttonBoxNullValue.attached);
value = 'three'; value = 'three';
await tester.pumpWidget(build()); await tester.pumpWidget(build());
RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey)); final RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey));
assert(buttonBox.attached); assert(buttonBox.attached);
// A Dropdown button with a null value should be the same size as a // A Dropdown button with a null value should be the same size as a
...@@ -297,7 +297,7 @@ void main() { ...@@ -297,7 +297,7 @@ void main() {
}); });
testWidgets('Layout of a DropdownButton with null value', (WidgetTester tester) async { testWidgets('Layout of a DropdownButton with null value', (WidgetTester tester) async {
Key buttonKey = new UniqueKey(); final Key buttonKey = new UniqueKey();
String value; String value;
void onChanged(String newValue) { void onChanged(String newValue) {
...@@ -307,7 +307,7 @@ void main() { ...@@ -307,7 +307,7 @@ void main() {
Widget build() => buildFrame(buttonKey: buttonKey, value: value, onChanged: onChanged); Widget build() => buildFrame(buttonKey: buttonKey, value: value, onChanged: onChanged);
await tester.pumpWidget(build()); await tester.pumpWidget(build());
RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey)); final RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey));
assert(buttonBox.attached); assert(buttonBox.attached);
// Show the menu. // Show the menu.
...@@ -325,7 +325,7 @@ void main() { ...@@ -325,7 +325,7 @@ void main() {
}); });
testWidgets('Size of DropdownButton with null value and a hint', (WidgetTester tester) async { testWidgets('Size of DropdownButton with null value and a hint', (WidgetTester tester) async {
Key buttonKey = new UniqueKey(); final Key buttonKey = new UniqueKey();
String value; String value;
// The hint will define the dropdown's width // The hint will define the dropdown's width
...@@ -333,13 +333,13 @@ void main() { ...@@ -333,13 +333,13 @@ void main() {
await tester.pumpWidget(build()); await tester.pumpWidget(build());
expect(find.text('onetwothree'), findsOneWidget); expect(find.text('onetwothree'), findsOneWidget);
RenderBox buttonBoxHintValue = tester.renderObject(find.byKey(buttonKey)); final RenderBox buttonBoxHintValue = tester.renderObject(find.byKey(buttonKey));
assert(buttonBoxHintValue.attached); assert(buttonBoxHintValue.attached);
value = 'three'; value = 'three';
await tester.pumpWidget(build()); await tester.pumpWidget(build());
RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey)); final RenderBox buttonBox = tester.renderObject(find.byKey(buttonKey));
assert(buttonBox.attached); assert(buttonBox.attached);
// A Dropdown button with a null value and a hint should be the same size as a // A Dropdown button with a null value and a hint should be the same size as a
......
...@@ -40,7 +40,7 @@ void main() { ...@@ -40,7 +40,7 @@ void main() {
) )
); );
IconTheme iconTheme = tester.firstWidget(find.byType(IconTheme)); final IconTheme iconTheme = tester.firstWidget(find.byType(IconTheme));
expect(iconTheme.data.color, equals(Colors.black26)); expect(iconTheme.data.color, equals(Colors.black26));
}); });
......
...@@ -32,7 +32,7 @@ void main() { ...@@ -32,7 +32,7 @@ void main() {
expect(find.text('A'), findsOneWidget); expect(find.text('A'), findsOneWidget);
expect(find.text('B'), findsNothing); expect(find.text('B'), findsNothing);
RenderBox box = tester.renderObject(find.byType(ExpansionPanelList)); RenderBox box = tester.renderObject(find.byType(ExpansionPanelList));
double oldHeight = box.size.height; final double oldHeight = box.size.height;
expect(find.byType(ExpandIcon), findsOneWidget); expect(find.byType(ExpandIcon), findsOneWidget);
await tester.tap(find.byType(ExpandIcon)); await tester.tap(find.byType(ExpandIcon));
expect(index, 0); expect(index, 0);
......
...@@ -20,7 +20,7 @@ void main() { ...@@ -20,7 +20,7 @@ void main() {
) )
); );
Finder title = find.text('X'); final Finder title = find.text('X');
Point center = tester.getCenter(title); Point center = tester.getCenter(title);
Size size = tester.getSize(title); Size size = tester.getSize(title);
expect(center.x, lessThan(400 - size.width / 2.0)); expect(center.x, lessThan(400 - size.width / 2.0));
......
...@@ -7,8 +7,8 @@ import 'package:flutter/material.dart'; ...@@ -7,8 +7,8 @@ import 'package:flutter/material.dart';
void main() { void main() {
testWidgets('GridTile control test', (WidgetTester tester) async { testWidgets('GridTile control test', (WidgetTester tester) async {
Key headerKey = new UniqueKey(); final Key headerKey = new UniqueKey();
Key footerKey = new UniqueKey(); final Key footerKey = new UniqueKey();
await tester.pumpWidget(new GridTile( await tester.pumpWidget(new GridTile(
header: new GridTileBar( header: new GridTileBar(
......
...@@ -32,7 +32,7 @@ void main() { ...@@ -32,7 +32,7 @@ void main() {
), ),
); );
RenderBox iconButton = tester.renderObject(find.byType(IconButton)); final RenderBox iconButton = tester.renderObject(find.byType(IconButton));
expect(iconButton.size, new Size(48.0, 48.0)); expect(iconButton.size, new Size(48.0, 48.0));
await tester.tap(find.byType(IconButton)); await tester.tap(find.byType(IconButton));
...@@ -52,7 +52,7 @@ void main() { ...@@ -52,7 +52,7 @@ void main() {
), ),
); );
RenderBox iconButton = tester.renderObject(find.byType(IconButton)); final RenderBox iconButton = tester.renderObject(find.byType(IconButton));
expect(iconButton.size, new Size(48.0, 48.0)); expect(iconButton.size, new Size(48.0, 48.0));
}); });
...@@ -70,7 +70,7 @@ void main() { ...@@ -70,7 +70,7 @@ void main() {
), ),
); );
RenderBox iconButton = tester.renderObject(find.byType(IconButton)); final RenderBox iconButton = tester.renderObject(find.byType(IconButton));
expect(iconButton.size, new Size(70.0, 70.0)); expect(iconButton.size, new Size(70.0, 70.0));
}); });
...@@ -88,7 +88,7 @@ void main() { ...@@ -88,7 +88,7 @@ void main() {
), ),
); );
RenderBox box = tester.renderObject(find.byType(IconButton)); final RenderBox box = tester.renderObject(find.byType(IconButton));
expect(box.size, new Size(80.0, 80.0)); expect(box.size, new Size(80.0, 80.0));
}); });
...@@ -109,7 +109,7 @@ void main() { ...@@ -109,7 +109,7 @@ void main() {
), ),
); );
RenderBox box = tester.renderObject(find.byType(IconButton)); final RenderBox box = tester.renderObject(find.byType(IconButton));
expect(box.size, new Size(48.0, 600.0)); expect(box.size, new Size(48.0, 600.0));
}); });
...@@ -126,7 +126,7 @@ void main() { ...@@ -126,7 +126,7 @@ void main() {
), ),
); );
RenderBox box = tester.renderObject(find.byType(IconButton)); final RenderBox box = tester.renderObject(find.byType(IconButton));
expect(box.size, new Size(96.0, 96.0)); expect(box.size, new Size(96.0, 96.0));
}); });
...@@ -185,8 +185,8 @@ void main() { ...@@ -185,8 +185,8 @@ void main() {
), ),
); );
RenderBox barBox = tester.renderObject(find.byType(AppBar)); final RenderBox barBox = tester.renderObject(find.byType(AppBar));
RenderBox iconBox = tester.renderObject(find.byType(IconButton)); final RenderBox iconBox = tester.renderObject(find.byType(IconButton));
expect(iconBox.size.height, equals(barBox.size.height)); expect(iconBox.size.height, equals(barBox.size.height));
}); });
} }
...@@ -15,7 +15,7 @@ void main() { ...@@ -15,7 +15,7 @@ void main() {
) )
); );
RenderBox renderObject = tester.renderObject(find.byType(Icon)); final RenderBox renderObject = tester.renderObject(find.byType(Icon));
expect(renderObject.size, equals(const Size.square(24.0))); expect(renderObject.size, equals(const Size.square(24.0)));
}); });
...@@ -29,7 +29,7 @@ void main() { ...@@ -29,7 +29,7 @@ void main() {
) )
); );
RenderBox renderObject = tester.renderObject(find.byType(Icon)); final RenderBox renderObject = tester.renderObject(find.byType(Icon));
expect(renderObject.size, equals(const Size.square(96.0))); expect(renderObject.size, equals(const Size.square(96.0)));
}); });
...@@ -43,7 +43,7 @@ void main() { ...@@ -43,7 +43,7 @@ void main() {
) )
); );
RenderBox renderObject = tester.renderObject(find.byType(Icon)); final RenderBox renderObject = tester.renderObject(find.byType(Icon));
expect(renderObject.size, equals(const Size.square(36.0))); expect(renderObject.size, equals(const Size.square(36.0)));
}); });
...@@ -60,7 +60,7 @@ void main() { ...@@ -60,7 +60,7 @@ void main() {
) )
); );
RenderBox renderObject = tester.renderObject(find.byType(Icon)); final RenderBox renderObject = tester.renderObject(find.byType(Icon));
expect(renderObject.size, equals(const Size.square(48.0))); expect(renderObject.size, equals(const Size.square(48.0)));
}); });
...@@ -74,7 +74,7 @@ void main() { ...@@ -74,7 +74,7 @@ void main() {
) )
); );
RenderBox renderObject = tester.renderObject(find.byType(Icon)); final RenderBox renderObject = tester.renderObject(find.byType(Icon));
expect(renderObject.size, equals(const Size.square(24.0))); expect(renderObject.size, equals(const Size.square(24.0)));
}); });
} }
...@@ -7,13 +7,13 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,13 +7,13 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
test('IconThemeData control test', () { test('IconThemeData control test', () {
IconThemeData data = new IconThemeData(color: Colors.green[500], opacity: 0.5, size: 16.0); final IconThemeData data = new IconThemeData(color: Colors.green[500], opacity: 0.5, size: 16.0);
expect(data, hasOneLineDescription); expect(data, hasOneLineDescription);
expect(data, equals(data.copyWith())); expect(data, equals(data.copyWith()));
expect(data.hashCode, equals(data.copyWith().hashCode)); expect(data.hashCode, equals(data.copyWith().hashCode));
IconThemeData lerped = IconThemeData.lerp(data, const IconThemeData.fallback(), 0.25); final IconThemeData lerped = IconThemeData.lerp(data, const IconThemeData.fallback(), 0.25);
expect(lerped.color, equals(Color.lerp(Colors.green[500], Colors.black, 0.25))); expect(lerped.color, equals(Color.lerp(Colors.green[500], Colors.black, 0.25)));
expect(lerped.opacity, equals(0.625)); expect(lerped.opacity, equals(0.625));
expect(lerped.size, equals(18.0)); expect(lerped.size, equals(18.0));
......
...@@ -20,7 +20,7 @@ void main() { ...@@ -20,7 +20,7 @@ void main() {
) )
); );
RenderBox renderObject = tester.renderObject(find.byType(ImageIcon)); final RenderBox renderObject = tester.renderObject(find.byType(ImageIcon));
expect(renderObject.size, equals(const Size.square(24.0))); expect(renderObject.size, equals(const Size.square(24.0)));
expect(find.byType(Image), findsOneWidget); expect(find.byType(Image), findsOneWidget);
}); });
...@@ -35,7 +35,7 @@ void main() { ...@@ -35,7 +35,7 @@ void main() {
), ),
); );
Image image = tester.widget(find.byType(Image)); final Image image = tester.widget(find.byType(Image));
expect(image, isNotNull); expect(image, isNotNull);
expect(image.color.alpha, equals(128)); expect(image.color.alpha, equals(128));
}); });
...@@ -50,7 +50,7 @@ void main() { ...@@ -50,7 +50,7 @@ void main() {
) )
); );
RenderBox renderObject = tester.renderObject(find.byType(ImageIcon)); final RenderBox renderObject = tester.renderObject(find.byType(ImageIcon));
expect(renderObject.size, equals(const Size.square(96.0))); expect(renderObject.size, equals(const Size.square(96.0)));
}); });
...@@ -64,7 +64,7 @@ void main() { ...@@ -64,7 +64,7 @@ void main() {
) )
); );
RenderBox renderObject = tester.renderObject(find.byType(ImageIcon)); final RenderBox renderObject = tester.renderObject(find.byType(ImageIcon));
expect(renderObject.size, equals(const Size.square(36.0))); expect(renderObject.size, equals(const Size.square(36.0)));
}); });
...@@ -81,7 +81,7 @@ void main() { ...@@ -81,7 +81,7 @@ void main() {
) )
); );
RenderBox renderObject = tester.renderObject(find.byType(ImageIcon)); final RenderBox renderObject = tester.renderObject(find.byType(ImageIcon));
expect(renderObject.size, equals(const Size.square(48.0))); expect(renderObject.size, equals(const Size.square(48.0)));
}); });
...@@ -95,7 +95,7 @@ void main() { ...@@ -95,7 +95,7 @@ void main() {
) )
); );
RenderBox renderObject = tester.renderObject(find.byType(ImageIcon)); final RenderBox renderObject = tester.renderObject(find.byType(ImageIcon));
expect(renderObject.size, equals(const Size.square(24.0))); expect(renderObject.size, equals(const Size.square(24.0)));
}); });
} }
...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
testWidgets('InkWell gestures control test', (WidgetTester tester) async { testWidgets('InkWell gestures control test', (WidgetTester tester) async {
List<String> log = <String>[]; final List<String> log = <String>[];
await tester.pumpWidget(new Material( await tester.pumpWidget(new Material(
child: new Center( child: new Center(
......
...@@ -26,7 +26,7 @@ void main() { ...@@ -26,7 +26,7 @@ void main() {
}); });
testWidgets('ListItem control test', (WidgetTester tester) async { testWidgets('ListItem control test', (WidgetTester tester) async {
List<String> titles = <String>[ 'first', 'second', 'third' ]; final List<String> titles = <String>[ 'first', 'second', 'third' ];
await tester.pumpWidget(new MaterialApp( await tester.pumpWidget(new MaterialApp(
home: new Material( home: new Material(
......
...@@ -39,7 +39,7 @@ void main() { ...@@ -39,7 +39,7 @@ void main() {
}); });
testWidgets('ListView scroll does not repaint', (WidgetTester tester) async { testWidgets('ListView scroll does not repaint', (WidgetTester tester) async {
List<Size> log = <Size>[]; final List<Size> log = <Size>[];
await tester.pumpWidget( await tester.pumpWidget(
new Column( new Column(
......
...@@ -52,11 +52,11 @@ void matches(BorderRadius borderRadius, RadiusType top, RadiusType bottom) { ...@@ -52,11 +52,11 @@ void matches(BorderRadius borderRadius, RadiusType top, RadiusType bottom) {
} }
BorderRadius getBorderRadius(WidgetTester tester, int index) { BorderRadius getBorderRadius(WidgetTester tester, int index) {
List<Element> containers = tester.elementList(find.byType(Container)) final List<Element> containers = tester.elementList(find.byType(Container))
.toList(); .toList();
Container container = containers[index + 2].widget; final Container container = containers[index + 2].widget;
BoxDecoration boxDecoration = container.decoration; final BoxDecoration boxDecoration = container.decoration;
return boxDecoration.borderRadius; return boxDecoration.borderRadius;
} }
...@@ -71,7 +71,7 @@ void main() { ...@@ -71,7 +71,7 @@ void main() {
) )
); );
RenderBox box = tester.renderObject(find.byType(MergeableMaterial)); final RenderBox box = tester.renderObject(find.byType(MergeableMaterial));
expect(box.size.height, equals(0)); expect(box.size.height, equals(0));
}); });
...@@ -242,7 +242,7 @@ void main() { ...@@ -242,7 +242,7 @@ void main() {
) )
); );
RenderBox box = tester.renderObject(find.byType(MergeableMaterial)); final RenderBox box = tester.renderObject(find.byType(MergeableMaterial));
expect(box.size.height, equals(216)); expect(box.size.height, equals(216));
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round); matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
...@@ -312,7 +312,7 @@ void main() { ...@@ -312,7 +312,7 @@ void main() {
) )
); );
RenderBox box = tester.renderObject(find.byType(MergeableMaterial)); final RenderBox box = tester.renderObject(find.byType(MergeableMaterial));
expect(box.size.height, equals(200)); expect(box.size.height, equals(200));
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round); matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
...@@ -384,7 +384,7 @@ void main() { ...@@ -384,7 +384,7 @@ void main() {
) )
); );
RenderBox box = tester.renderObject(find.byType(MergeableMaterial)); final RenderBox box = tester.renderObject(find.byType(MergeableMaterial));
expect(box.size.height, equals(200)); expect(box.size.height, equals(200));
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round); matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
...@@ -533,7 +533,7 @@ void main() { ...@@ -533,7 +533,7 @@ void main() {
) )
); );
RenderBox box = tester.renderObject(find.byType(MergeableMaterial)); final RenderBox box = tester.renderObject(find.byType(MergeableMaterial));
expect(box.size.height, equals(200)); expect(box.size.height, equals(200));
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round); matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
...@@ -608,7 +608,7 @@ void main() { ...@@ -608,7 +608,7 @@ void main() {
) )
); );
RenderBox box = tester.renderObject(find.byType(MergeableMaterial)); final RenderBox box = tester.renderObject(find.byType(MergeableMaterial));
expect(box.size.height, equals(300)); expect(box.size.height, equals(300));
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round); matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
...@@ -670,7 +670,7 @@ void main() { ...@@ -670,7 +670,7 @@ void main() {
) )
); );
RenderBox box = tester.renderObject(find.byType(MergeableMaterial)); final RenderBox box = tester.renderObject(find.byType(MergeableMaterial));
expect(box.size.height, equals(200)); expect(box.size.height, equals(200));
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round); matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
...@@ -767,7 +767,7 @@ void main() { ...@@ -767,7 +767,7 @@ void main() {
) )
); );
RenderBox box = tester.renderObject(find.byType(MergeableMaterial)); final RenderBox box = tester.renderObject(find.byType(MergeableMaterial));
expect(box.size.height, equals(332)); expect(box.size.height, equals(332));
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round); matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
...@@ -841,7 +841,7 @@ void main() { ...@@ -841,7 +841,7 @@ void main() {
) )
); );
RenderBox box = tester.renderObject(find.byType(MergeableMaterial)); final RenderBox box = tester.renderObject(find.byType(MergeableMaterial));
expect(box.size.height, equals(216)); expect(box.size.height, equals(216));
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round); matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
...@@ -939,7 +939,7 @@ void main() { ...@@ -939,7 +939,7 @@ void main() {
) )
); );
RenderBox box = tester.renderObject(find.byType(MergeableMaterial)); final RenderBox box = tester.renderObject(find.byType(MergeableMaterial));
expect(box.size.height, equals(332)); expect(box.size.height, equals(332));
matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round); matches(getBorderRadius(tester, 0), RadiusType.Round, RadiusType.Round);
......
...@@ -67,7 +67,7 @@ void main() { ...@@ -67,7 +67,7 @@ void main() {
}); });
testWidgets('Verify that a downwards fling dismisses a persistent BottomSheet', (WidgetTester tester) async { testWidgets('Verify that a downwards fling dismisses a persistent BottomSheet', (WidgetTester tester) async {
GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
bool showBottomSheetThenCalled = false; bool showBottomSheetThenCalled = false;
await tester.pumpWidget(new MaterialApp( await tester.pumpWidget(new MaterialApp(
...@@ -121,7 +121,7 @@ void main() { ...@@ -121,7 +121,7 @@ void main() {
testWidgets('Verify that dragging past the bottom dismisses a persistent BottomSheet', (WidgetTester tester) async { testWidgets('Verify that dragging past the bottom dismisses a persistent BottomSheet', (WidgetTester tester) async {
// This is a regression test for https://github.com/flutter/flutter/issues/5528 // This is a regression test for https://github.com/flutter/flutter/issues/5528
GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
await tester.pumpWidget(new MaterialApp( await tester.pumpWidget(new MaterialApp(
home: new Scaffold( home: new Scaffold(
......
...@@ -43,9 +43,9 @@ class TestDataSource extends DataTableSource { ...@@ -43,9 +43,9 @@ class TestDataSource extends DataTableSource {
void main() { void main() {
testWidgets('PaginatedDataTable paging', (WidgetTester tester) async { testWidgets('PaginatedDataTable paging', (WidgetTester tester) async {
TestDataSource source = new TestDataSource(); final TestDataSource source = new TestDataSource();
List<String> log = <String>[]; final List<String> log = <String>[];
await tester.pumpWidget(new MaterialApp( await tester.pumpWidget(new MaterialApp(
home: new PaginatedDataTable( home: new PaginatedDataTable(
...@@ -109,7 +109,7 @@ void main() { ...@@ -109,7 +109,7 @@ void main() {
TestDataSource source = new TestDataSource() TestDataSource source = new TestDataSource()
..generation = 42; ..generation = 42;
List<String> log = <String>[]; final List<String> log = <String>[];
Widget buildTable(TestDataSource source) { Widget buildTable(TestDataSource source) {
return new PaginatedDataTable( return new PaginatedDataTable(
...@@ -172,7 +172,7 @@ void main() { ...@@ -172,7 +172,7 @@ void main() {
expect(find.text('43'), findsNothing); expect(find.text('43'), findsNothing);
expect(find.text('15'), findsNWidgets(10)); expect(find.text('15'), findsNWidgets(10));
PaginatedDataTableState state = tester.state(find.byType(PaginatedDataTable)); final PaginatedDataTableState state = tester.state(find.byType(PaginatedDataTable));
expect(log, isEmpty); expect(log, isEmpty);
state.pageTo(23); state.pageTo(23);
......
...@@ -51,9 +51,9 @@ void main() { ...@@ -51,9 +51,9 @@ void main() {
testWidgets('LinearProgressIndicator causes a repaint when it changes', (WidgetTester tester) async { testWidgets('LinearProgressIndicator causes a repaint when it changes', (WidgetTester tester) async {
await tester.pumpWidget(new ListView(children: <Widget>[new LinearProgressIndicator(value: 0.0)])); await tester.pumpWidget(new ListView(children: <Widget>[new LinearProgressIndicator(value: 0.0)]));
List<Layer> layers1 = tester.layers; final List<Layer> layers1 = tester.layers;
await tester.pumpWidget(new ListView(children: <Widget>[new LinearProgressIndicator(value: 0.5)])); await tester.pumpWidget(new ListView(children: <Widget>[new LinearProgressIndicator(value: 0.5)]));
List<Layer> layers2 = tester.layers; final List<Layer> layers2 = tester.layers;
expect(layers1, isNot(equals(layers2))); expect(layers1, isNot(equals(layers2)));
}); });
} }
...@@ -7,8 +7,8 @@ import 'package:flutter/material.dart'; ...@@ -7,8 +7,8 @@ import 'package:flutter/material.dart';
void main() { void main() {
testWidgets('Radio control test', (WidgetTester tester) async { testWidgets('Radio control test', (WidgetTester tester) async {
Key key = new UniqueKey(); final Key key = new UniqueKey();
List<int> log = <int>[]; final List<int> log = <int>[];
await tester.pumpWidget(new Material( await tester.pumpWidget(new Material(
child: new Center( child: new Center(
......
...@@ -8,7 +8,7 @@ import 'package:flutter/rendering.dart'; ...@@ -8,7 +8,7 @@ import 'package:flutter/rendering.dart';
void main() { void main() {
testWidgets('Scaffold control test', (WidgetTester tester) async { testWidgets('Scaffold control test', (WidgetTester tester) async {
Key bodyKey = new UniqueKey(); final Key bodyKey = new UniqueKey();
await tester.pumpWidget(new Scaffold( await tester.pumpWidget(new Scaffold(
appBar: new AppBar(title: new Text('Title')), appBar: new AppBar(title: new Text('Title')),
body: new Container(key: bodyKey) body: new Container(key: bodyKey)
...@@ -42,7 +42,7 @@ void main() { ...@@ -42,7 +42,7 @@ void main() {
}); });
testWidgets('Scaffold large bottom padding test', (WidgetTester tester) async { testWidgets('Scaffold large bottom padding test', (WidgetTester tester) async {
Key bodyKey = new UniqueKey(); final Key bodyKey = new UniqueKey();
await tester.pumpWidget(new MediaQuery( await tester.pumpWidget(new MediaQuery(
data: new MediaQueryData( data: new MediaQueryData(
padding: const EdgeInsets.only(bottom: 700.0), padding: const EdgeInsets.only(bottom: 700.0),
...@@ -52,7 +52,7 @@ void main() { ...@@ -52,7 +52,7 @@ void main() {
), ),
)); ));
RenderBox bodyBox = tester.renderObject(find.byKey(bodyKey)); final RenderBox bodyBox = tester.renderObject(find.byKey(bodyKey));
expect(bodyBox.size, equals(const Size(800.0, 0.0))); expect(bodyBox.size, equals(const Size(800.0, 0.0)));
await tester.pumpWidget(new MediaQuery( await tester.pumpWidget(new MediaQuery(
...@@ -118,10 +118,10 @@ void main() { ...@@ -118,10 +118,10 @@ void main() {
}); });
testWidgets('Drawer scrolling', (WidgetTester tester) async { testWidgets('Drawer scrolling', (WidgetTester tester) async {
Key drawerKey = new UniqueKey(); final Key drawerKey = new UniqueKey();
const double appBarHeight = 256.0; const double appBarHeight = 256.0;
ScrollController scrollOffset = new ScrollController(); final ScrollController scrollOffset = new ScrollController();
await tester.pumpWidget( await tester.pumpWidget(
new MaterialApp( new MaterialApp(
...@@ -157,7 +157,7 @@ void main() { ...@@ -157,7 +157,7 @@ void main() {
) )
); );
ScaffoldState state = tester.firstState(find.byType(Scaffold)); final ScaffoldState state = tester.firstState(find.byType(Scaffold));
state.openDrawer(); state.openDrawer();
await tester.pump(); await tester.pump();
...@@ -171,7 +171,7 @@ void main() { ...@@ -171,7 +171,7 @@ void main() {
expect(scrollOffset.offset, scrollDelta); expect(scrollOffset.offset, scrollDelta);
RenderBox renderBox = tester.renderObject(find.byType(AppBar)); final RenderBox renderBox = tester.renderObject(find.byType(AppBar));
expect(renderBox.size.height, equals(appBarHeight)); expect(renderBox.size.height, equals(appBarHeight));
}); });
...@@ -222,7 +222,7 @@ void main() { ...@@ -222,7 +222,7 @@ void main() {
}); });
testWidgets('Bottom sheet cannot overlap app bar', (WidgetTester tester) async { testWidgets('Bottom sheet cannot overlap app bar', (WidgetTester tester) async {
Key sheetKey = new UniqueKey(); final Key sheetKey = new UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
new MaterialApp( new MaterialApp(
...@@ -254,11 +254,11 @@ void main() { ...@@ -254,11 +254,11 @@ void main() {
await tester.pump(); // start animation await tester.pump(); // start animation
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
RenderBox appBarBox = tester.renderObject(find.byType(AppBar)); final RenderBox appBarBox = tester.renderObject(find.byType(AppBar));
RenderBox sheetBox = tester.renderObject(find.byKey(sheetKey)); final RenderBox sheetBox = tester.renderObject(find.byKey(sheetKey));
Point appBarBottomRight = appBarBox.localToGlobal(appBarBox.size.bottomRight(Point.origin)); final Point appBarBottomRight = appBarBox.localToGlobal(appBarBox.size.bottomRight(Point.origin));
Point sheetTopRight = sheetBox.localToGlobal(sheetBox.size.topRight(Point.origin)); final Point sheetTopRight = sheetBox.localToGlobal(sheetBox.size.topRight(Point.origin));
expect(appBarBottomRight, equals(sheetTopRight)); expect(appBarBottomRight, equals(sheetTopRight));
}); });
...@@ -297,7 +297,7 @@ void main() { ...@@ -297,7 +297,7 @@ void main() {
group('back arrow', () { group('back arrow', () {
Future<Null> expectBackIcon(WidgetTester tester, TargetPlatform platform, IconData expectedIcon) async { Future<Null> expectBackIcon(WidgetTester tester, TargetPlatform platform, IconData expectedIcon) async {
GlobalKey rootKey = new GlobalKey(); final GlobalKey rootKey = new GlobalKey();
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
'/': (_) => new Container(key: rootKey, child: new Text('Home')), '/': (_) => new Container(key: rootKey, child: new Text('Home')),
'/scaffold': (_) => new Scaffold( '/scaffold': (_) => new Scaffold(
...@@ -313,7 +313,7 @@ void main() { ...@@ -313,7 +313,7 @@ void main() {
await tester.pump(); await tester.pump();
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
Icon icon = tester.widget(find.byType(Icon)); final Icon icon = tester.widget(find.byType(Icon));
expect(icon.icon, expectedIcon); expect(icon.icon, expectedIcon);
} }
...@@ -332,7 +332,7 @@ void main() { ...@@ -332,7 +332,7 @@ void main() {
group('body size', () { group('body size', () {
testWidgets('body size with container', (WidgetTester tester) async { testWidgets('body size with container', (WidgetTester tester) async {
Key testKey = new UniqueKey(); final Key testKey = new UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
new Scaffold(body: new Container(key: testKey)) new Scaffold(body: new Container(key: testKey))
); );
...@@ -341,7 +341,7 @@ void main() { ...@@ -341,7 +341,7 @@ void main() {
}); });
testWidgets('body size with sized container', (WidgetTester tester) async { testWidgets('body size with sized container', (WidgetTester tester) async {
Key testKey = new UniqueKey(); final Key testKey = new UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
new Scaffold(body: new Container(key: testKey, height: 100.0)) new Scaffold(body: new Container(key: testKey, height: 100.0))
); );
...@@ -350,7 +350,7 @@ void main() { ...@@ -350,7 +350,7 @@ void main() {
}); });
testWidgets('body size with centered container', (WidgetTester tester) async { testWidgets('body size with centered container', (WidgetTester tester) async {
Key testKey = new UniqueKey(); final Key testKey = new UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
new Scaffold(body: new Center(child: new Container(key: testKey))) new Scaffold(body: new Center(child: new Container(key: testKey)))
); );
...@@ -359,7 +359,7 @@ void main() { ...@@ -359,7 +359,7 @@ void main() {
}); });
testWidgets('body size with button', (WidgetTester tester) async { testWidgets('body size with button', (WidgetTester tester) async {
Key testKey = new UniqueKey(); final Key testKey = new UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
new Scaffold(body: new FlatButton(key: testKey, onPressed: () { }, child: new Text(''))) new Scaffold(body: new FlatButton(key: testKey, onPressed: () { }, child: new Text('')))
); );
......
...@@ -10,7 +10,7 @@ import '../rendering/mock_canvas.dart'; ...@@ -10,7 +10,7 @@ import '../rendering/mock_canvas.dart';
void main() { void main() {
testWidgets('Slider can move when tapped', (WidgetTester tester) async { testWidgets('Slider can move when tapped', (WidgetTester tester) async {
Key sliderKey = new UniqueKey(); final Key sliderKey = new UniqueKey();
double value = 0.0; double value = 0.0;
await tester.pumpWidget( await tester.pumpWidget(
...@@ -41,7 +41,7 @@ void main() { ...@@ -41,7 +41,7 @@ void main() {
}); });
testWidgets('Slider take on discrete values', (WidgetTester tester) async { testWidgets('Slider take on discrete values', (WidgetTester tester) async {
Key sliderKey = new UniqueKey(); final Key sliderKey = new UniqueKey();
double value = 0.0; double value = 0.0;
await tester.pumpWidget( await tester.pumpWidget(
...@@ -147,8 +147,8 @@ void main() { ...@@ -147,8 +147,8 @@ void main() {
), ),
)); ));
Point center = tester.getCenter(find.byType(Slider)); final Point center = tester.getCenter(find.byType(Slider));
TestGesture gesture = await tester.startGesture(center); final TestGesture gesture = await tester.startGesture(center);
expect(value, equals(0.5)); expect(value, equals(0.5));
......
...@@ -7,8 +7,8 @@ import 'package:flutter/material.dart'; ...@@ -7,8 +7,8 @@ import 'package:flutter/material.dart';
void main() { void main() {
testWidgets('SnackBar control test', (WidgetTester tester) async { testWidgets('SnackBar control test', (WidgetTester tester) async {
String helloSnackBar = 'Hello SnackBar'; final String helloSnackBar = 'Hello SnackBar';
Key tapTarget = const Key('tap-target'); final Key tapTarget = const Key('tap-target');
await tester.pumpWidget(new MaterialApp( await tester.pumpWidget(new MaterialApp(
home: new Scaffold( home: new Scaffold(
body: new Builder( body: new Builder(
...@@ -53,7 +53,7 @@ void main() { ...@@ -53,7 +53,7 @@ void main() {
testWidgets('SnackBar twice test', (WidgetTester tester) async { testWidgets('SnackBar twice test', (WidgetTester tester) async {
int snackBarCount = 0; int snackBarCount = 0;
Key tapTarget = const Key('tap-target'); final Key tapTarget = const Key('tap-target');
await tester.pumpWidget(new MaterialApp( await tester.pumpWidget(new MaterialApp(
home: new Scaffold( home: new Scaffold(
body: new Builder( body: new Builder(
...@@ -128,7 +128,7 @@ void main() { ...@@ -128,7 +128,7 @@ void main() {
testWidgets('SnackBar cancel test', (WidgetTester tester) async { testWidgets('SnackBar cancel test', (WidgetTester tester) async {
int snackBarCount = 0; int snackBarCount = 0;
Key tapTarget = const Key('tap-target'); final Key tapTarget = const Key('tap-target');
int time; int time;
ScaffoldFeatureController<SnackBar, SnackBarClosedReason> lastController; ScaffoldFeatureController<SnackBar, SnackBarClosedReason> lastController;
await tester.pumpWidget(new MaterialApp( await tester.pumpWidget(new MaterialApp(
...@@ -158,7 +158,7 @@ void main() { ...@@ -158,7 +158,7 @@ void main() {
expect(find.text('bar2'), findsNothing); expect(find.text('bar2'), findsNothing);
time = 1000; time = 1000;
await tester.tap(find.byKey(tapTarget)); // queue bar1 await tester.tap(find.byKey(tapTarget)); // queue bar1
ScaffoldFeatureController<SnackBar, SnackBarClosedReason> firstController = lastController; final ScaffoldFeatureController<SnackBar, SnackBarClosedReason> firstController = lastController;
time = 2; time = 2;
await tester.tap(find.byKey(tapTarget)); // queue bar2 await tester.tap(find.byKey(tapTarget)); // queue bar2
expect(find.text('bar1'), findsNothing); expect(find.text('bar1'), findsNothing);
...@@ -214,7 +214,7 @@ void main() { ...@@ -214,7 +214,7 @@ void main() {
testWidgets('SnackBar dismiss test', (WidgetTester tester) async { testWidgets('SnackBar dismiss test', (WidgetTester tester) async {
int snackBarCount = 0; int snackBarCount = 0;
Key tapTarget = const Key('tap-target'); final Key tapTarget = const Key('tap-target');
await tester.pumpWidget(new MaterialApp( await tester.pumpWidget(new MaterialApp(
home: new Scaffold( home: new Scaffold(
body: new Builder( body: new Builder(
...@@ -319,16 +319,16 @@ void main() { ...@@ -319,16 +319,16 @@ void main() {
await tester.pump(); // start animation await tester.pump(); // start animation
await tester.pump(const Duration(milliseconds: 750)); await tester.pump(const Duration(milliseconds: 750));
RenderBox textBox = tester.firstRenderObject(find.text('I am a snack bar.')); final RenderBox textBox = tester.firstRenderObject(find.text('I am a snack bar.'));
RenderBox actionTextBox = tester.firstRenderObject(find.text('ACTION')); final RenderBox actionTextBox = tester.firstRenderObject(find.text('ACTION'));
RenderBox snackBarBox = tester.firstRenderObject(find.byType(SnackBar)); final RenderBox snackBarBox = tester.firstRenderObject(find.byType(SnackBar));
Point textBottomLeft = textBox.localToGlobal(textBox.size.bottomLeft(Point.origin)); final Point textBottomLeft = textBox.localToGlobal(textBox.size.bottomLeft(Point.origin));
Point textBottomRight = textBox.localToGlobal(textBox.size.bottomRight(Point.origin)); final Point textBottomRight = textBox.localToGlobal(textBox.size.bottomRight(Point.origin));
Point actionTextBottomLeft = actionTextBox.localToGlobal(actionTextBox.size.bottomLeft(Point.origin)); final Point actionTextBottomLeft = actionTextBox.localToGlobal(actionTextBox.size.bottomLeft(Point.origin));
Point actionTextBottomRight = actionTextBox.localToGlobal(actionTextBox.size.bottomRight(Point.origin)); final Point actionTextBottomRight = actionTextBox.localToGlobal(actionTextBox.size.bottomRight(Point.origin));
Point snackBarBottomLeft = snackBarBox.localToGlobal(snackBarBox.size.bottomLeft(Point.origin)); final Point snackBarBottomLeft = snackBarBox.localToGlobal(snackBarBox.size.bottomLeft(Point.origin));
Point snackBarBottomRight = snackBarBox.localToGlobal(snackBarBox.size.bottomRight(Point.origin)); final Point snackBarBottomRight = snackBarBox.localToGlobal(snackBarBox.size.bottomRight(Point.origin));
expect(textBottomLeft.x - snackBarBottomLeft.x, 24.0); expect(textBottomLeft.x - snackBarBottomLeft.x, 24.0);
expect(actionTextBottomLeft.x - textBottomRight.x, 24.0); expect(actionTextBottomLeft.x - textBottomRight.x, 24.0);
......
...@@ -121,7 +121,7 @@ void main() { ...@@ -121,7 +121,7 @@ void main() {
) )
); );
RenderBox box = tester.renderObject(find.byType(Stepper)); final RenderBox box = tester.renderObject(find.byType(Stepper));
expect(box.size.height, 600.0); expect(box.size.height, 600.0);
}); });
...@@ -276,7 +276,7 @@ void main() { ...@@ -276,7 +276,7 @@ void main() {
) )
); );
ScrollableState scrollableState = tester.firstState(find.byType(Scrollable)); final ScrollableState scrollableState = tester.firstState(find.byType(Scrollable));
expect(scrollableState.position.pixels, 0.0); expect(scrollableState.position.pixels, 0.0);
await tester.tap(find.text('Step 3')); await tester.tap(find.text('Step 3'));
......
...@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
testWidgets('Switch can toggle on tap', (WidgetTester tester) async { testWidgets('Switch can toggle on tap', (WidgetTester tester) async {
Key switchKey = new UniqueKey(); final Key switchKey = new UniqueKey();
bool value = false; bool value = false;
await tester.pumpWidget( await tester.pumpWidget(
......
...@@ -7,14 +7,14 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,14 +7,14 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
test('Theme data control test', () { test('Theme data control test', () {
ThemeData dark = new ThemeData.dark(); final ThemeData dark = new ThemeData.dark();
expect(dark, hasOneLineDescription); expect(dark, hasOneLineDescription);
expect(dark, equals(dark.copyWith())); expect(dark, equals(dark.copyWith()));
expect(dark.hashCode, equals(dark.copyWith().hashCode)); expect(dark.hashCode, equals(dark.copyWith().hashCode));
ThemeData light = new ThemeData.light(); final ThemeData light = new ThemeData.light();
ThemeData dawn = ThemeData.lerp(dark, light, 0.25); final ThemeData dawn = ThemeData.lerp(dark, light, 0.25);
expect(dawn.brightness, Brightness.dark); expect(dawn.brightness, Brightness.dark);
expect(dawn.primaryColor, Color.lerp(dark.primaryColor, light.primaryColor, 0.25)); expect(dawn.primaryColor, Color.lerp(dark.primaryColor, light.primaryColor, 0.25));
...@@ -22,61 +22,61 @@ void main() { ...@@ -22,61 +22,61 @@ void main() {
test('Defaults to the default typography for the platform', () { test('Defaults to the default typography for the platform', () {
for (TargetPlatform platform in TargetPlatform.values) { for (TargetPlatform platform in TargetPlatform.values) {
ThemeData theme = new ThemeData(platform: platform); final ThemeData theme = new ThemeData(platform: platform);
Typography typography = new Typography(platform: platform); final Typography typography = new Typography(platform: platform);
expect(theme.textTheme, typography.black, reason: 'Not using default typography for $platform'); expect(theme.textTheme, typography.black, reason: 'Not using default typography for $platform');
} }
}); });
test('Default text theme contrasts with brightness', () { test('Default text theme contrasts with brightness', () {
ThemeData lightTheme = new ThemeData(brightness: Brightness.light); final ThemeData lightTheme = new ThemeData(brightness: Brightness.light);
ThemeData darkTheme = new ThemeData(brightness: Brightness.dark); final ThemeData darkTheme = new ThemeData(brightness: Brightness.dark);
Typography typography = new Typography(platform: lightTheme.platform); final Typography typography = new Typography(platform: lightTheme.platform);
expect(lightTheme.textTheme.title.color, typography.black.title.color); expect(lightTheme.textTheme.title.color, typography.black.title.color);
expect(darkTheme.textTheme.title.color, typography.white.title.color); expect(darkTheme.textTheme.title.color, typography.white.title.color);
}); });
test('Default primary text theme contrasts with primary brightness', () { test('Default primary text theme contrasts with primary brightness', () {
ThemeData lightTheme = new ThemeData(primaryColorBrightness: Brightness.light); final ThemeData lightTheme = new ThemeData(primaryColorBrightness: Brightness.light);
ThemeData darkTheme = new ThemeData(primaryColorBrightness: Brightness.dark); final ThemeData darkTheme = new ThemeData(primaryColorBrightness: Brightness.dark);
Typography typography = new Typography(platform: lightTheme.platform); final Typography typography = new Typography(platform: lightTheme.platform);
expect(lightTheme.primaryTextTheme.title.color, typography.black.title.color); expect(lightTheme.primaryTextTheme.title.color, typography.black.title.color);
expect(darkTheme.primaryTextTheme.title.color, typography.white.title.color); expect(darkTheme.primaryTextTheme.title.color, typography.white.title.color);
}); });
test('Default accent text theme contrasts with accent brightness', () { test('Default accent text theme contrasts with accent brightness', () {
ThemeData lightTheme = new ThemeData(accentColorBrightness: Brightness.light); final ThemeData lightTheme = new ThemeData(accentColorBrightness: Brightness.light);
ThemeData darkTheme = new ThemeData(accentColorBrightness: Brightness.dark); final ThemeData darkTheme = new ThemeData(accentColorBrightness: Brightness.dark);
Typography typography = new Typography(platform: lightTheme.platform); final Typography typography = new Typography(platform: lightTheme.platform);
expect(lightTheme.accentTextTheme.title.color, typography.black.title.color); expect(lightTheme.accentTextTheme.title.color, typography.black.title.color);
expect(darkTheme.accentTextTheme.title.color, typography.white.title.color); expect(darkTheme.accentTextTheme.title.color, typography.white.title.color);
}); });
test('Default icon theme contrasts with brightness', () { test('Default icon theme contrasts with brightness', () {
ThemeData lightTheme = new ThemeData(brightness: Brightness.light); final ThemeData lightTheme = new ThemeData(brightness: Brightness.light);
ThemeData darkTheme = new ThemeData(brightness: Brightness.dark); final ThemeData darkTheme = new ThemeData(brightness: Brightness.dark);
Typography typography = new Typography(platform: lightTheme.platform); final Typography typography = new Typography(platform: lightTheme.platform);
expect(lightTheme.textTheme.title.color, typography.black.title.color); expect(lightTheme.textTheme.title.color, typography.black.title.color);
expect(darkTheme.textTheme.title.color, typography.white.title.color); expect(darkTheme.textTheme.title.color, typography.white.title.color);
}); });
test('Default primary icon theme contrasts with primary brightness', () { test('Default primary icon theme contrasts with primary brightness', () {
ThemeData lightTheme = new ThemeData(primaryColorBrightness: Brightness.light); final ThemeData lightTheme = new ThemeData(primaryColorBrightness: Brightness.light);
ThemeData darkTheme = new ThemeData(primaryColorBrightness: Brightness.dark); final ThemeData darkTheme = new ThemeData(primaryColorBrightness: Brightness.dark);
Typography typography = new Typography(platform: lightTheme.platform); final Typography typography = new Typography(platform: lightTheme.platform);
expect(lightTheme.primaryTextTheme.title.color, typography.black.title.color); expect(lightTheme.primaryTextTheme.title.color, typography.black.title.color);
expect(darkTheme.primaryTextTheme.title.color, typography.white.title.color); expect(darkTheme.primaryTextTheme.title.color, typography.white.title.color);
}); });
test('Default accent icon theme contrasts with accent brightness', () { test('Default accent icon theme contrasts with accent brightness', () {
ThemeData lightTheme = new ThemeData(accentColorBrightness: Brightness.light); final ThemeData lightTheme = new ThemeData(accentColorBrightness: Brightness.light);
ThemeData darkTheme = new ThemeData(accentColorBrightness: Brightness.dark); final ThemeData darkTheme = new ThemeData(accentColorBrightness: Brightness.dark);
Typography typography = new Typography(platform: lightTheme.platform); final Typography typography = new Typography(platform: lightTheme.platform);
expect(lightTheme.accentTextTheme.title.color, typography.black.title.color); expect(lightTheme.accentTextTheme.title.color, typography.black.title.color);
expect(darkTheme.accentTextTheme.title.color, typography.white.title.color); expect(darkTheme.accentTextTheme.title.color, typography.white.title.color);
......
...@@ -7,9 +7,9 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,9 +7,9 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
test('ThemeDataTween control test', () { test('ThemeDataTween control test', () {
ThemeData light = new ThemeData.light(); final ThemeData light = new ThemeData.light();
ThemeData dark = new ThemeData.light(); final ThemeData dark = new ThemeData.light();
ThemeDataTween tween = new ThemeDataTween(begin: light, end: dark); final ThemeDataTween tween = new ThemeDataTween(begin: light, end: dark);
expect(tween.lerp(0.25), equals(ThemeData.lerp(light, dark, 0.25))); expect(tween.lerp(0.25), equals(ThemeData.lerp(light, dark, 0.25)));
}); });
...@@ -226,7 +226,7 @@ void main() { ...@@ -226,7 +226,7 @@ void main() {
await tester.tap(find.text('SHOW')); await tester.tap(find.text('SHOW'));
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
List<Material> materials = tester.widgetList(find.byType(Material)).toList(); final List<Material> materials = tester.widgetList(find.byType(Material)).toList();
expect(materials.length, equals(2)); expect(materials.length, equals(2));
expect(materials[0].color, green); // app scaffold expect(materials[0].color, green); // app scaffold
expect(materials[1].color, green); // dialog scaffold expect(materials[1].color, green); // dialog scaffold
......
...@@ -76,11 +76,11 @@ void main() { ...@@ -76,11 +76,11 @@ void main() {
testWidgets('drag-select an hour', (WidgetTester tester) async { testWidgets('drag-select an hour', (WidgetTester tester) async {
TimeOfDay result; TimeOfDay result;
Point center = await startPicker(tester, (TimeOfDay time) { result = time; }); final Point center = await startPicker(tester, (TimeOfDay time) { result = time; });
Point hour0 = new Point(center.x, center.y - 50.0); // 12:00 AM final Point hour0 = new Point(center.x, center.y - 50.0); // 12:00 AM
Point hour3 = new Point(center.x + 50.0, center.y); final Point hour3 = new Point(center.x + 50.0, center.y);
Point hour6 = new Point(center.x, center.y + 50.0); final Point hour6 = new Point(center.x, center.y + 50.0);
Point hour9 = new Point(center.x - 50.0, center.y); final Point hour9 = new Point(center.x - 50.0, center.y);
TestGesture gesture; TestGesture gesture;
...@@ -129,14 +129,14 @@ void main() { ...@@ -129,14 +129,14 @@ void main() {
}); });
testWidgets('tap-select vibrates once', (WidgetTester tester) async { testWidgets('tap-select vibrates once', (WidgetTester tester) async {
Point center = await startPicker(tester, (TimeOfDay time) { }); final Point center = await startPicker(tester, (TimeOfDay time) { });
await tester.tapAt(new Point(center.x, center.y - 50.0)); await tester.tapAt(new Point(center.x, center.y - 50.0));
await finishPicker(tester); await finishPicker(tester);
expect(hapticFeedbackCount, 1); expect(hapticFeedbackCount, 1);
}); });
testWidgets('quick successive tap-selects vibrate once', (WidgetTester tester) async { testWidgets('quick successive tap-selects vibrate once', (WidgetTester tester) async {
Point center = await startPicker(tester, (TimeOfDay time) { }); final Point center = await startPicker(tester, (TimeOfDay time) { });
await tester.tapAt(new Point(center.x, center.y - 50.0)); await tester.tapAt(new Point(center.x, center.y - 50.0));
await tester.pump(kFastFeedbackInterval); await tester.pump(kFastFeedbackInterval);
await tester.tapAt(new Point(center.x, center.y + 50.0)); await tester.tapAt(new Point(center.x, center.y + 50.0));
...@@ -145,7 +145,7 @@ void main() { ...@@ -145,7 +145,7 @@ void main() {
}); });
testWidgets('slow successive tap-selects vibrate once per tap', (WidgetTester tester) async { testWidgets('slow successive tap-selects vibrate once per tap', (WidgetTester tester) async {
Point center = await startPicker(tester, (TimeOfDay time) { }); final Point center = await startPicker(tester, (TimeOfDay time) { });
await tester.tapAt(new Point(center.x, center.y - 50.0)); await tester.tapAt(new Point(center.x, center.y - 50.0));
await tester.pump(kSlowFeedbackInterval); await tester.pump(kSlowFeedbackInterval);
await tester.tapAt(new Point(center.x, center.y + 50.0)); await tester.tapAt(new Point(center.x, center.y + 50.0));
...@@ -156,11 +156,11 @@ void main() { ...@@ -156,11 +156,11 @@ void main() {
}); });
testWidgets('drag-select vibrates once', (WidgetTester tester) async { testWidgets('drag-select vibrates once', (WidgetTester tester) async {
Point center = await startPicker(tester, (TimeOfDay time) { }); final Point center = await startPicker(tester, (TimeOfDay time) { });
Point hour0 = new Point(center.x, center.y - 50.0); final Point hour0 = new Point(center.x, center.y - 50.0);
Point hour3 = new Point(center.x + 50.0, center.y); final Point hour3 = new Point(center.x + 50.0, center.y);
TestGesture gesture = await tester.startGesture(hour3); final TestGesture gesture = await tester.startGesture(hour3);
await gesture.moveBy(hour0 - hour3); await gesture.moveBy(hour0 - hour3);
await gesture.up(); await gesture.up();
await finishPicker(tester); await finishPicker(tester);
...@@ -168,11 +168,11 @@ void main() { ...@@ -168,11 +168,11 @@ void main() {
}); });
testWidgets('quick drag-select vibrates once', (WidgetTester tester) async { testWidgets('quick drag-select vibrates once', (WidgetTester tester) async {
Point center = await startPicker(tester, (TimeOfDay time) { }); final Point center = await startPicker(tester, (TimeOfDay time) { });
Point hour0 = new Point(center.x, center.y - 50.0); final Point hour0 = new Point(center.x, center.y - 50.0);
Point hour3 = new Point(center.x + 50.0, center.y); final Point hour3 = new Point(center.x + 50.0, center.y);
TestGesture gesture = await tester.startGesture(hour3); final TestGesture gesture = await tester.startGesture(hour3);
await gesture.moveBy(hour0 - hour3); await gesture.moveBy(hour0 - hour3);
await tester.pump(kFastFeedbackInterval); await tester.pump(kFastFeedbackInterval);
await gesture.moveBy(hour3 - hour0); await gesture.moveBy(hour3 - hour0);
...@@ -184,11 +184,11 @@ void main() { ...@@ -184,11 +184,11 @@ void main() {
}); });
testWidgets('slow drag-select vibrates once', (WidgetTester tester) async { testWidgets('slow drag-select vibrates once', (WidgetTester tester) async {
Point center = await startPicker(tester, (TimeOfDay time) { }); final Point center = await startPicker(tester, (TimeOfDay time) { });
Point hour0 = new Point(center.x, center.y - 50.0); final Point hour0 = new Point(center.x, center.y - 50.0);
Point hour3 = new Point(center.x + 50.0, center.y); final Point hour3 = new Point(center.x + 50.0, center.y);
TestGesture gesture = await tester.startGesture(hour3); final TestGesture gesture = await tester.startGesture(hour3);
await gesture.moveBy(hour0 - hour3); await gesture.moveBy(hour0 - hour3);
await tester.pump(kSlowFeedbackInterval); await tester.pump(kSlowFeedbackInterval);
await gesture.moveBy(hour3 - hour0); await gesture.moveBy(hour3 - hour0);
......
...@@ -29,7 +29,7 @@ const String tooltipText = 'TIP'; ...@@ -29,7 +29,7 @@ const String tooltipText = 'TIP';
void main() { void main() {
testWidgets('Does tooltip end up in the right place - center', (WidgetTester tester) async { testWidgets('Does tooltip end up in the right place - center', (WidgetTester tester) async {
GlobalKey key = new GlobalKey(); final GlobalKey key = new GlobalKey();
await tester.pumpWidget( await tester.pumpWidget(
new Overlay( new Overlay(
initialEntries: <OverlayEntry>[ initialEntries: <OverlayEntry>[
...@@ -72,9 +72,9 @@ void main() { ...@@ -72,9 +72,9 @@ void main() {
* * * *
*********************/ *********************/
RenderBox tip = tester.renderObject(find.text(tooltipText)).parent.parent.parent.parent.parent; final RenderBox tip = tester.renderObject(find.text(tooltipText)).parent.parent.parent.parent.parent;
Point tipInGlobal = tip.localToGlobal(tip.size.topCenter(Point.origin)); final Point tipInGlobal = tip.localToGlobal(tip.size.topCenter(Point.origin));
// The exact position of the left side depends on the font the test framework // The exact position of the left side depends on the font the test framework
// happens to pick, so we don't test that. // happens to pick, so we don't test that.
expect(tipInGlobal.x, 300.0); expect(tipInGlobal.x, 300.0);
...@@ -82,7 +82,7 @@ void main() { ...@@ -82,7 +82,7 @@ void main() {
}); });
testWidgets('Does tooltip end up in the right place - top left', (WidgetTester tester) async { testWidgets('Does tooltip end up in the right place - top left', (WidgetTester tester) async {
GlobalKey key = new GlobalKey(); final GlobalKey key = new GlobalKey();
await tester.pumpWidget( await tester.pumpWidget(
new Overlay( new Overlay(
initialEntries: <OverlayEntry>[ initialEntries: <OverlayEntry>[
...@@ -125,13 +125,13 @@ void main() { ...@@ -125,13 +125,13 @@ void main() {
* * * *
*********************/ *********************/
RenderBox tip = tester.renderObject(find.text(tooltipText)).parent.parent.parent.parent.parent; final RenderBox tip = tester.renderObject(find.text(tooltipText)).parent.parent.parent.parent.parent;
expect(tip.size.height, equals(20.0)); // 10.0 height + 5.0 padding * 2 (top, bottom) expect(tip.size.height, equals(20.0)); // 10.0 height + 5.0 padding * 2 (top, bottom)
expect(tip.localToGlobal(tip.size.topLeft(Point.origin)), equals(const Point(10.0, 20.0))); expect(tip.localToGlobal(tip.size.topLeft(Point.origin)), equals(const Point(10.0, 20.0)));
}); });
testWidgets('Does tooltip end up in the right place - center prefer above fits', (WidgetTester tester) async { testWidgets('Does tooltip end up in the right place - center prefer above fits', (WidgetTester tester) async {
GlobalKey key = new GlobalKey(); final GlobalKey key = new GlobalKey();
await tester.pumpWidget( await tester.pumpWidget(
new Overlay( new Overlay(
initialEntries: <OverlayEntry>[ initialEntries: <OverlayEntry>[
...@@ -175,14 +175,14 @@ void main() { ...@@ -175,14 +175,14 @@ void main() {
* * * *
*********************/ *********************/
RenderBox tip = tester.renderObject(find.text(tooltipText)).parent; final RenderBox tip = tester.renderObject(find.text(tooltipText)).parent;
expect(tip.size.height, equals(100.0)); expect(tip.size.height, equals(100.0));
expect(tip.localToGlobal(tip.size.topLeft(Point.origin)).y, equals(100.0)); expect(tip.localToGlobal(tip.size.topLeft(Point.origin)).y, equals(100.0));
expect(tip.localToGlobal(tip.size.bottomRight(Point.origin)).y, equals(200.0)); expect(tip.localToGlobal(tip.size.bottomRight(Point.origin)).y, equals(200.0));
}); });
testWidgets('Does tooltip end up in the right place - center prefer above does not fit', (WidgetTester tester) async { testWidgets('Does tooltip end up in the right place - center prefer above does not fit', (WidgetTester tester) async {
GlobalKey key = new GlobalKey(); final GlobalKey key = new GlobalKey();
await tester.pumpWidget( await tester.pumpWidget(
new Overlay( new Overlay(
initialEntries: <OverlayEntry>[ initialEntries: <OverlayEntry>[
...@@ -237,14 +237,14 @@ void main() { ...@@ -237,14 +237,14 @@ void main() {
* * }- 10.0 margin * * }- 10.0 margin
*********************/ *********************/
RenderBox tip = tester.renderObject(find.text(tooltipText)).parent; final RenderBox tip = tester.renderObject(find.text(tooltipText)).parent;
expect(tip.size.height, equals(190.0)); expect(tip.size.height, equals(190.0));
expect(tip.localToGlobal(tip.size.topLeft(Point.origin)).y, equals(399.0)); expect(tip.localToGlobal(tip.size.topLeft(Point.origin)).y, equals(399.0));
expect(tip.localToGlobal(tip.size.bottomRight(Point.origin)).y, equals(589.0)); expect(tip.localToGlobal(tip.size.bottomRight(Point.origin)).y, equals(589.0));
}); });
testWidgets('Does tooltip end up in the right place - center prefer below fits', (WidgetTester tester) async { testWidgets('Does tooltip end up in the right place - center prefer below fits', (WidgetTester tester) async {
GlobalKey key = new GlobalKey(); final GlobalKey key = new GlobalKey();
await tester.pumpWidget( await tester.pumpWidget(
new Overlay( new Overlay(
initialEntries: <OverlayEntry>[ initialEntries: <OverlayEntry>[
...@@ -287,14 +287,14 @@ void main() { ...@@ -287,14 +287,14 @@ void main() {
* * }- 10.0 margin * * }- 10.0 margin
*********************/ *********************/
RenderBox tip = tester.renderObject(find.text(tooltipText)).parent; final RenderBox tip = tester.renderObject(find.text(tooltipText)).parent;
expect(tip.size.height, equals(190.0)); expect(tip.size.height, equals(190.0));
expect(tip.localToGlobal(tip.size.topLeft(Point.origin)).y, equals(400.0)); expect(tip.localToGlobal(tip.size.topLeft(Point.origin)).y, equals(400.0));
expect(tip.localToGlobal(tip.size.bottomRight(Point.origin)).y, equals(590.0)); expect(tip.localToGlobal(tip.size.bottomRight(Point.origin)).y, equals(590.0));
}); });
testWidgets('Does tooltip end up in the right place - way off to the right', (WidgetTester tester) async { testWidgets('Does tooltip end up in the right place - way off to the right', (WidgetTester tester) async {
GlobalKey key = new GlobalKey(); final GlobalKey key = new GlobalKey();
await tester.pumpWidget( await tester.pumpWidget(
new Overlay( new Overlay(
initialEntries: <OverlayEntry>[ initialEntries: <OverlayEntry>[
...@@ -338,7 +338,7 @@ void main() { ...@@ -338,7 +338,7 @@ void main() {
* * }-10.0 margin * * }-10.0 margin
*********************/ *********************/
RenderBox tip = tester.renderObject(find.text(tooltipText)).parent; final RenderBox tip = tester.renderObject(find.text(tooltipText)).parent;
expect(tip.size.height, equals(10.0)); expect(tip.size.height, equals(10.0));
expect(tip.localToGlobal(tip.size.topLeft(Point.origin)).y, equals(310.0)); expect(tip.localToGlobal(tip.size.topLeft(Point.origin)).y, equals(310.0));
expect(tip.localToGlobal(tip.size.bottomRight(Point.origin)).x, equals(790.0)); expect(tip.localToGlobal(tip.size.bottomRight(Point.origin)).x, equals(790.0));
...@@ -346,7 +346,7 @@ void main() { ...@@ -346,7 +346,7 @@ void main() {
}); });
testWidgets('Does tooltip end up in the right place - near the edge', (WidgetTester tester) async { testWidgets('Does tooltip end up in the right place - near the edge', (WidgetTester tester) async {
GlobalKey key = new GlobalKey(); final GlobalKey key = new GlobalKey();
await tester.pumpWidget( await tester.pumpWidget(
new Overlay( new Overlay(
initialEntries: <OverlayEntry>[ initialEntries: <OverlayEntry>[
...@@ -390,7 +390,7 @@ void main() { ...@@ -390,7 +390,7 @@ void main() {
* * }-10.0 margin * * }-10.0 margin
*********************/ *********************/
RenderBox tip = tester.renderObject(find.text(tooltipText)).parent; final RenderBox tip = tester.renderObject(find.text(tooltipText)).parent;
expect(tip.size.height, equals(10.0)); expect(tip.size.height, equals(10.0));
expect(tip.localToGlobal(tip.size.topLeft(Point.origin)).y, equals(310.0)); expect(tip.localToGlobal(tip.size.topLeft(Point.origin)).y, equals(310.0));
expect(tip.localToGlobal(tip.size.bottomRight(Point.origin)).x, equals(790.0)); expect(tip.localToGlobal(tip.size.bottomRight(Point.origin)).x, equals(790.0));
...@@ -415,7 +415,7 @@ void main() { ...@@ -415,7 +415,7 @@ void main() {
) )
); );
Finder tooltip = find.byType(Tooltip); final Finder tooltip = find.byType(Tooltip);
TestGesture gesture = await tester.startGesture(tester.getCenter(tooltip)); TestGesture gesture = await tester.startGesture(tester.getCenter(tooltip));
await tester.pump(kLongPressTimeout); await tester.pump(kLongPressTimeout);
await tester.pump(const Duration(milliseconds: 10)); await tester.pump(const Duration(milliseconds: 10));
...@@ -435,9 +435,9 @@ void main() { ...@@ -435,9 +435,9 @@ void main() {
}); });
testWidgets('Does tooltip contribute semantics', (WidgetTester tester) async { testWidgets('Does tooltip contribute semantics', (WidgetTester tester) async {
SemanticsTester semantics = new SemanticsTester(tester); final SemanticsTester semantics = new SemanticsTester(tester);
GlobalKey key = new GlobalKey(); final GlobalKey key = new GlobalKey();
await tester.pumpWidget( await tester.pumpWidget(
new Overlay( new Overlay(
initialEntries: <OverlayEntry>[ initialEntries: <OverlayEntry>[
......
...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
test('TextTheme control test', () { test('TextTheme control test', () {
Typography typography = new Typography(platform: TargetPlatform.android); final Typography typography = new Typography(platform: TargetPlatform.android);
expect(typography.black, equals(typography.black.copyWith())); expect(typography.black, equals(typography.black.copyWith()));
expect(typography.black, equals(typography.black.apply())); expect(typography.black, equals(typography.black.apply()));
expect(typography.black.hashCode, equals(typography.black.copyWith().hashCode)); expect(typography.black.hashCode, equals(typography.black.copyWith().hashCode));
...@@ -16,7 +16,7 @@ void main() { ...@@ -16,7 +16,7 @@ void main() {
test('Typography is defined for all target platforms', () { test('Typography is defined for all target platforms', () {
for (TargetPlatform platform in TargetPlatform.values) { for (TargetPlatform platform in TargetPlatform.values) {
Typography typography = new Typography(platform: platform); final Typography typography = new Typography(platform: platform);
expect(typography, isNotNull, reason: 'null typography for $platform'); expect(typography, isNotNull, reason: 'null typography for $platform');
expect(typography.black, isNotNull, reason: 'null black typography for $platform'); expect(typography.black, isNotNull, reason: 'null black typography for $platform');
expect(typography.white, isNotNull, reason: 'null white typography for $platform'); expect(typography.white, isNotNull, reason: 'null white typography for $platform');
...@@ -30,11 +30,11 @@ void main() { ...@@ -30,11 +30,11 @@ void main() {
test('Typography on iOS defaults to the correct SF font family based on size', () { test('Typography on iOS defaults to the correct SF font family based on size', () {
// Ref: https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/ // Ref: https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/
Matcher hasCorrectFont = predicate((TextStyle s) { final Matcher hasCorrectFont = predicate((TextStyle s) {
return s.fontFamily == (s.fontSize <= 19.0 ? '.SF UI Text' : '.SF UI Display'); return s.fontFamily == (s.fontSize <= 19.0 ? '.SF UI Text' : '.SF UI Display');
}, 'Uses SF Display font for font sizes over 19.0, otherwise SF Text font'); }, 'Uses SF Display font for font sizes over 19.0, otherwise SF Text font');
Typography typography = new Typography(platform: TargetPlatform.iOS); final Typography typography = new Typography(platform: TargetPlatform.iOS);
for (TextTheme textTheme in <TextTheme>[typography.black, typography.white]) { for (TextTheme textTheme in <TextTheme>[typography.black, typography.white]) {
expect(textTheme.display4, hasCorrectFont); expect(textTheme.display4, hasCorrectFont);
expect(textTheme.display3, hasCorrectFont); expect(textTheme.display3, hasCorrectFont);
......
...@@ -58,12 +58,12 @@ void main() { ...@@ -58,12 +58,12 @@ void main() {
expect(box.size.width, equals(40.0)); expect(box.size.width, equals(40.0));
expect(box.size.height, equals(40.0)); expect(box.size.height, equals(40.0));
Point topLeft = tester.getTopLeft(find.byType(UserAccountsDrawerHeader)); final Point topLeft = tester.getTopLeft(find.byType(UserAccountsDrawerHeader));
Point topRight = tester.getTopRight(find.byType(UserAccountsDrawerHeader)); final Point topRight = tester.getTopRight(find.byType(UserAccountsDrawerHeader));
Point avatarATopLeft = tester.getTopLeft(find.byKey(avatarA)); final Point avatarATopLeft = tester.getTopLeft(find.byKey(avatarA));
Point avatarDTopRight = tester.getTopRight(find.byKey(avatarD)); final Point avatarDTopRight = tester.getTopRight(find.byKey(avatarD));
Point avatarCTopRight = tester.getTopRight(find.byKey(avatarC)); final Point avatarCTopRight = tester.getTopRight(find.byKey(avatarC));
expect(avatarATopLeft.x - topLeft.x, equals(16.0)); expect(avatarATopLeft.x - topLeft.x, equals(16.0));
expect(avatarATopLeft.y - topLeft.y, equals(16.0)); expect(avatarATopLeft.y - topLeft.y, equals(16.0));
......
...@@ -269,7 +269,7 @@ void main() { ...@@ -269,7 +269,7 @@ void main() {
StateSetter contentsSetState; // call this to rebuild the route's SampleForm contents StateSetter contentsSetState; // call this to rebuild the route's SampleForm contents
bool contentsEmpty = false; // when true, don't include the SampleForm in the route bool contentsEmpty = false; // when true, don't include the SampleForm in the route
TestPageRoute<Null> route = new TestPageRoute<Null>( final TestPageRoute<Null> route = new TestPageRoute<Null>(
builder: (BuildContext context) { builder: (BuildContext context) {
return new StatefulBuilder( return new StatefulBuilder(
builder: (BuildContext context, StateSetter setState) { builder: (BuildContext context, StateSetter setState) {
......
...@@ -7,8 +7,8 @@ import 'package:flutter/painting.dart'; ...@@ -7,8 +7,8 @@ import 'package:flutter/painting.dart';
void main() { void main() {
test("BorderSide control test", () { test("BorderSide control test", () {
BorderSide side1 = const BorderSide(); final BorderSide side1 = const BorderSide();
BorderSide side2 = side1.copyWith( final BorderSide side2 = side1.copyWith(
color: const Color(0xFF00FFFF), color: const Color(0xFF00FFFF),
width: 2.0, width: 2.0,
style: BorderStyle.solid, style: BorderStyle.solid,
...@@ -29,7 +29,7 @@ void main() { ...@@ -29,7 +29,7 @@ void main() {
style: BorderStyle.solid, style: BorderStyle.solid,
))); )));
BorderSide side3 = side2.copyWith(style: BorderStyle.none); final BorderSide side3 = side2.copyWith(style: BorderStyle.none);
BorderSide interpolated = BorderSide.lerp(side2, side3, 0.2); BorderSide interpolated = BorderSide.lerp(side2, side3, 0.2);
expect(interpolated.style, equals(BorderStyle.solid)); expect(interpolated.style, equals(BorderStyle.solid));
expect(interpolated.color, equals(side2.color.withOpacity(0.8))); expect(interpolated.color, equals(side2.color.withOpacity(0.8)));
...@@ -40,9 +40,9 @@ void main() { ...@@ -40,9 +40,9 @@ void main() {
}); });
test("Border control test", () { test("Border control test", () {
Border border1 = new Border.all(width: 4.0); final Border border1 = new Border.all(width: 4.0);
Border border2 = Border.lerp(null, border1, 0.25); final Border border2 = Border.lerp(null, border1, 0.25);
Border border3 = Border.lerp(border1, null, 0.25); final Border border3 = Border.lerp(border1, null, 0.25);
expect(border1, hasOneLineDescription); expect(border1, hasOneLineDescription);
expect(border1.hashCode, isNot(equals(border2.hashCode))); expect(border1.hashCode, isNot(equals(border2.hashCode)));
...@@ -50,14 +50,14 @@ void main() { ...@@ -50,14 +50,14 @@ void main() {
expect(border2.top.width, equals(1.0)); expect(border2.top.width, equals(1.0));
expect(border3.bottom.width, equals(3.0)); expect(border3.bottom.width, equals(3.0));
Border border4 = Border.lerp(border2, border3, 0.5); final Border border4 = Border.lerp(border2, border3, 0.5);
expect(border4.left.width, equals(2.0)); expect(border4.left.width, equals(2.0));
}); });
test("BoxShadow control test", () { test("BoxShadow control test", () {
BoxShadow shadow1 = const BoxShadow(blurRadius: 4.0); final BoxShadow shadow1 = const BoxShadow(blurRadius: 4.0);
BoxShadow shadow2 = BoxShadow.lerp(null, shadow1, 0.25); final BoxShadow shadow2 = BoxShadow.lerp(null, shadow1, 0.25);
BoxShadow shadow3 = BoxShadow.lerp(shadow1, null, 0.25); final BoxShadow shadow3 = BoxShadow.lerp(shadow1, null, 0.25);
expect(shadow1, hasOneLineDescription); expect(shadow1, hasOneLineDescription);
expect(shadow1.hashCode, isNot(equals(shadow2.hashCode))); expect(shadow1.hashCode, isNot(equals(shadow2.hashCode)));
...@@ -66,7 +66,7 @@ void main() { ...@@ -66,7 +66,7 @@ void main() {
expect(shadow2.blurRadius, equals(1.0)); expect(shadow2.blurRadius, equals(1.0));
expect(shadow3.blurRadius, equals(3.0)); expect(shadow3.blurRadius, equals(3.0));
BoxShadow shadow4 = BoxShadow.lerp(shadow2, shadow3, 0.5); final BoxShadow shadow4 = BoxShadow.lerp(shadow2, shadow3, 0.5);
expect(shadow4.blurRadius, equals(2.0)); expect(shadow4.blurRadius, equals(2.0));
List<BoxShadow> shadowList = BoxShadow.lerpList( List<BoxShadow> shadowList = BoxShadow.lerpList(
......
...@@ -19,7 +19,7 @@ void main() { ...@@ -19,7 +19,7 @@ void main() {
expect(color.toColor(), const Color(0xb399816b)); expect(color.toColor(), const Color(0xb399816b));
HSVColor result = HSVColor.lerp(color, const HSVColor.fromAHSV(0.3, 128.0, 0.7, 0.2), 0.25); final HSVColor result = HSVColor.lerp(color, const HSVColor.fromAHSV(0.3, 128.0, 0.7, 0.2), 0.25);
expect(result.alpha, 0.6); expect(result.alpha, 0.6);
expect(result.hue, 53.0); expect(result.hue, 53.0);
expect(result.saturation, greaterThan(0.3999)); expect(result.saturation, greaterThan(0.3999));
......
...@@ -91,8 +91,8 @@ class TestImage extends ui.Image { ...@@ -91,8 +91,8 @@ class TestImage extends ui.Image {
void main() { void main() {
test("Decoration.lerp()", () { test("Decoration.lerp()", () {
BoxDecoration a = const BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)); final BoxDecoration a = const BoxDecoration(backgroundColor: const Color(0xFFFFFFFF));
BoxDecoration b = const BoxDecoration(backgroundColor: const Color(0x00000000)); final BoxDecoration b = const BoxDecoration(backgroundColor: const Color(0x00000000));
BoxDecoration c = Decoration.lerp(a, b, 0.0); BoxDecoration c = Decoration.lerp(a, b, 0.0);
expect(c.backgroundColor, equals(a.backgroundColor)); expect(c.backgroundColor, equals(a.backgroundColor));
...@@ -105,17 +105,17 @@ void main() { ...@@ -105,17 +105,17 @@ void main() {
}); });
test("BoxDecorationImageListenerSync", () { test("BoxDecorationImageListenerSync", () {
ImageProvider imageProvider = new SynchronousTestImageProvider(); final ImageProvider imageProvider = new SynchronousTestImageProvider();
BackgroundImage backgroundImage = new BackgroundImage(image: imageProvider); final BackgroundImage backgroundImage = new BackgroundImage(image: imageProvider);
BoxDecoration boxDecoration = new BoxDecoration(backgroundImage: backgroundImage); final BoxDecoration boxDecoration = new BoxDecoration(backgroundImage: backgroundImage);
bool onChangedCalled = false; bool onChangedCalled = false;
BoxPainter boxPainter = boxDecoration.createBoxPainter(() { final BoxPainter boxPainter = boxDecoration.createBoxPainter(() {
onChangedCalled = true; onChangedCalled = true;
}); });
TestCanvas canvas = new TestCanvas(); final TestCanvas canvas = new TestCanvas();
ImageConfiguration imageConfiguration = const ImageConfiguration(size: Size.zero); final ImageConfiguration imageConfiguration = const ImageConfiguration(size: Size.zero);
boxPainter.paint(canvas, Offset.zero, imageConfiguration); boxPainter.paint(canvas, Offset.zero, imageConfiguration);
// The onChanged callback should not be invoked during the call to boxPainter.paint // The onChanged callback should not be invoked during the call to boxPainter.paint
...@@ -124,17 +124,17 @@ void main() { ...@@ -124,17 +124,17 @@ void main() {
test("BoxDecorationImageListenerAsync", () { test("BoxDecorationImageListenerAsync", () {
new FakeAsync().run((FakeAsync async) { new FakeAsync().run((FakeAsync async) {
ImageProvider imageProvider = new AsyncTestImageProvider(); final ImageProvider imageProvider = new AsyncTestImageProvider();
BackgroundImage backgroundImage = new BackgroundImage(image: imageProvider); final BackgroundImage backgroundImage = new BackgroundImage(image: imageProvider);
BoxDecoration boxDecoration = new BoxDecoration(backgroundImage: backgroundImage); final BoxDecoration boxDecoration = new BoxDecoration(backgroundImage: backgroundImage);
bool onChangedCalled = false; bool onChangedCalled = false;
BoxPainter boxPainter = boxDecoration.createBoxPainter(() { final BoxPainter boxPainter = boxDecoration.createBoxPainter(() {
onChangedCalled = true; onChangedCalled = true;
}); });
TestCanvas canvas = new TestCanvas(); final TestCanvas canvas = new TestCanvas();
ImageConfiguration imageConfiguration = const ImageConfiguration(size: Size.zero); final ImageConfiguration imageConfiguration = const ImageConfiguration(size: Size.zero);
boxPainter.paint(canvas, Offset.zero, imageConfiguration); boxPainter.paint(canvas, Offset.zero, imageConfiguration);
// The onChanged callback should be invoked asynchronously. // The onChanged callback should be invoked asynchronously.
...@@ -149,22 +149,22 @@ void main() { ...@@ -149,22 +149,22 @@ void main() {
test("BoxDecoration backgroundImage clip", () { test("BoxDecoration backgroundImage clip", () {
void testDecoration({ BoxShape shape, BorderRadius borderRadius, bool expectClip}) { void testDecoration({ BoxShape shape, BorderRadius borderRadius, bool expectClip}) {
new FakeAsync().run((FakeAsync async) { new FakeAsync().run((FakeAsync async) {
BackgroundImageProvider imageProvider = new BackgroundImageProvider(); final BackgroundImageProvider imageProvider = new BackgroundImageProvider();
BackgroundImage backgroundImage = new BackgroundImage(image: imageProvider); final BackgroundImage backgroundImage = new BackgroundImage(image: imageProvider);
BoxDecoration boxDecoration = new BoxDecoration( final BoxDecoration boxDecoration = new BoxDecoration(
shape: shape, shape: shape,
borderRadius: borderRadius, borderRadius: borderRadius,
backgroundImage: backgroundImage, backgroundImage: backgroundImage,
); );
List<Invocation> invocations = <Invocation>[]; final List<Invocation> invocations = <Invocation>[];
TestCanvas canvas = new TestCanvas(invocations); final TestCanvas canvas = new TestCanvas(invocations);
ImageConfiguration imageConfiguration = const ImageConfiguration( final ImageConfiguration imageConfiguration = const ImageConfiguration(
size: const Size(100.0, 100.0) size: const Size(100.0, 100.0)
); );
bool onChangedCalled = false; bool onChangedCalled = false;
BoxPainter boxPainter = boxDecoration.createBoxPainter(() { final BoxPainter boxPainter = boxDecoration.createBoxPainter(() {
onChangedCalled = true; onChangedCalled = true;
}); });
...@@ -180,7 +180,7 @@ void main() { ...@@ -180,7 +180,7 @@ void main() {
boxPainter.paint(canvas, Offset.zero, imageConfiguration); boxPainter.paint(canvas, Offset.zero, imageConfiguration);
// We expect a clip to preceed the drawImageRect call. // We expect a clip to preceed the drawImageRect call.
List<Invocation> commands = canvas.invocations.where((Invocation invocation) { final List<Invocation> commands = canvas.invocations.where((Invocation invocation) {
return invocation.memberName == #clipPath || invocation.memberName == #drawImageRect; return invocation.memberName == #clipPath || invocation.memberName == #drawImageRect;
}).toList(); }).toList();
if (expectClip) { // We expect a clip to preceed the drawImageRect call. if (expectClip) { // We expect a clip to preceed the drawImageRect call.
......
...@@ -39,8 +39,8 @@ void main() { ...@@ -39,8 +39,8 @@ void main() {
}); });
test('EdgeInsets.lerp()', () { test('EdgeInsets.lerp()', () {
EdgeInsets a = const EdgeInsets.all(10.0); final EdgeInsets a = const EdgeInsets.all(10.0);
EdgeInsets b = const EdgeInsets.all(20.0); final EdgeInsets b = const EdgeInsets.all(20.0);
expect(EdgeInsets.lerp(a, b, 0.25), equals(a * 1.25)); expect(EdgeInsets.lerp(a, b, 0.25), equals(a * 1.25));
expect(EdgeInsets.lerp(a, b, 0.25), equals(b * 0.625)); expect(EdgeInsets.lerp(a, b, 0.25), equals(b * 0.625));
expect(EdgeInsets.lerp(a, b, 0.25), equals(a + const EdgeInsets.all(2.5))); expect(EdgeInsets.lerp(a, b, 0.25), equals(a + const EdgeInsets.all(2.5)));
......
...@@ -18,8 +18,8 @@ void main() { ...@@ -18,8 +18,8 @@ void main() {
}); });
test('FractionalOffset.lerp()', () { test('FractionalOffset.lerp()', () {
FractionalOffset a = FractionalOffset.topLeft; final FractionalOffset a = FractionalOffset.topLeft;
FractionalOffset b = FractionalOffset.topCenter; final FractionalOffset b = FractionalOffset.topCenter;
expect(FractionalOffset.lerp(a, b, 0.25), equals(const FractionalOffset(0.125, 0.0))); expect(FractionalOffset.lerp(a, b, 0.25), equals(const FractionalOffset(0.125, 0.0)));
expect(FractionalOffset.lerp(null, null, 0.25), isNull); expect(FractionalOffset.lerp(null, null, 0.25), isNull);
......
...@@ -32,8 +32,8 @@ class TestCanvas implements Canvas { ...@@ -32,8 +32,8 @@ class TestCanvas implements Canvas {
void main() { void main() {
test("Cover and align", () { test("Cover and align", () {
TestImage image = new TestImage(width: 300, height: 300); final TestImage image = new TestImage(width: 300, height: 300);
TestCanvas canvas = new TestCanvas(); final TestCanvas canvas = new TestCanvas();
paintImage( paintImage(
canvas: canvas, canvas: canvas,
rect: new Rect.fromLTWH(50.0, 75.0, 200.0, 100.0), rect: new Rect.fromLTWH(50.0, 75.0, 200.0, 100.0),
...@@ -42,7 +42,7 @@ void main() { ...@@ -42,7 +42,7 @@ void main() {
alignment: const FractionalOffset(0.0, 0.5) alignment: const FractionalOffset(0.0, 0.5)
); );
Invocation command = canvas.invocations.firstWhere((Invocation invocation) { final Invocation command = canvas.invocations.firstWhere((Invocation invocation) {
return invocation.memberName == #drawImageRect; return invocation.memberName == #drawImageRect;
}); });
......
...@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
test("TextPainter caret test", () { test("TextPainter caret test", () {
TextPainter painter = new TextPainter(); final TextPainter painter = new TextPainter();
String text = 'A'; String text = 'A';
painter.text = new TextSpan(text: text); painter.text = new TextSpan(text: text);
...@@ -30,7 +30,7 @@ void main() { ...@@ -30,7 +30,7 @@ void main() {
}, skip: io.Platform.isMacOS); // TODO(goderbauer): Disabled because of https://github.com/flutter/flutter/issues/4273 }, skip: io.Platform.isMacOS); // TODO(goderbauer): Disabled because of https://github.com/flutter/flutter/issues/4273
test("TextPainter error test", () { test("TextPainter error test", () {
TextPainter painter = new TextPainter(); final TextPainter painter = new TextPainter();
expect(() { painter.paint(null, Offset.zero); }, throwsFlutterError); expect(() { painter.paint(null, Offset.zero); }, throwsFlutterError);
}); });
} }
...@@ -8,14 +8,14 @@ import 'package:test/test.dart'; ...@@ -8,14 +8,14 @@ import 'package:test/test.dart';
void main() { void main() {
test('TextSpan equals', () { test('TextSpan equals', () {
String text = 'a'; // we want these instances to be separate instances so that we're not just checking with a single object final String text = 'a'; // we want these instances to be separate instances so that we're not just checking with a single object
TextSpan a1 = new TextSpan(text: text); final TextSpan a1 = new TextSpan(text: text);
TextSpan a2 = new TextSpan(text: text); final TextSpan a2 = new TextSpan(text: text);
TextSpan b1 = new TextSpan(children: <TextSpan>[ a1 ]); final TextSpan b1 = new TextSpan(children: <TextSpan>[ a1 ]);
TextSpan b2 = new TextSpan(children: <TextSpan>[ a2 ]); final TextSpan b2 = new TextSpan(children: <TextSpan>[ a2 ]);
String nullText; // we want these instances to be separate instances so that we're not just checking with a single object String nullText; // we want these instances to be separate instances so that we're not just checking with a single object
TextSpan c1 = new TextSpan(text: nullText); final TextSpan c1 = new TextSpan(text: nullText);
TextSpan c2 = new TextSpan(text: nullText); final TextSpan c2 = new TextSpan(text: nullText);
expect(a1 == a2, isTrue); expect(a1 == a2, isTrue);
expect(b1 == b2, isTrue); expect(b1 == b2, isTrue);
......
...@@ -9,7 +9,7 @@ import 'package:test/test.dart'; ...@@ -9,7 +9,7 @@ import 'package:test/test.dart';
void main() { void main() {
test("TextStyle control test", () { test("TextStyle control test", () {
TextStyle s1 = const TextStyle( final TextStyle s1 = const TextStyle(
fontSize: 10.0, fontSize: 10.0,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
height: 123.0, height: 123.0,
...@@ -21,7 +21,7 @@ void main() { ...@@ -21,7 +21,7 @@ void main() {
expect(s1.height, 123.0); expect(s1.height, 123.0);
expect(s1, equals(s1)); expect(s1, equals(s1));
TextStyle s2 = s1.copyWith(color: const Color(0xFF00FF00), height: 100.0); final TextStyle s2 = s1.copyWith(color: const Color(0xFF00FF00), height: 100.0);
expect(s1.fontFamily, isNull); expect(s1.fontFamily, isNull);
expect(s1.fontSize, 10.0); expect(s1.fontSize, 10.0);
expect(s1.fontWeight, FontWeight.w800); expect(s1.fontWeight, FontWeight.w800);
...@@ -34,7 +34,7 @@ void main() { ...@@ -34,7 +34,7 @@ void main() {
expect(s2.color, const Color(0xFF00FF00)); expect(s2.color, const Color(0xFF00FF00));
expect(s2, isNot(equals(s1))); expect(s2, isNot(equals(s1)));
TextStyle s3 = s1.apply(fontSizeFactor: 2.0, fontSizeDelta: -2.0, fontWeightDelta: -4); final TextStyle s3 = s1.apply(fontSizeFactor: 2.0, fontSizeDelta: -2.0, fontWeightDelta: -4);
expect(s1.fontFamily, isNull); expect(s1.fontFamily, isNull);
expect(s1.fontSize, 10.0); expect(s1.fontSize, 10.0);
expect(s1.fontWeight, FontWeight.w800); expect(s1.fontWeight, FontWeight.w800);
...@@ -51,7 +51,7 @@ void main() { ...@@ -51,7 +51,7 @@ void main() {
expect(s1.apply(fontWeightDelta: 2).fontWeight, FontWeight.w900); expect(s1.apply(fontWeightDelta: 2).fontWeight, FontWeight.w900);
expect(s1.merge(null), equals(s1)); expect(s1.merge(null), equals(s1));
TextStyle s4 = s2.merge(s1); final TextStyle s4 = s2.merge(s1);
expect(s1.fontFamily, isNull); expect(s1.fontFamily, isNull);
expect(s1.fontSize, 10.0); expect(s1.fontSize, 10.0);
expect(s1.fontWeight, FontWeight.w800); expect(s1.fontWeight, FontWeight.w800);
...@@ -70,7 +70,7 @@ void main() { ...@@ -70,7 +70,7 @@ void main() {
expect(s4.height, 123.0); expect(s4.height, 123.0);
expect(s4.color, const Color(0xFF00FF00)); expect(s4.color, const Color(0xFF00FF00));
TextStyle s5 = TextStyle.lerp(s1, s3, 0.25); final TextStyle s5 = TextStyle.lerp(s1, s3, 0.25);
expect(s1.fontFamily, isNull); expect(s1.fontFamily, isNull);
expect(s1.fontSize, 10.0); expect(s1.fontSize, 10.0);
expect(s1.fontWeight, FontWeight.w800); expect(s1.fontWeight, FontWeight.w800);
...@@ -89,17 +89,17 @@ void main() { ...@@ -89,17 +89,17 @@ void main() {
expect(s5.height, 123.0); expect(s5.height, 123.0);
expect(s5.color, isNull); expect(s5.color, isNull);
ui.TextStyle ts5 = s5.getTextStyle(); final ui.TextStyle ts5 = s5.getTextStyle();
expect(ts5, equals(new ui.TextStyle(fontWeight: FontWeight.w700, fontSize: 12.0, height: 123.0))); expect(ts5, equals(new ui.TextStyle(fontWeight: FontWeight.w700, fontSize: 12.0, height: 123.0)));
expect(ts5.toString(), 'TextStyle(color: unspecified, decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: FontWeight.w700, fontStyle: unspecified, textBaseline: unspecified, fontFamily: unspecified, fontSize: 12.0, letterSpacing: unspecified, wordSpacing: unspecified, height: 123.0x)'); expect(ts5.toString(), 'TextStyle(color: unspecified, decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: FontWeight.w700, fontStyle: unspecified, textBaseline: unspecified, fontFamily: unspecified, fontSize: 12.0, letterSpacing: unspecified, wordSpacing: unspecified, height: 123.0x)');
ui.TextStyle ts2 = s2.getTextStyle(); final ui.TextStyle ts2 = s2.getTextStyle();
expect(ts2, equals(new ui.TextStyle(color: const Color(0xFF00FF00), fontWeight: FontWeight.w800, fontSize: 10.0, height: 100.0))); expect(ts2, equals(new ui.TextStyle(color: const Color(0xFF00FF00), fontWeight: FontWeight.w800, fontSize: 10.0, height: 100.0)));
expect(ts2.toString(), 'TextStyle(color: Color(0xff00ff00), decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: FontWeight.w800, fontStyle: unspecified, textBaseline: unspecified, fontFamily: unspecified, fontSize: 10.0, letterSpacing: unspecified, wordSpacing: unspecified, height: 100.0x)'); expect(ts2.toString(), 'TextStyle(color: Color(0xff00ff00), decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: FontWeight.w800, fontStyle: unspecified, textBaseline: unspecified, fontFamily: unspecified, fontSize: 10.0, letterSpacing: unspecified, wordSpacing: unspecified, height: 100.0x)');
ui.ParagraphStyle ps2 = s2.getParagraphStyle(textAlign: TextAlign.center); final ui.ParagraphStyle ps2 = s2.getParagraphStyle(textAlign: TextAlign.center);
expect(ps2, equals(new ui.ParagraphStyle(textAlign: TextAlign.center, fontWeight: FontWeight.w800, fontSize: 10.0, lineHeight: 100.0))); expect(ps2, equals(new ui.ParagraphStyle(textAlign: TextAlign.center, fontWeight: FontWeight.w800, fontSize: 10.0, lineHeight: 100.0)));
expect(ps2.toString(), 'ParagraphStyle(textAlign: TextAlign.center, fontWeight: FontWeight.w800, fontStyle: unspecified, maxLines: unspecified, fontFamily: unspecified, fontSize: 10.0, lineHeight: 100.0x, ellipsis: unspecified)'); expect(ps2.toString(), 'ParagraphStyle(textAlign: TextAlign.center, fontWeight: FontWeight.w800, fontStyle: unspecified, maxLines: unspecified, fontFamily: unspecified, fontSize: 10.0, lineHeight: 100.0x, ellipsis: unspecified)');
ui.ParagraphStyle ps5 = s5.getParagraphStyle(); final ui.ParagraphStyle ps5 = s5.getParagraphStyle();
expect(ps5, equals(new ui.ParagraphStyle(fontWeight: FontWeight.w700, fontSize: 12.0, lineHeight: 123.0))); expect(ps5, equals(new ui.ParagraphStyle(fontWeight: FontWeight.w700, fontSize: 12.0, lineHeight: 123.0)));
expect(ps5.toString(), 'ParagraphStyle(textAlign: unspecified, fontWeight: FontWeight.w700, fontStyle: unspecified, maxLines: unspecified, fontFamily: unspecified, fontSize: 12.0, lineHeight: 123.0x, ellipsis: unspecified)'); expect(ps5.toString(), 'ParagraphStyle(textAlign: unspecified, fontWeight: FontWeight.w700, fontStyle: unspecified, maxLines: unspecified, fontFamily: unspecified, fontSize: 12.0, lineHeight: 123.0x, ellipsis: unspecified)');
}); });
......
...@@ -7,8 +7,8 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,8 +7,8 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
test('Clamped simulation', () { test('Clamped simulation', () {
GravitySimulation gravity = new GravitySimulation(9.81, 10.0, 0.0, 0.0); final GravitySimulation gravity = new GravitySimulation(9.81, 10.0, 0.0, 0.0);
ClampedSimulation clamped = new ClampedSimulation(gravity, xMin: 20.0, xMax: 100.0, dxMin: 7.0, dxMax: 11.0); final ClampedSimulation clamped = new ClampedSimulation(gravity, xMin: 20.0, xMax: 100.0, dxMin: 7.0, dxMax: 11.0);
expect(clamped.x(0.0), equals(20.0)); expect(clamped.x(0.0), equals(20.0));
expect(clamped.dx(0.0), equals(7.0)); expect(clamped.dx(0.0), equals(7.0));
......
...@@ -9,7 +9,7 @@ import 'package:flutter/widgets.dart'; ...@@ -9,7 +9,7 @@ import 'package:flutter/widgets.dart';
void main() { void main() {
test('test_friction', () { test('test_friction', () {
FrictionSimulation friction = new FrictionSimulation(0.3, 100.0, 400.0); final FrictionSimulation friction = new FrictionSimulation(0.3, 100.0, 400.0);
friction.tolerance = const Tolerance(velocity: 1.0); friction.tolerance = const Tolerance(velocity: 1.0);
...@@ -48,7 +48,7 @@ void main() { ...@@ -48,7 +48,7 @@ void main() {
expect(friction.x(0.0), 10.0); expect(friction.x(0.0), 10.0);
expect(friction.dx(0.0), 600.0); expect(friction.dx(0.0), 600.0);
double epsilon = 1e-4; final double epsilon = 1e-4;
expect(friction.isDone(1.0 + epsilon), true); expect(friction.isDone(1.0 + epsilon), true);
expect(friction.x(1.0), closeTo(endPosition, epsilon)); expect(friction.x(1.0), closeTo(endPosition, epsilon));
expect(friction.dx(1.0), closeTo(endVelocity, epsilon)); expect(friction.dx(1.0), closeTo(endVelocity, epsilon));
...@@ -71,7 +71,7 @@ void main() { ...@@ -71,7 +71,7 @@ void main() {
}); });
test('BoundedFrictionSimulation control test', () { test('BoundedFrictionSimulation control test', () {
BoundedFrictionSimulation friction = new BoundedFrictionSimulation(0.3, 100.0, 400.0, 50.0, 150.0); final BoundedFrictionSimulation friction = new BoundedFrictionSimulation(0.3, 100.0, 400.0, 50.0, 150.0);
friction.tolerance = const Tolerance(velocity: 1.0); friction.tolerance = const Tolerance(velocity: 1.0);
...@@ -85,7 +85,7 @@ void main() { ...@@ -85,7 +85,7 @@ void main() {
}); });
test('test_gravity', () { test('test_gravity', () {
GravitySimulation gravity = new GravitySimulation(200.0, 100.0, 600.0, 0.0); final GravitySimulation gravity = new GravitySimulation(200.0, 100.0, 600.0, 0.0);
expect(gravity.isDone(0.0), false); expect(gravity.isDone(0.0), false);
expect(gravity.x(0.0), 100.0); expect(gravity.x(0.0), 100.0);
...@@ -123,23 +123,23 @@ void main() { ...@@ -123,23 +123,23 @@ void main() {
mass: 1.0, springConstant: 100.0, ratio: 1.0), 0.0, 300.0, 0.0); mass: 1.0, springConstant: 100.0, ratio: 1.0), 0.0, 300.0, 0.0);
expect(crit.type, SpringType.criticallyDamped); expect(crit.type, SpringType.criticallyDamped);
SpringSimulation under = new SpringSimulation(new SpringDescription.withDampingRatio( final SpringSimulation under = new SpringSimulation(new SpringDescription.withDampingRatio(
mass: 1.0, springConstant: 100.0, ratio: 0.75), 0.0, 300.0, 0.0); mass: 1.0, springConstant: 100.0, ratio: 0.75), 0.0, 300.0, 0.0);
expect(under.type, SpringType.underDamped); expect(under.type, SpringType.underDamped);
SpringSimulation over = new SpringSimulation(new SpringDescription.withDampingRatio( final SpringSimulation over = new SpringSimulation(new SpringDescription.withDampingRatio(
mass: 1.0, springConstant: 100.0, ratio: 1.25), 0.0, 300.0, 0.0); mass: 1.0, springConstant: 100.0, ratio: 1.25), 0.0, 300.0, 0.0);
expect(over.type, SpringType.overDamped); expect(over.type, SpringType.overDamped);
// Just so we don't forget how to create a desc without the ratio. // Just so we don't forget how to create a desc without the ratio.
SpringSimulation other = new SpringSimulation( final SpringSimulation other = new SpringSimulation(
const SpringDescription(mass: 1.0, springConstant: 100.0, damping: 20.0), const SpringDescription(mass: 1.0, springConstant: 100.0, damping: 20.0),
0.0, 20.0, 20.0); 0.0, 20.0, 20.0);
expect(other.type, SpringType.criticallyDamped); expect(other.type, SpringType.criticallyDamped);
}); });
test('crit_spring', () { test('crit_spring', () {
SpringSimulation crit = new SpringSimulation(new SpringDescription.withDampingRatio( final SpringSimulation crit = new SpringSimulation(new SpringDescription.withDampingRatio(
mass: 1.0, springConstant: 100.0, ratio: 1.0), 0.0, 500.0, 0.0); mass: 1.0, springConstant: 100.0, ratio: 1.0), 0.0, 500.0, 0.0);
crit.tolerance = const Tolerance(distance: 0.01, velocity: 0.01); crit.tolerance = const Tolerance(distance: 0.01, velocity: 0.01);
...@@ -164,7 +164,7 @@ void main() { ...@@ -164,7 +164,7 @@ void main() {
}); });
test('overdamped_spring', () { test('overdamped_spring', () {
SpringSimulation over = new SpringSimulation(new SpringDescription.withDampingRatio( final SpringSimulation over = new SpringSimulation(new SpringDescription.withDampingRatio(
mass: 1.0, springConstant: 100.0, ratio: 1.25), 0.0, 500.0, 0.0); mass: 1.0, springConstant: 100.0, ratio: 1.25), 0.0, 500.0, 0.0);
over.tolerance = const Tolerance(distance: 0.01, velocity: 0.01); over.tolerance = const Tolerance(distance: 0.01, velocity: 0.01);
...@@ -186,7 +186,7 @@ void main() { ...@@ -186,7 +186,7 @@ void main() {
}); });
test('underdamped_spring', () { test('underdamped_spring', () {
SpringSimulation under = new SpringSimulation(new SpringDescription.withDampingRatio( final SpringSimulation under = new SpringSimulation(new SpringDescription.withDampingRatio(
mass: 1.0, springConstant: 100.0, ratio: 0.25), 0.0, 300.0, 0.0); mass: 1.0, springConstant: 100.0, ratio: 0.25), 0.0, 300.0, 0.0);
expect(under.type, SpringType.underDamped); expect(under.type, SpringType.underDamped);
...@@ -203,10 +203,10 @@ void main() { ...@@ -203,10 +203,10 @@ void main() {
}); });
test('test_kinetic_scroll', () { test('test_kinetic_scroll', () {
SpringDescription spring = new SpringDescription.withDampingRatio( final SpringDescription spring = new SpringDescription.withDampingRatio(
mass: 1.0, springConstant: 50.0, ratio: 0.5); mass: 1.0, springConstant: 50.0, ratio: 0.5);
BouncingScrollSimulation scroll = new BouncingScrollSimulation( final BouncingScrollSimulation scroll = new BouncingScrollSimulation(
position: 100.0, position: 100.0,
velocity: 800.0, velocity: 800.0,
leadingExtent: 0.0, leadingExtent: 0.0,
...@@ -218,7 +218,7 @@ void main() { ...@@ -218,7 +218,7 @@ void main() {
expect(scroll.isDone(0.5), false); // switch from friction to spring expect(scroll.isDone(0.5), false); // switch from friction to spring
expect(scroll.isDone(3.5), true); expect(scroll.isDone(3.5), true);
BouncingScrollSimulation scroll2 = new BouncingScrollSimulation( final BouncingScrollSimulation scroll2 = new BouncingScrollSimulation(
position: 100.0, position: 100.0,
velocity: -800.0, velocity: -800.0,
leadingExtent: 0.0, leadingExtent: 0.0,
...@@ -232,10 +232,10 @@ void main() { ...@@ -232,10 +232,10 @@ void main() {
}); });
test('scroll_with_inf_edge_ends', () { test('scroll_with_inf_edge_ends', () {
SpringDescription spring = new SpringDescription.withDampingRatio( final SpringDescription spring = new SpringDescription.withDampingRatio(
mass: 1.0, springConstant: 50.0, ratio: 0.5); mass: 1.0, springConstant: 50.0, ratio: 0.5);
BouncingScrollSimulation scroll = new BouncingScrollSimulation( final BouncingScrollSimulation scroll = new BouncingScrollSimulation(
position: 100.0, position: 100.0,
velocity: 400.0, velocity: 400.0,
leadingExtent: 0.0, leadingExtent: 0.0,
...@@ -262,8 +262,8 @@ void main() { ...@@ -262,8 +262,8 @@ void main() {
}); });
test('over/under scroll spring', () { test('over/under scroll spring', () {
SpringDescription spring = new SpringDescription.withDampingRatio(mass: 1.0, springConstant: 170.0, ratio: 1.1); final SpringDescription spring = new SpringDescription.withDampingRatio(mass: 1.0, springConstant: 170.0, ratio: 1.1);
BouncingScrollSimulation scroll = new BouncingScrollSimulation( final BouncingScrollSimulation scroll = new BouncingScrollSimulation(
position: 500.0, position: 500.0,
velocity: -7500.0, velocity: -7500.0,
leadingExtent: 0.0, leadingExtent: 0.0,
......
...@@ -9,7 +9,7 @@ import 'rendering_tester.dart'; ...@@ -9,7 +9,7 @@ import 'rendering_tester.dart';
void main() { void main() {
test('RenderAspectRatio: Intrinsic sizing 2.0', () { test('RenderAspectRatio: Intrinsic sizing 2.0', () {
RenderAspectRatio box = new RenderAspectRatio(aspectRatio: 2.0); final RenderAspectRatio box = new RenderAspectRatio(aspectRatio: 2.0);
expect(box.getMinIntrinsicWidth(200.0), 400.0); expect(box.getMinIntrinsicWidth(200.0), 400.0);
expect(box.getMinIntrinsicWidth(400.0), 800.0); expect(box.getMinIntrinsicWidth(400.0), 800.0);
...@@ -30,7 +30,7 @@ void main() { ...@@ -30,7 +30,7 @@ void main() {
}); });
test('RenderAspectRatio: Intrinsic sizing 0.5', () { test('RenderAspectRatio: Intrinsic sizing 0.5', () {
RenderAspectRatio box = new RenderAspectRatio(aspectRatio: 0.5); final RenderAspectRatio box = new RenderAspectRatio(aspectRatio: 0.5);
expect(box.getMinIntrinsicWidth(200.0), 100.0); expect(box.getMinIntrinsicWidth(200.0), 100.0);
expect(box.getMinIntrinsicWidth(400.0), 200.0); expect(box.getMinIntrinsicWidth(400.0), 200.0);
...@@ -51,7 +51,7 @@ void main() { ...@@ -51,7 +51,7 @@ void main() {
}); });
test('RenderAspectRatio: Intrinsic sizing 2.0', () { test('RenderAspectRatio: Intrinsic sizing 2.0', () {
RenderAspectRatio box = new RenderAspectRatio( final RenderAspectRatio box = new RenderAspectRatio(
aspectRatio: 2.0, aspectRatio: 2.0,
child: new RenderSizedBox(const Size(90.0, 70.0)) child: new RenderSizedBox(const Size(90.0, 70.0))
); );
...@@ -75,7 +75,7 @@ void main() { ...@@ -75,7 +75,7 @@ void main() {
}); });
test('RenderAspectRatio: Intrinsic sizing 0.5', () { test('RenderAspectRatio: Intrinsic sizing 0.5', () {
RenderAspectRatio box = new RenderAspectRatio( final RenderAspectRatio box = new RenderAspectRatio(
aspectRatio: 0.5, aspectRatio: 0.5,
child: new RenderSizedBox(const Size(90.0, 70.0)) child: new RenderSizedBox(const Size(90.0, 70.0))
); );
...@@ -100,11 +100,11 @@ void main() { ...@@ -100,11 +100,11 @@ void main() {
test('RenderAspectRatio: Unbounded', () { test('RenderAspectRatio: Unbounded', () {
bool hadError = false; bool hadError = false;
FlutterExceptionHandler oldHandler = FlutterError.onError; final FlutterExceptionHandler oldHandler = FlutterError.onError;
FlutterError.onError = (FlutterErrorDetails details) { FlutterError.onError = (FlutterErrorDetails details) {
hadError = true; hadError = true;
}; };
RenderBox box = new RenderConstrainedOverflowBox( final RenderBox box = new RenderConstrainedOverflowBox(
maxWidth: double.INFINITY, maxWidth: double.INFINITY,
maxHeight: double.INFINITY, maxHeight: double.INFINITY,
child: new RenderAspectRatio( child: new RenderAspectRatio(
......
...@@ -12,7 +12,7 @@ void main() { ...@@ -12,7 +12,7 @@ void main() {
test("RenderBaseline", () { test("RenderBaseline", () {
RenderBaseline parent; RenderBaseline parent;
RenderSizedBox child; RenderSizedBox child;
RenderBox root = new RenderPositionedBox( final RenderBox root = new RenderPositionedBox(
alignment: FractionalOffset.topLeft, alignment: FractionalOffset.topLeft,
child: parent = new RenderBaseline( child: parent = new RenderBaseline(
baseline: 0.0, baseline: 0.0,
...@@ -20,7 +20,7 @@ void main() { ...@@ -20,7 +20,7 @@ void main() {
child: child = new RenderSizedBox(const Size(100.0, 100.0)) child: child = new RenderSizedBox(const Size(100.0, 100.0))
) )
); );
BoxParentData childParentData = child.parentData; final BoxParentData childParentData = child.parentData;
layout(root, phase: EnginePhase.layout); layout(root, phase: EnginePhase.layout);
expect(childParentData.offset.dx, equals(0.0)); expect(childParentData.offset.dx, equals(0.0));
......
...@@ -13,7 +13,7 @@ void main() { ...@@ -13,7 +13,7 @@ void main() {
}); });
test('BoxConstraints copyWith', () { test('BoxConstraints copyWith', () {
BoxConstraints constraints = const BoxConstraints( final BoxConstraints constraints = const BoxConstraints(
minWidth: 3.0, minWidth: 3.0,
maxWidth: 7.0, maxWidth: 7.0,
minHeight: 11.0, minHeight: 11.0,
...@@ -36,7 +36,7 @@ void main() { ...@@ -36,7 +36,7 @@ void main() {
}); });
test('BoxConstraints operators', () { test('BoxConstraints operators', () {
BoxConstraints constraints = const BoxConstraints( final BoxConstraints constraints = const BoxConstraints(
minWidth: 3.0, minWidth: 3.0,
maxWidth: 7.0, maxWidth: 7.0,
minHeight: 11.0, minHeight: 11.0,
...@@ -62,7 +62,7 @@ void main() { ...@@ -62,7 +62,7 @@ void main() {
test('BoxConstraints lerp', () { test('BoxConstraints lerp', () {
expect(BoxConstraints.lerp(null, null, 0.5), isNull); expect(BoxConstraints.lerp(null, null, 0.5), isNull);
BoxConstraints constraints = const BoxConstraints( final BoxConstraints constraints = const BoxConstraints(
minWidth: 3.0, minWidth: 3.0,
maxWidth: 7.0, maxWidth: 7.0,
minHeight: 11.0, minHeight: 11.0,
...@@ -91,13 +91,13 @@ void main() { ...@@ -91,13 +91,13 @@ void main() {
}); });
test('BoxConstraints normalize', () { test('BoxConstraints normalize', () {
BoxConstraints constraints = const BoxConstraints( final BoxConstraints constraints = const BoxConstraints(
minWidth: 3.0, minWidth: 3.0,
maxWidth: 2.0, maxWidth: 2.0,
minHeight: 11.0, minHeight: 11.0,
maxHeight: 18.0 maxHeight: 18.0
); );
BoxConstraints copy = constraints.normalize(); final BoxConstraints copy = constraints.normalize();
expect(copy.minWidth, 3.0); expect(copy.minWidth, 3.0);
expect(copy.maxWidth, 3.0); expect(copy.maxWidth, 3.0);
expect(copy.minHeight, 11.0); expect(copy.minHeight, 11.0);
......
...@@ -10,7 +10,7 @@ import 'rendering_tester.dart'; ...@@ -10,7 +10,7 @@ import 'rendering_tester.dart';
void main() { void main() {
test("should size to render view", () { test("should size to render view", () {
RenderBox root = new RenderDecoratedBox( final RenderBox root = new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: new BoxDecoration(
backgroundColor: const Color(0xFF00FF00), backgroundColor: const Color(0xFF00FF00),
gradient: new RadialGradient( gradient: new RadialGradient(
...@@ -26,25 +26,25 @@ void main() { ...@@ -26,25 +26,25 @@ void main() {
}); });
test('Flex and padding', () { test('Flex and padding', () {
RenderBox size = new RenderConstrainedBox( final RenderBox size = new RenderConstrainedBox(
additionalConstraints: const BoxConstraints().tighten(height: 100.0), additionalConstraints: const BoxConstraints().tighten(height: 100.0),
); );
RenderBox inner = new RenderDecoratedBox( final RenderBox inner = new RenderDecoratedBox(
decoration: const BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFF00FF00), backgroundColor: const Color(0xFF00FF00),
), ),
child: size, child: size,
); );
RenderBox padding = new RenderPadding( final RenderBox padding = new RenderPadding(
padding: const EdgeInsets.all(50.0), padding: const EdgeInsets.all(50.0),
child: inner, child: inner,
); );
RenderBox flex = new RenderFlex( final RenderBox flex = new RenderFlex(
children: <RenderBox>[padding], children: <RenderBox>[padding],
direction: Axis.vertical, direction: Axis.vertical,
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
); );
RenderBox outer = new RenderDecoratedBox( final RenderBox outer = new RenderDecoratedBox(
decoration: const BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFF0000FF) backgroundColor: const Color(0xFF0000FF)
), ),
...@@ -66,14 +66,14 @@ void main() { ...@@ -66,14 +66,14 @@ void main() {
}); });
test("should not have a 0 sized colored Box", () { test("should not have a 0 sized colored Box", () {
RenderBox coloredBox = new RenderDecoratedBox( final RenderBox coloredBox = new RenderDecoratedBox(
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
); );
RenderBox paddingBox = new RenderPadding( final RenderBox paddingBox = new RenderPadding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: coloredBox, child: coloredBox,
); );
RenderBox root = new RenderDecoratedBox( final RenderBox root = new RenderDecoratedBox(
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
child: paddingBox, child: paddingBox,
); );
...@@ -83,20 +83,20 @@ void main() { ...@@ -83,20 +83,20 @@ void main() {
}); });
test("reparenting should clear position", () { test("reparenting should clear position", () {
RenderDecoratedBox coloredBox = new RenderDecoratedBox( final RenderDecoratedBox coloredBox = new RenderDecoratedBox(
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
); );
RenderPadding paddedBox = new RenderPadding( final RenderPadding paddedBox = new RenderPadding(
child: coloredBox, child: coloredBox,
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
); );
layout(paddedBox); layout(paddedBox);
BoxParentData parentData = coloredBox.parentData; final BoxParentData parentData = coloredBox.parentData;
expect(parentData.offset.dx, isNot(equals(0.0))); expect(parentData.offset.dx, isNot(equals(0.0)));
paddedBox.child = null; paddedBox.child = null;
RenderConstrainedBox constraintedBox = new RenderConstrainedBox( final RenderConstrainedBox constraintedBox = new RenderConstrainedBox(
child: coloredBox, child: coloredBox,
additionalConstraints: const BoxConstraints(), additionalConstraints: const BoxConstraints(),
); );
......
...@@ -16,7 +16,7 @@ class RenderTestBox extends RenderBox { ...@@ -16,7 +16,7 @@ class RenderTestBox extends RenderBox {
void main() { void main() {
test('Intrinsics cache', () { test('Intrinsics cache', () {
RenderBox test = new RenderTestBox(); final RenderBox test = new RenderTestBox();
expect(test.getMinIntrinsicWidth(0.0), equals(1.0)); expect(test.getMinIntrinsicWidth(0.0), equals(1.0));
expect(test.getMinIntrinsicWidth(100.0), equals(2.0)); expect(test.getMinIntrinsicWidth(100.0), equals(2.0));
......
...@@ -36,7 +36,7 @@ void main() { ...@@ -36,7 +36,7 @@ void main() {
result = 'no exception'; result = 'no exception';
try { try {
BoxConstraints constraints = const BoxConstraints(minWidth: double.NAN, maxWidth: double.NAN, minHeight: 2.0, maxHeight: double.NAN); final BoxConstraints constraints = const BoxConstraints(minWidth: double.NAN, maxWidth: double.NAN, minHeight: 2.0, maxHeight: double.NAN);
assert(constraints.debugAssertIsValid()); assert(constraints.debugAssertIsValid());
} on FlutterError catch (e) { } on FlutterError catch (e) {
result = '$e'; result = '$e';
...@@ -49,7 +49,7 @@ void main() { ...@@ -49,7 +49,7 @@ void main() {
result = 'no exception'; result = 'no exception';
try { try {
BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN); final BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN);
assert(constraints.debugAssertIsValid()); assert(constraints.debugAssertIsValid());
} on FlutterError catch (e) { } on FlutterError catch (e) {
result = '$e'; result = '$e';
...@@ -62,7 +62,7 @@ void main() { ...@@ -62,7 +62,7 @@ void main() {
result = 'no exception'; result = 'no exception';
try { try {
BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN, maxWidth: 0.0/0.0); final BoxConstraints constraints = const BoxConstraints(minHeight: double.NAN, maxWidth: 0.0/0.0);
assert(constraints.debugAssertIsValid()); assert(constraints.debugAssertIsValid());
} on FlutterError catch (e) { } on FlutterError catch (e) {
result = '$e'; result = '$e';
......
...@@ -11,8 +11,8 @@ import 'rendering_tester.dart'; ...@@ -11,8 +11,8 @@ import 'rendering_tester.dart';
void main() { void main() {
test('Describe transform control test', () { test('Describe transform control test', () {
Matrix4 identity = new Matrix4.identity(); final Matrix4 identity = new Matrix4.identity();
List<String> description = debugDescribeTransform(identity); final List<String> description = debugDescribeTransform(identity);
expect(description, equals(<String>[ expect(description, equals(<String>[
' [0] 1.0,0.0,0.0,0.0', ' [0] 1.0,0.0,0.0,0.0',
' [1] 0.0,1.0,0.0,0.0', ' [1] 0.0,1.0,0.0,0.0',
...@@ -37,7 +37,7 @@ void main() { ...@@ -37,7 +37,7 @@ void main() {
debugPaintSizeEnabled = true; debugPaintSizeEnabled = true;
RenderSliver s; RenderSliver s;
RenderBox b; RenderBox b;
RenderViewport root = new RenderViewport( final RenderViewport root = new RenderViewport(
offset: new ViewportOffset.zero(), offset: new ViewportOffset.zero(),
children: <RenderSliver>[ children: <RenderSliver>[
s = new RenderSliverPadding( s = new RenderSliverPadding(
...@@ -62,7 +62,7 @@ void main() { ...@@ -62,7 +62,7 @@ void main() {
test('debugPaintPadding from render objects', () { test('debugPaintPadding from render objects', () {
debugPaintSizeEnabled = true; debugPaintSizeEnabled = true;
RenderSliver s; RenderSliver s;
RenderBox b = new RenderPadding( final RenderBox b = new RenderPadding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: new RenderViewport( child: new RenderViewport(
offset: new ViewportOffset.zero(), offset: new ViewportOffset.zero(),
......
...@@ -9,8 +9,8 @@ import 'rendering_tester.dart'; ...@@ -9,8 +9,8 @@ import 'rendering_tester.dart';
void main() { void main() {
test('Overconstrained flex', () { test('Overconstrained flex', () {
RenderDecoratedBox box = new RenderDecoratedBox(decoration: const BoxDecoration()); final RenderDecoratedBox box = new RenderDecoratedBox(decoration: const BoxDecoration());
RenderFlex flex = new RenderFlex(children: <RenderBox>[box]); final RenderFlex flex = new RenderFlex(children: <RenderBox>[box]);
layout(flex, constraints: const BoxConstraints( layout(flex, constraints: const BoxConstraints(
minWidth: 200.0, maxWidth: 200.0, minHeight: 200.0, maxHeight: 200.0) minWidth: 200.0, maxWidth: 200.0, minHeight: 200.0, maxHeight: 200.0)
); );
...@@ -20,19 +20,19 @@ void main() { ...@@ -20,19 +20,19 @@ void main() {
}); });
test('Vertical Overflow', () { test('Vertical Overflow', () {
RenderConstrainedBox flexible = new RenderConstrainedBox( final RenderConstrainedBox flexible = new RenderConstrainedBox(
additionalConstraints: const BoxConstraints.expand() additionalConstraints: const BoxConstraints.expand()
); );
RenderFlex flex = new RenderFlex( final RenderFlex flex = new RenderFlex(
direction: Axis.vertical, direction: Axis.vertical,
children: <RenderBox>[ children: <RenderBox>[
new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(height: 200.0)), new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(height: 200.0)),
flexible, flexible,
] ]
); );
FlexParentData flexParentData = flexible.parentData; final FlexParentData flexParentData = flexible.parentData;
flexParentData.flex = 1; flexParentData.flex = 1;
BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0); final BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
layout(flex, constraints: viewport); layout(flex, constraints: viewport);
expect(flexible.size.height, equals(0.0)); expect(flexible.size.height, equals(0.0));
expect(flex.getMinIntrinsicHeight(100.0), equals(200.0)); expect(flex.getMinIntrinsicHeight(100.0), equals(200.0));
...@@ -42,19 +42,19 @@ void main() { ...@@ -42,19 +42,19 @@ void main() {
}); });
test('Horizontal Overflow', () { test('Horizontal Overflow', () {
RenderConstrainedBox flexible = new RenderConstrainedBox( final RenderConstrainedBox flexible = new RenderConstrainedBox(
additionalConstraints: const BoxConstraints.expand() additionalConstraints: const BoxConstraints.expand()
); );
RenderFlex flex = new RenderFlex( final RenderFlex flex = new RenderFlex(
direction: Axis.horizontal, direction: Axis.horizontal,
children: <RenderBox>[ children: <RenderBox>[
new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 200.0)), new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 200.0)),
flexible, flexible,
] ]
); );
FlexParentData flexParentData = flexible.parentData; final FlexParentData flexParentData = flexible.parentData;
flexParentData.flex = 1; flexParentData.flex = 1;
BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0); final BoxConstraints viewport = const BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
layout(flex, constraints: viewport); layout(flex, constraints: viewport);
expect(flexible.size.width, equals(0.0)); expect(flexible.size.width, equals(0.0));
expect(flex.getMinIntrinsicHeight(100.0), equals(0.0)); expect(flex.getMinIntrinsicHeight(100.0), equals(0.0));
...@@ -64,13 +64,13 @@ void main() { ...@@ -64,13 +64,13 @@ void main() {
}); });
test('Vertical Flipped Constraints', () { test('Vertical Flipped Constraints', () {
RenderFlex flex = new RenderFlex( final RenderFlex flex = new RenderFlex(
direction: Axis.vertical, direction: Axis.vertical,
children: <RenderBox>[ children: <RenderBox>[
new RenderAspectRatio(aspectRatio: 1.0), new RenderAspectRatio(aspectRatio: 1.0),
] ]
); );
BoxConstraints viewport = const BoxConstraints(maxHeight: 200.0, maxWidth: 1000.0); final BoxConstraints viewport = const BoxConstraints(maxHeight: 200.0, maxWidth: 1000.0);
layout(flex, constraints: viewport); layout(flex, constraints: viewport);
expect(flex.getMaxIntrinsicWidth(200.0), equals(0.0)); expect(flex.getMaxIntrinsicWidth(200.0), equals(0.0));
}); });
...@@ -79,15 +79,15 @@ void main() { ...@@ -79,15 +79,15 @@ void main() {
// RenderAspectRatio being height-in, width-out. // RenderAspectRatio being height-in, width-out.
test('Defaults', () { test('Defaults', () {
RenderFlex flex = new RenderFlex(); final RenderFlex flex = new RenderFlex();
expect(flex.crossAxisAlignment, equals(CrossAxisAlignment.center)); expect(flex.crossAxisAlignment, equals(CrossAxisAlignment.center));
expect(flex.direction, equals(Axis.horizontal)); expect(flex.direction, equals(Axis.horizontal));
}); });
test('Parent data', () { test('Parent data', () {
RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: const BoxDecoration()); final RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: const BoxDecoration());
RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: const BoxDecoration()); final RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: const BoxDecoration());
RenderFlex flex = new RenderFlex(children: <RenderBox>[box1, box2]); final RenderFlex flex = new RenderFlex(children: <RenderBox>[box1, box2]);
layout(flex, constraints: const BoxConstraints( layout(flex, constraints: const BoxConstraints(
minWidth: 0.0, maxWidth: 100.0, minHeight: 0.0, maxHeight: 100.0) minWidth: 0.0, maxWidth: 100.0, minHeight: 0.0, maxHeight: 100.0)
); );
...@@ -107,9 +107,9 @@ void main() { ...@@ -107,9 +107,9 @@ void main() {
}); });
test('Stretch', () { test('Stretch', () {
RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: const BoxDecoration()); final RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: const BoxDecoration());
RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: const BoxDecoration()); final RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: const BoxDecoration());
RenderFlex flex = new RenderFlex(); final RenderFlex flex = new RenderFlex();
flex.setupParentData(box2); flex.setupParentData(box2);
final FlexParentData box2ParentData = box2.parentData; final FlexParentData box2ParentData = box2.parentData;
box2ParentData.flex = 2; box2ParentData.flex = 2;
...@@ -138,16 +138,16 @@ void main() { ...@@ -138,16 +138,16 @@ void main() {
}); });
test('Space evenly', () { test('Space evenly', () {
RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0)); final RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0)); final RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0)); final RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderFlex flex = new RenderFlex(mainAxisAlignment: MainAxisAlignment.spaceEvenly); final RenderFlex flex = new RenderFlex(mainAxisAlignment: MainAxisAlignment.spaceEvenly);
flex.addAll(<RenderBox>[box1, box2, box3]); flex.addAll(<RenderBox>[box1, box2, box3]);
layout(flex, constraints: const BoxConstraints( layout(flex, constraints: const BoxConstraints(
minWidth: 0.0, maxWidth: 500.0, minHeight: 0.0, maxHeight: 400.0) minWidth: 0.0, maxWidth: 500.0, minHeight: 0.0, maxHeight: 400.0)
); );
Offset getOffset(RenderBox box) { Offset getOffset(RenderBox box) {
FlexParentData parentData = box.parentData; final FlexParentData parentData = box.parentData;
return parentData.offset; return parentData.offset;
} }
expect(getOffset(box1).dx, equals(50.0)); expect(getOffset(box1).dx, equals(50.0));
...@@ -168,16 +168,16 @@ void main() { ...@@ -168,16 +168,16 @@ void main() {
}); });
test('Fit.loose', () { test('Fit.loose', () {
RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0)); final RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0)); final RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0)); final RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderFlex flex = new RenderFlex(mainAxisAlignment: MainAxisAlignment.spaceBetween); final RenderFlex flex = new RenderFlex(mainAxisAlignment: MainAxisAlignment.spaceBetween);
flex.addAll(<RenderBox>[box1, box2, box3]); flex.addAll(<RenderBox>[box1, box2, box3]);
layout(flex, constraints: const BoxConstraints( layout(flex, constraints: const BoxConstraints(
minWidth: 0.0, maxWidth: 500.0, minHeight: 0.0, maxHeight: 400.0) minWidth: 0.0, maxWidth: 500.0, minHeight: 0.0, maxHeight: 400.0)
); );
Offset getOffset(RenderBox box) { Offset getOffset(RenderBox box) {
FlexParentData parentData = box.parentData; final FlexParentData parentData = box.parentData;
return parentData.offset; return parentData.offset;
} }
expect(getOffset(box1).dx, equals(0.0)); expect(getOffset(box1).dx, equals(0.0));
...@@ -188,7 +188,7 @@ void main() { ...@@ -188,7 +188,7 @@ void main() {
expect(box3.size.width, equals(100.0)); expect(box3.size.width, equals(100.0));
void setFit(RenderBox box, FlexFit fit) { void setFit(RenderBox box, FlexFit fit) {
FlexParentData parentData = box.parentData; final FlexParentData parentData = box.parentData;
parentData.flex = 1; parentData.flex = 1;
parentData.fit = fit; parentData.fit = fit;
} }
...@@ -216,10 +216,10 @@ void main() { ...@@ -216,10 +216,10 @@ void main() {
}); });
test('Flexible with MainAxisSize.min', () { test('Flexible with MainAxisSize.min', () {
RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0)); final RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0)); final RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0)); final RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderFlex flex = new RenderFlex( final RenderFlex flex = new RenderFlex(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween mainAxisAlignment: MainAxisAlignment.spaceBetween
); );
...@@ -228,7 +228,7 @@ void main() { ...@@ -228,7 +228,7 @@ void main() {
minWidth: 0.0, maxWidth: 500.0, minHeight: 0.0, maxHeight: 400.0) minWidth: 0.0, maxWidth: 500.0, minHeight: 0.0, maxHeight: 400.0)
); );
Offset getOffset(RenderBox box) { Offset getOffset(RenderBox box) {
FlexParentData parentData = box.parentData; final FlexParentData parentData = box.parentData;
return parentData.offset; return parentData.offset;
} }
expect(getOffset(box1).dx, equals(0.0)); expect(getOffset(box1).dx, equals(0.0));
...@@ -240,7 +240,7 @@ void main() { ...@@ -240,7 +240,7 @@ void main() {
expect(flex.size.width, equals(300.0)); expect(flex.size.width, equals(300.0));
void setFit(RenderBox box, FlexFit fit) { void setFit(RenderBox box, FlexFit fit) {
FlexParentData parentData = box.parentData; final FlexParentData parentData = box.parentData;
parentData.flex = 1; parentData.flex = 1;
parentData.fit = fit; parentData.fit = fit;
} }
......
...@@ -37,15 +37,15 @@ void main() { ...@@ -37,15 +37,15 @@ void main() {
); );
test('onscreen layout does not affect offscreen', () { test('onscreen layout does not affect offscreen', () {
TestLayout onscreen = new TestLayout(); final TestLayout onscreen = new TestLayout();
TestLayout offscreen = new TestLayout(); final TestLayout offscreen = new TestLayout();
expect(onscreen.child.hasSize, isFalse); expect(onscreen.child.hasSize, isFalse);
expect(onscreen.painted, isFalse); expect(onscreen.painted, isFalse);
expect(offscreen.child.hasSize, isFalse); expect(offscreen.child.hasSize, isFalse);
expect(offscreen.painted, isFalse); expect(offscreen.painted, isFalse);
// Attach the offscreen to a custom render view and owner // Attach the offscreen to a custom render view and owner
RenderView renderView = new RenderView(configuration: testConfiguration); final RenderView renderView = new RenderView(configuration: testConfiguration);
PipelineOwner pipelineOwner = new PipelineOwner(); final PipelineOwner pipelineOwner = new PipelineOwner();
renderView.attach(pipelineOwner); renderView.attach(pipelineOwner);
renderView.child = offscreen.root; renderView.child = offscreen.root;
renderView.scheduleInitialFrame(); renderView.scheduleInitialFrame();
...@@ -66,15 +66,15 @@ void main() { ...@@ -66,15 +66,15 @@ void main() {
expect(offscreen.painted, isTrue); expect(offscreen.painted, isTrue);
}); });
test('offscreen layout does not affect onscreen', () { test('offscreen layout does not affect onscreen', () {
TestLayout onscreen = new TestLayout(); final TestLayout onscreen = new TestLayout();
TestLayout offscreen = new TestLayout(); final TestLayout offscreen = new TestLayout();
expect(onscreen.child.hasSize, isFalse); expect(onscreen.child.hasSize, isFalse);
expect(onscreen.painted, isFalse); expect(onscreen.painted, isFalse);
expect(offscreen.child.hasSize, isFalse); expect(offscreen.child.hasSize, isFalse);
expect(offscreen.painted, isFalse); expect(offscreen.painted, isFalse);
// Attach the offscreen to a custom render view and owner // Attach the offscreen to a custom render view and owner
RenderView renderView = new RenderView(configuration: testConfiguration); final RenderView renderView = new RenderView(configuration: testConfiguration);
PipelineOwner pipelineOwner = new PipelineOwner(); final PipelineOwner pipelineOwner = new PipelineOwner();
renderView.attach(pipelineOwner); renderView.attach(pipelineOwner);
renderView.child = offscreen.root; renderView.child = offscreen.root;
renderView.scheduleInitialFrame(); renderView.scheduleInitialFrame();
......
...@@ -45,8 +45,8 @@ class RenderTestBox extends RenderBox { ...@@ -45,8 +45,8 @@ class RenderTestBox extends RenderBox {
void main() { void main() {
test('Shrink-wrapping width', () { test('Shrink-wrapping width', () {
RenderBox child = new RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0)); final RenderBox child = new RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
RenderBox parent = new RenderIntrinsicWidth(child: child); final RenderBox parent = new RenderIntrinsicWidth(child: child);
layout(parent, layout(parent,
constraints: const BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
...@@ -80,7 +80,7 @@ void main() { ...@@ -80,7 +80,7 @@ void main() {
}); });
test('IntrinsicWidth without a child', () { test('IntrinsicWidth without a child', () {
RenderBox parent = new RenderIntrinsicWidth(); final RenderBox parent = new RenderIntrinsicWidth();
layout(parent, layout(parent,
constraints: const BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
...@@ -114,8 +114,8 @@ void main() { ...@@ -114,8 +114,8 @@ void main() {
}); });
test('Shrink-wrapping width (stepped width)', () { test('Shrink-wrapping width (stepped width)', () {
RenderBox child = new RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0)); final RenderBox child = new RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
RenderBox parent = new RenderIntrinsicWidth(child: child, stepWidth: 47.0); final RenderBox parent = new RenderIntrinsicWidth(child: child, stepWidth: 47.0);
layout(parent, layout(parent,
constraints: const BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
...@@ -149,8 +149,8 @@ void main() { ...@@ -149,8 +149,8 @@ void main() {
}); });
test('Shrink-wrapping width (stepped height)', () { test('Shrink-wrapping width (stepped height)', () {
RenderBox child = new RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0)); final RenderBox child = new RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
RenderBox parent = new RenderIntrinsicWidth(child: child, stepHeight: 47.0); final RenderBox parent = new RenderIntrinsicWidth(child: child, stepHeight: 47.0);
layout(parent, layout(parent,
constraints: const BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
...@@ -184,8 +184,8 @@ void main() { ...@@ -184,8 +184,8 @@ void main() {
}); });
test('Shrink-wrapping width (stepped everything)', () { test('Shrink-wrapping width (stepped everything)', () {
RenderBox child = new RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0)); final RenderBox child = new RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
RenderBox parent = new RenderIntrinsicWidth(child: child, stepHeight: 47.0, stepWidth: 37.0); final RenderBox parent = new RenderIntrinsicWidth(child: child, stepHeight: 47.0, stepWidth: 37.0);
layout(parent, layout(parent,
constraints: const BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
...@@ -219,8 +219,8 @@ void main() { ...@@ -219,8 +219,8 @@ void main() {
}); });
test('Shrink-wrapping height', () { test('Shrink-wrapping height', () {
RenderBox child = new RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0)); final RenderBox child = new RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
RenderBox parent = new RenderIntrinsicHeight(child: child); final RenderBox parent = new RenderIntrinsicHeight(child: child);
layout(parent, layout(parent,
constraints: const BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
...@@ -254,7 +254,7 @@ void main() { ...@@ -254,7 +254,7 @@ void main() {
}); });
test('IntrinsicHeight without a child', () { test('IntrinsicHeight without a child', () {
RenderBox parent = new RenderIntrinsicHeight(); final RenderBox parent = new RenderIntrinsicHeight();
layout(parent, layout(parent,
constraints: const BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
...@@ -288,7 +288,7 @@ void main() { ...@@ -288,7 +288,7 @@ void main() {
}); });
test('Padding and boring intrinsics', () { test('Padding and boring intrinsics', () {
RenderBox box = new RenderPadding( final RenderBox box = new RenderPadding(
padding: const EdgeInsets.all(15.0), padding: const EdgeInsets.all(15.0),
child: new RenderSizedBox(const Size(20.0, 20.0)) child: new RenderSizedBox(const Size(20.0, 20.0))
); );
...@@ -326,7 +326,7 @@ void main() { ...@@ -326,7 +326,7 @@ void main() {
}); });
test('Padding and interesting intrinsics', () { test('Padding and interesting intrinsics', () {
RenderBox box = new RenderPadding( final RenderBox box = new RenderPadding(
padding: const EdgeInsets.all(15.0), padding: const EdgeInsets.all(15.0),
child: new RenderAspectRatio(aspectRatio: 1.0) child: new RenderAspectRatio(aspectRatio: 1.0)
); );
...@@ -364,7 +364,7 @@ void main() { ...@@ -364,7 +364,7 @@ void main() {
}); });
test('Padding and boring intrinsics', () { test('Padding and boring intrinsics', () {
RenderBox box = new RenderPadding( final RenderBox box = new RenderPadding(
padding: const EdgeInsets.all(15.0), padding: const EdgeInsets.all(15.0),
child: new RenderSizedBox(const Size(20.0, 20.0)) child: new RenderSizedBox(const Size(20.0, 20.0))
); );
...@@ -402,7 +402,7 @@ void main() { ...@@ -402,7 +402,7 @@ void main() {
}); });
test('Padding and interesting intrinsics', () { test('Padding and interesting intrinsics', () {
RenderBox box = new RenderPadding( final RenderBox box = new RenderPadding(
padding: const EdgeInsets.all(15.0), padding: const EdgeInsets.all(15.0),
child: new RenderAspectRatio(aspectRatio: 1.0) child: new RenderAspectRatio(aspectRatio: 1.0)
); );
......
...@@ -10,10 +10,10 @@ import 'rendering_tester.dart'; ...@@ -10,10 +10,10 @@ import 'rendering_tester.dart';
void main() { void main() {
test('LimitedBox: parent max size is unconstrained', () { test('LimitedBox: parent max size is unconstrained', () {
RenderBox child = new RenderConstrainedBox( final RenderBox child = new RenderConstrainedBox(
additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0) additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0)
); );
RenderBox parent = new RenderConstrainedOverflowBox( final RenderBox parent = new RenderConstrainedOverflowBox(
minWidth: 0.0, minWidth: 0.0,
maxWidth: double.INFINITY, maxWidth: double.INFINITY,
minHeight: 0.0, minHeight: 0.0,
...@@ -30,10 +30,10 @@ void main() { ...@@ -30,10 +30,10 @@ void main() {
}); });
test('LimitedBox: parent maxWidth is unconstrained', () { test('LimitedBox: parent maxWidth is unconstrained', () {
RenderBox child = new RenderConstrainedBox( final RenderBox child = new RenderConstrainedBox(
additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0) additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0)
); );
RenderBox parent = new RenderConstrainedOverflowBox( final RenderBox parent = new RenderConstrainedOverflowBox(
minWidth: 0.0, minWidth: 0.0,
maxWidth: double.INFINITY, maxWidth: double.INFINITY,
minHeight: 500.0, minHeight: 500.0,
...@@ -50,10 +50,10 @@ void main() { ...@@ -50,10 +50,10 @@ void main() {
}); });
test('LimitedBox: parent maxHeight is unconstrained', () { test('LimitedBox: parent maxHeight is unconstrained', () {
RenderBox child = new RenderConstrainedBox( final RenderBox child = new RenderConstrainedBox(
additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0) additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0)
); );
RenderBox parent = new RenderConstrainedOverflowBox( final RenderBox parent = new RenderConstrainedOverflowBox(
minWidth: 500.0, minWidth: 500.0,
maxWidth: 500.0, maxWidth: 500.0,
minHeight: 0.0, minHeight: 0.0,
...@@ -72,7 +72,7 @@ void main() { ...@@ -72,7 +72,7 @@ void main() {
test('LimitedBox: no child', () { test('LimitedBox: no child', () {
RenderBox box; RenderBox box;
RenderBox parent = new RenderConstrainedOverflowBox( final RenderBox parent = new RenderConstrainedOverflowBox(
minWidth: 10.0, minWidth: 10.0,
maxWidth: 500.0, maxWidth: 500.0,
minHeight: 0.0, minHeight: 0.0,
......
...@@ -355,8 +355,8 @@ class _TestRecordingCanvasPatternMatcher extends Matcher implements PaintPattern ...@@ -355,8 +355,8 @@ class _TestRecordingCanvasPatternMatcher extends Matcher implements PaintPattern
description.write('painted nothing.'); description.write('painted nothing.');
return false; return false;
} }
Iterator<_PaintPredicate> predicate = _predicates.iterator; final Iterator<_PaintPredicate> predicate = _predicates.iterator;
Iterator<Invocation> call = calls.iterator..moveNext(); final Iterator<Invocation> call = calls.iterator..moveNext();
try { try {
while (predicate.moveNext()) { while (predicate.moveNext()) {
if (call.current == null) { if (call.current == null) {
...@@ -473,7 +473,7 @@ abstract class _DrawCommandPaintPredicate extends _PaintPredicate { ...@@ -473,7 +473,7 @@ abstract class _DrawCommandPaintPredicate extends _PaintPredicate {
@override @override
void match(Iterator<Invocation> call) { void match(Iterator<Invocation> call) {
int others = 0; int others = 0;
Invocation firstCall = call.current; final Invocation firstCall = call.current;
while (!call.current.isMethod || call.current.memberName != symbol) { while (!call.current.isMethod || call.current.memberName != symbol) {
others += 1; others += 1;
if (!call.moveNext()) if (!call.moveNext())
...@@ -506,7 +506,7 @@ abstract class _DrawCommandPaintPredicate extends _PaintPredicate { ...@@ -506,7 +506,7 @@ abstract class _DrawCommandPaintPredicate extends _PaintPredicate {
@override @override
String toString() { String toString() {
List<String> description = <String>[]; final List<String> description = <String>[];
debugFillDescription(description); debugFillDescription(description);
String result = name; String result = name;
if (description.isNotEmpty) if (description.isNotEmpty)
...@@ -680,7 +680,7 @@ class _FunctionPaintPredicate extends _PaintPredicate { ...@@ -680,7 +680,7 @@ class _FunctionPaintPredicate extends _PaintPredicate {
@override @override
void match(Iterator<Invocation> call) { void match(Iterator<Invocation> call) {
int others = 0; int others = 0;
Invocation firstCall = call.current; final Invocation firstCall = call.current;
while (!call.current.isMethod || call.current.memberName != symbol) { while (!call.current.isMethod || call.current.memberName != symbol) {
others += 1; others += 1;
if (!call.moveNext()) if (!call.moveNext())
...@@ -701,7 +701,7 @@ class _FunctionPaintPredicate extends _PaintPredicate { ...@@ -701,7 +701,7 @@ class _FunctionPaintPredicate extends _PaintPredicate {
@override @override
String toString() { String toString() {
List<String> adjectives = <String>[]; final List<String> adjectives = <String>[];
for (int index = 0; index < arguments.length; index += 1) for (int index = 0; index < arguments.length; index += 1)
adjectives.add(arguments[index] != null ? _valueName(arguments[index]) : '...'); adjectives.add(arguments[index] != null ? _valueName(arguments[index]) : '...');
return '${_symbolName(symbol)}(${adjectives.join(", ")})'; return '${_symbolName(symbol)}(${adjectives.join(", ")})';
...@@ -712,7 +712,7 @@ class _SaveRestorePairPaintPredicate extends _PaintPredicate { ...@@ -712,7 +712,7 @@ class _SaveRestorePairPaintPredicate extends _PaintPredicate {
@override @override
void match(Iterator<Invocation> call) { void match(Iterator<Invocation> call) {
int others = 0; int others = 0;
Invocation firstCall = call.current; final Invocation firstCall = call.current;
while (!call.current.isMethod || call.current.memberName != #save) { while (!call.current.isMethod || call.current.memberName != #save) {
others += 1; others += 1;
if (!call.moveNext()) if (!call.moveNext())
......
...@@ -36,7 +36,7 @@ void main() { ...@@ -36,7 +36,7 @@ void main() {
RenderBox child1, child2; RenderBox child1, child2;
bool movedChild1 = false; bool movedChild1 = false;
bool movedChild2 = false; bool movedChild2 = false;
RenderFlex block = new RenderFlex(); final RenderFlex block = new RenderFlex();
block.add(child1 = new RenderLayoutTestBox(() { movedChild1 = true; })); block.add(child1 = new RenderLayoutTestBox(() { movedChild1 = true; }));
block.add(child2 = new RenderLayoutTestBox(() { movedChild2 = true; })); block.add(child2 = new RenderLayoutTestBox(() { movedChild2 = true; }));
......
...@@ -45,7 +45,7 @@ class RealRoot extends AbstractNode { ...@@ -45,7 +45,7 @@ class RealRoot extends AbstractNode {
void main() { void main() {
test("non-RenderObject roots", () { test("non-RenderObject roots", () {
RenderPositionedBox child; RenderPositionedBox child;
RealRoot root = new RealRoot( final RealRoot root = new RealRoot(
child = new RenderPositionedBox( child = new RenderPositionedBox(
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
child: new RenderSizedBox(const Size(100.0, 100.0)) child: new RenderSizedBox(const Size(100.0, 100.0))
......
...@@ -13,7 +13,7 @@ void main() { ...@@ -13,7 +13,7 @@ void main() {
RenderBox child; RenderBox child;
bool painted = false; bool painted = false;
// incoming constraints are tight 800x600 // incoming constraints are tight 800x600
RenderBox root = new RenderPositionedBox( final RenderBox root = new RenderPositionedBox(
child: new RenderConstrainedBox( child: new RenderConstrainedBox(
additionalConstraints: const BoxConstraints.tightFor(width: 800.0), additionalConstraints: const BoxConstraints.tightFor(width: 800.0),
child: new RenderOffstage( child: new RenderOffstage(
......
...@@ -13,37 +13,37 @@ const String _kText = 'I polished up that handle so carefullee\nThat now I am th ...@@ -13,37 +13,37 @@ const String _kText = 'I polished up that handle so carefullee\nThat now I am th
void main() { void main() {
test('getOffsetForCaret control test', () { test('getOffsetForCaret control test', () {
RenderParagraph paragraph = new RenderParagraph(const TextSpan(text: _kText)); final RenderParagraph paragraph = new RenderParagraph(const TextSpan(text: _kText));
layout(paragraph); layout(paragraph);
Rect caret = new Rect.fromLTWH(0.0, 0.0, 2.0, 20.0); final Rect caret = new Rect.fromLTWH(0.0, 0.0, 2.0, 20.0);
Offset offset5 = paragraph.getOffsetForCaret(const TextPosition(offset: 5), caret); final Offset offset5 = paragraph.getOffsetForCaret(const TextPosition(offset: 5), caret);
expect(offset5.dx, greaterThan(0.0)); expect(offset5.dx, greaterThan(0.0));
Offset offset25 = paragraph.getOffsetForCaret(const TextPosition(offset: 25), caret); final Offset offset25 = paragraph.getOffsetForCaret(const TextPosition(offset: 25), caret);
expect(offset25.dx, greaterThan(offset5.dx)); expect(offset25.dx, greaterThan(offset5.dx));
Offset offset50 = paragraph.getOffsetForCaret(const TextPosition(offset: 50), caret); final Offset offset50 = paragraph.getOffsetForCaret(const TextPosition(offset: 50), caret);
expect(offset50.dy, greaterThan(offset5.dy)); expect(offset50.dy, greaterThan(offset5.dy));
}); });
test('getPositionForOffset control test', () { test('getPositionForOffset control test', () {
RenderParagraph paragraph = new RenderParagraph(const TextSpan(text: _kText)); final RenderParagraph paragraph = new RenderParagraph(const TextSpan(text: _kText));
layout(paragraph); layout(paragraph);
TextPosition position20 = paragraph.getPositionForOffset(const Offset(20.0, 5.0)); final TextPosition position20 = paragraph.getPositionForOffset(const Offset(20.0, 5.0));
expect(position20.offset, greaterThan(0.0)); expect(position20.offset, greaterThan(0.0));
TextPosition position40 = paragraph.getPositionForOffset(const Offset(40.0, 5.0)); final TextPosition position40 = paragraph.getPositionForOffset(const Offset(40.0, 5.0));
expect(position40.offset, greaterThan(position20.offset)); expect(position40.offset, greaterThan(position20.offset));
TextPosition positionBelow = paragraph.getPositionForOffset(const Offset(5.0, 20.0)); final TextPosition positionBelow = paragraph.getPositionForOffset(const Offset(5.0, 20.0));
expect(positionBelow.offset, greaterThan(position40.offset)); expect(positionBelow.offset, greaterThan(position40.offset));
}); });
test('getBoxesForSelection control test', () { test('getBoxesForSelection control test', () {
RenderParagraph paragraph = new RenderParagraph(const TextSpan(text: _kText)); final RenderParagraph paragraph = new RenderParagraph(const TextSpan(text: _kText));
layout(paragraph); layout(paragraph);
List<ui.TextBox> boxes = paragraph.getBoxesForSelection( List<ui.TextBox> boxes = paragraph.getBoxesForSelection(
...@@ -60,21 +60,21 @@ void main() { ...@@ -60,21 +60,21 @@ void main() {
}); });
test('getWordBoundary control test', () { test('getWordBoundary control test', () {
RenderParagraph paragraph = new RenderParagraph(const TextSpan(text: _kText)); final RenderParagraph paragraph = new RenderParagraph(const TextSpan(text: _kText));
layout(paragraph); layout(paragraph);
TextRange range5 = paragraph.getWordBoundary(const TextPosition(offset: 5)); final TextRange range5 = paragraph.getWordBoundary(const TextPosition(offset: 5));
expect(range5.textInside(_kText), equals('polished')); expect(range5.textInside(_kText), equals('polished'));
TextRange range50 = paragraph.getWordBoundary(const TextPosition(offset: 50)); final TextRange range50 = paragraph.getWordBoundary(const TextPosition(offset: 50));
expect(range50.textInside(_kText), equals(' ')); expect(range50.textInside(_kText), equals(' '));
TextRange range85 = paragraph.getWordBoundary(const TextPosition(offset: 75)); final TextRange range85 = paragraph.getWordBoundary(const TextPosition(offset: 75));
expect(range85.textInside(_kText), equals('Queen\'s')); expect(range85.textInside(_kText), equals('Queen\'s'));
}); });
test('overflow test', () { test('overflow test', () {
RenderParagraph paragraph = new RenderParagraph( final RenderParagraph paragraph = new RenderParagraph(
const TextSpan(text: 'This is\na wrapping test. It should wrap at manual newlines, and if softWrap is true, also at spaces.'), const TextSpan(text: 'This is\na wrapping test. It should wrap at manual newlines, and if softWrap is true, also at spaces.'),
maxLines: 1, maxLines: 1,
softWrap: true, softWrap: true,
...@@ -90,7 +90,7 @@ void main() { ...@@ -90,7 +90,7 @@ void main() {
// Lay out in a narrow box to force wrapping. // Lay out in a narrow box to force wrapping.
layout(paragraph, constraints: const BoxConstraints(maxWidth: 50.0)); layout(paragraph, constraints: const BoxConstraints(maxWidth: 50.0));
double lineHeight = paragraph.size.height; final double lineHeight = paragraph.size.height;
relayoutWith(maxLines: 3, softWrap: true, overflow: TextOverflow.clip); relayoutWith(maxLines: 3, softWrap: true, overflow: TextOverflow.clip);
expect(paragraph.size.height, equals(3 * lineHeight)); expect(paragraph.size.height, equals(3 * lineHeight));
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment