Commit c8447c91 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by Ian Hickson

prefer_const_constructor in packages/flutter/test (#7181)

parent b0ee29d7
...@@ -17,7 +17,7 @@ void main() { ...@@ -17,7 +17,7 @@ void main() {
test('toString control test', () { test('toString control test', () {
expect(kAlwaysCompleteAnimation.toString(), hasOneLineDescription); expect(kAlwaysCompleteAnimation.toString(), hasOneLineDescription);
expect(kAlwaysDismissedAnimation.toString(), hasOneLineDescription); expect(kAlwaysDismissedAnimation.toString(), hasOneLineDescription);
expect(new AlwaysStoppedAnimation<double>(0.5).toString(), hasOneLineDescription); expect(const AlwaysStoppedAnimation<double>(0.5).toString(), hasOneLineDescription);
CurvedAnimation curvedAnimation = new CurvedAnimation( CurvedAnimation curvedAnimation = new CurvedAnimation(
parent: kAlwaysDismissedAnimation, parent: kAlwaysDismissedAnimation,
curve: Curves.ease curve: Curves.ease
......
...@@ -11,8 +11,8 @@ import 'package:flutter/widgets.dart'; ...@@ -11,8 +11,8 @@ import 'package:flutter/widgets.dart';
void main() { void main() {
test('toString control test', () { test('toString control test', () {
expect(Curves.linear, hasOneLineDescription); expect(Curves.linear, hasOneLineDescription);
expect(new SawTooth(3), hasOneLineDescription); expect(const SawTooth(3), hasOneLineDescription);
expect(new Interval(0.25, 0.75), hasOneLineDescription); expect(const Interval(0.25, 0.75), hasOneLineDescription);
expect(new Interval(0.25, 0.75, curve: Curves.ease), hasOneLineDescription); expect(new Interval(0.25, 0.75, curve: Curves.ease), hasOneLineDescription);
}); });
...@@ -26,7 +26,7 @@ void main() { ...@@ -26,7 +26,7 @@ void main() {
}); });
test('Threshold has a threshold', () { test('Threshold has a threshold', () {
Curve step = new Threshold(0.25); 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);
......
...@@ -33,8 +33,8 @@ void main() { ...@@ -33,8 +33,8 @@ void main() {
}); });
test('SizeTween', () { test('SizeTween', () {
SizeTween tween = new SizeTween(begin: Size.zero, end: new Size(20.0, 30.0)); SizeTween tween = new SizeTween(begin: Size.zero, end: const Size(20.0, 30.0));
expect(tween.lerp(0.5), equals(new Size(10.0, 15.0))); expect(tween.lerp(0.5), equals(const Size(10.0, 15.0)));
expect(tween, hasOneLineDescription); expect(tween, hasOneLineDescription);
}); });
......
...@@ -386,12 +386,12 @@ void main() { ...@@ -386,12 +386,12 @@ void main() {
Expression e = new Expression(<Term>[t], 0.0); Expression e = new Expression(<Term>[t], 0.0);
expect((c * c).value, 100); expect((c * c).value, 100);
expect(() => v * v, throwsA(new isInstanceOf<ParserException>())); expect(() => v * v, throwsA(const isInstanceOf<ParserException>()));
expect(() => v / v, throwsA(new isInstanceOf<ParserException>())); expect(() => v / v, throwsA(const isInstanceOf<ParserException>()));
expect(() => v * t, throwsA(new isInstanceOf<ParserException>())); expect(() => v * t, throwsA(const isInstanceOf<ParserException>()));
expect(() => v / t, throwsA(new isInstanceOf<ParserException>())); expect(() => v / t, throwsA(const isInstanceOf<ParserException>()));
expect(() => v * e, throwsA(new isInstanceOf<ParserException>())); expect(() => v * e, throwsA(const isInstanceOf<ParserException>()));
expect(() => v / e, throwsA(new isInstanceOf<ParserException>())); expect(() => v / e, throwsA(const isInstanceOf<ParserException>()));
expect(() => v * c, returnsNormally); expect(() => v * c, returnsNormally);
expect(() => v / c, returnsNormally); expect(() => v / c, returnsNormally);
}); });
......
...@@ -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 = new Color(0x12345678); 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,7 +16,7 @@ void main() { ...@@ -16,7 +16,7 @@ void main() {
}); });
test("paint set to black", () { test("paint set to black", () {
Color c = new Color(0x00000000); Color c = const Color(0x00000000);
Paint p = new Paint(); Paint p = new Paint();
p.color = c; p.color = c;
expect(c.toString(), equals('Color(0x00000000)')); expect(c.toString(), equals('Color(0x00000000)'));
...@@ -24,7 +24,7 @@ void main() { ...@@ -24,7 +24,7 @@ void main() {
test("color created with out of bounds value", () { test("color created with out of bounds value", () {
try { try {
Color c = new Color(0x100 << 24); Color c = const Color(0x100 << 24);
Paint p = new Paint(); Paint p = new Paint();
p.color = c; p.color = c;
} catch (e) { } catch (e) {
...@@ -34,7 +34,7 @@ void main() { ...@@ -34,7 +34,7 @@ void main() {
test("color created with wildly out of bounds value", () { test("color created with wildly out of bounds value", () {
try { try {
Color c = new Color(1 << 1000000); Color c = const Color(1 << 1000000);
Paint p = new Paint(); Paint p = new Paint();
p.color = c; p.color = c;
} catch (e) { } catch (e) {
......
...@@ -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 = new LicenseEntryWithLineBreaks(null, ''' List<LicenseParagraph> paragraphs = const LicenseEntryWithLineBreaks(null, '''
A A
A A
A A
...@@ -157,16 +157,16 @@ S ...@@ -157,16 +157,16 @@ S
}); });
test('LicenseEntryWithLineBreaks - leading and trailing whitespace', () { test('LicenseEntryWithLineBreaks - leading and trailing whitespace', () {
expect(new LicenseEntryWithLineBreaks(null, ' \n\n ').paragraphs.toList(), isEmpty); expect(const LicenseEntryWithLineBreaks(null, ' \n\n ').paragraphs.toList(), isEmpty);
List<LicenseParagraph> paragraphs; List<LicenseParagraph> paragraphs;
paragraphs = new LicenseEntryWithLineBreaks(null, ' \nA\n ').paragraphs.toList(); paragraphs = const LicenseEntryWithLineBreaks(null, ' \nA\n ').paragraphs.toList();
expect(paragraphs[0].text, 'A'); expect(paragraphs[0].text, 'A');
expect(paragraphs[0].indent, 0); expect(paragraphs[0].indent, 0);
expect(paragraphs, hasLength(1)); expect(paragraphs, hasLength(1));
paragraphs = new LicenseEntryWithLineBreaks(null, '\n\n\nA\n\n\n').paragraphs.toList(); paragraphs = const LicenseEntryWithLineBreaks(null, '\n\n\nA\n\n\n').paragraphs.toList();
expect(paragraphs[0].text, 'A'); expect(paragraphs[0].text, 'A');
expect(paragraphs[0].indent, 0); expect(paragraphs[0].indent, 0);
expect(paragraphs, hasLength(1)); expect(paragraphs, hasLength(1));
...@@ -175,12 +175,12 @@ S ...@@ -175,12 +175,12 @@ S
test('LicenseRegistry', () async { test('LicenseRegistry', () async {
expect(await LicenseRegistry.licenses.toList(), isEmpty); expect(await LicenseRegistry.licenses.toList(), isEmpty);
LicenseRegistry.addLicense(() async* { LicenseRegistry.addLicense(() async* {
yield new LicenseEntryWithLineBreaks(null, 'A'); yield const LicenseEntryWithLineBreaks(null, 'A');
yield new LicenseEntryWithLineBreaks(null, 'B'); yield const LicenseEntryWithLineBreaks(null, 'B');
}); });
LicenseRegistry.addLicense(() async* { LicenseRegistry.addLicense(() async* {
yield new LicenseEntryWithLineBreaks(null, 'C'); yield const LicenseEntryWithLineBreaks(null, 'C');
yield new 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(); List<LicenseEntry> licenses = await LicenseRegistry.licenses.toList();
......
...@@ -206,7 +206,7 @@ void main() { ...@@ -206,7 +206,7 @@ void main() {
GestureBinding.instance.gestureArena.sweep(1); GestureBinding.instance.gestureArena.sweep(1);
expect(doubleTapRecognized, isFalse); expect(doubleTapRecognized, isFalse);
tester.async.elapse(new Duration(milliseconds: 5000)); tester.async.elapse(const Duration(milliseconds: 5000));
tap.addPointer(down2); tap.addPointer(down2);
tester.closeArena(2); tester.closeArena(2);
expect(doubleTapRecognized, isFalse); expect(doubleTapRecognized, isFalse);
...@@ -240,7 +240,7 @@ void main() { ...@@ -240,7 +240,7 @@ void main() {
GestureBinding.instance.gestureArena.sweep(1); GestureBinding.instance.gestureArena.sweep(1);
expect(doubleTapRecognized, isFalse); expect(doubleTapRecognized, isFalse);
tester.async.elapse(new Duration(milliseconds: 5000)); tester.async.elapse(const Duration(milliseconds: 5000));
tap.addPointer(down2); tap.addPointer(down2);
tester.closeArena(2); tester.closeArena(2);
expect(doubleTapRecognized, isFalse); expect(doubleTapRecognized, isFalse);
...@@ -252,7 +252,7 @@ void main() { ...@@ -252,7 +252,7 @@ void main() {
GestureBinding.instance.gestureArena.sweep(2); GestureBinding.instance.gestureArena.sweep(2);
expect(doubleTapRecognized, isFalse); expect(doubleTapRecognized, isFalse);
tester.async.elapse(new Duration(milliseconds: 100)); tester.async.elapse(const Duration(milliseconds: 100));
tap.addPointer(down5); tap.addPointer(down5);
tester.closeArena(5); tester.closeArena(5);
expect(doubleTapRecognized, isFalse); expect(doubleTapRecognized, isFalse);
...@@ -281,7 +281,7 @@ void main() { ...@@ -281,7 +281,7 @@ void main() {
tester.route(down1); tester.route(down1);
expect(doubleTapRecognized, isFalse); expect(doubleTapRecognized, isFalse);
tester.async.elapse(new Duration(milliseconds: 1000)); tester.async.elapse(const Duration(milliseconds: 1000));
tester.route(up1); tester.route(up1);
expect(doubleTapRecognized, isFalse); expect(doubleTapRecognized, isFalse);
GestureBinding.instance.gestureArena.sweep(1); GestureBinding.instance.gestureArena.sweep(1);
......
...@@ -11,8 +11,8 @@ void main() { ...@@ -11,8 +11,8 @@ void main() {
setUp(ensureGestureBinding); setUp(ensureGestureBinding);
testGesture('toString control tests', (GestureTester tester) { testGesture('toString control tests', (GestureTester tester) {
expect(new PointerDownEvent(), hasOneLineDescription); expect(const PointerDownEvent(), hasOneLineDescription);
expect(new PointerDownEvent().toStringFull(), hasOneLineDescription); expect(const PointerDownEvent().toStringFull(), hasOneLineDescription);
}); });
testGesture('nthMouseButton control tests', (GestureTester tester) { testGesture('nthMouseButton control tests', (GestureTester tester) {
......
...@@ -33,10 +33,10 @@ void main() { ...@@ -33,10 +33,10 @@ void main() {
setUp(ensureTestGestureBinding); setUp(ensureTestGestureBinding);
test('Pointer tap events', () { test('Pointer tap events', () {
ui.PointerDataPacket packet = new ui.PointerDataPacket( ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: <ui.PointerData>[ data: const <ui.PointerData>[
new ui.PointerData(change: ui.PointerChange.down), const ui.PointerData(change: ui.PointerChange.down),
new ui.PointerData(change: ui.PointerChange.up), const ui.PointerData(change: ui.PointerChange.up),
] ]
); );
...@@ -50,11 +50,11 @@ void main() { ...@@ -50,11 +50,11 @@ void main() {
}); });
test('Pointer move events', () { test('Pointer move events', () {
ui.PointerDataPacket packet = new ui.PointerDataPacket( ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: <ui.PointerData>[ data: const <ui.PointerData>[
new ui.PointerData(change: ui.PointerChange.down), const ui.PointerData(change: ui.PointerChange.down),
new ui.PointerData(change: ui.PointerChange.move), const ui.PointerData(change: ui.PointerChange.move),
new ui.PointerData(change: ui.PointerChange.up), const ui.PointerData(change: ui.PointerChange.up),
] ]
); );
...@@ -69,14 +69,14 @@ void main() { ...@@ -69,14 +69,14 @@ void main() {
}); });
test('Synthetic move events', () { test('Synthetic move events', () {
ui.PointerDataPacket packet = new ui.PointerDataPacket( ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: <ui.PointerData>[ data: const <ui.PointerData>[
new ui.PointerData( const ui.PointerData(
change: ui.PointerChange.down, change: ui.PointerChange.down,
physicalX: 1.0, physicalX: 1.0,
physicalY: 3.0, physicalY: 3.0,
), ),
new ui.PointerData( const ui.PointerData(
change: ui.PointerChange.up, change: ui.PointerChange.up,
physicalX: 10.0, physicalX: 10.0,
physicalY: 15.0, physicalY: 15.0,
...@@ -96,10 +96,10 @@ void main() { ...@@ -96,10 +96,10 @@ void main() {
}); });
test('Pointer cancel events', () { test('Pointer cancel events', () {
ui.PointerDataPacket packet = new ui.PointerDataPacket( ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: <ui.PointerData>[ data: const <ui.PointerData>[
new ui.PointerData(change: ui.PointerChange.down), const ui.PointerData(change: ui.PointerChange.down),
new ui.PointerData(change: ui.PointerChange.cancel), const ui.PointerData(change: ui.PointerChange.cancel),
] ]
); );
...@@ -113,10 +113,10 @@ void main() { ...@@ -113,10 +113,10 @@ void main() {
}); });
test('Can cancel pointers', () { test('Can cancel pointers', () {
ui.PointerDataPacket packet = new ui.PointerDataPacket( ui.PointerDataPacket packet = const ui.PointerDataPacket(
data: <ui.PointerData>[ data: const <ui.PointerData>[
new ui.PointerData(change: ui.PointerChange.down), const ui.PointerData(change: ui.PointerChange.down),
new ui.PointerData(change: ui.PointerChange.up), const ui.PointerData(change: ui.PointerChange.up),
] ]
); );
......
...@@ -193,7 +193,7 @@ void main() { ...@@ -193,7 +193,7 @@ void main() {
tester.route(down1); tester.route(down1);
expect(tapRecognized, isFalse); expect(tapRecognized, isFalse);
tester.async.elapse(new Duration(milliseconds: 500)); tester.async.elapse(const Duration(milliseconds: 500));
expect(tapRecognized, isFalse); expect(tapRecognized, isFalse);
tester.route(up1); tester.route(up1);
expect(tapRecognized, isTrue); expect(tapRecognized, isTrue);
......
...@@ -49,13 +49,13 @@ void main() { ...@@ -49,13 +49,13 @@ void main() {
}); });
test('Velocity control test', () { test('Velocity control test', () {
Velocity velocity1 = new Velocity(pixelsPerSecond: const Offset(7.0, 0.0)); Velocity velocity1 = const Velocity(pixelsPerSecond: const Offset(7.0, 0.0));
Velocity velocity2 = new Velocity(pixelsPerSecond: const Offset(12.0, 0.0)); Velocity velocity2 = const Velocity(pixelsPerSecond: const Offset(12.0, 0.0));
expect(velocity1, equals(new Velocity(pixelsPerSecond: new 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(new Velocity(pixelsPerSecond: new Offset(5.0, 0.0)))); expect(velocity2 - velocity1, equals(const Velocity(pixelsPerSecond: const Offset(5.0, 0.0))));
expect((-velocity1).pixelsPerSecond, new Offset(-7.0, 0.0)); expect((-velocity1).pixelsPerSecond, const Offset(-7.0, 0.0));
expect(velocity1 + velocity2, equals(new Velocity(pixelsPerSecond: new Offset(19.0, 0.0)))); expect(velocity1 + velocity2, equals(const Velocity(pixelsPerSecond: const Offset(19.0, 0.0))));
expect(velocity1.hashCode, isNot(equals(velocity2.hashCode))); expect(velocity1.hashCode, isNot(equals(velocity2.hashCode)));
expect(velocity1, hasOneLineDescription); expect(velocity1, hasOneLineDescription);
}); });
......
...@@ -111,8 +111,8 @@ void main() { ...@@ -111,8 +111,8 @@ void main() {
expect(tester.getSize(title).width, equals(800.0 - 72.0 - 8.0)); expect(tester.getSize(title).width, equals(800.0 - 72.0 - 8.0));
actions = <Widget>[ actions = <Widget>[
new SizedBox(width: 100.0), const SizedBox(width: 100.0),
new SizedBox(width: 100.0) const SizedBox(width: 100.0)
]; ];
await tester.pumpWidget(buildApp()); await tester.pumpWidget(buildApp());
...@@ -171,8 +171,8 @@ void main() { ...@@ -171,8 +171,8 @@ void main() {
leading = null; leading = null;
titleWidth = 620.0; titleWidth = 620.0;
actions = <Widget>[ actions = <Widget>[
new SizedBox(width: 45.0), const SizedBox(width: 45.0),
new SizedBox(width: 45.0) const SizedBox(width: 45.0)
]; ];
await tester.pumpWidget(buildApp()); await tester.pumpWidget(buildApp());
expect(tester.getTopLeft(title).x, 800 - 620 - 45 - 45 - 8); expect(tester.getTopLeft(title).x, 800 - 620 - 45 - 45 - 8);
......
...@@ -9,16 +9,16 @@ void main() { ...@@ -9,16 +9,16 @@ void main() {
test('on-axis MaterialPointArcTween', () { test('on-axis MaterialPointArcTween', () {
MaterialPointArcTween tween = new MaterialPointArcTween( MaterialPointArcTween tween = new MaterialPointArcTween(
begin: Point.origin, begin: Point.origin,
end: new Point(0.0, 10.0) end: const Point(0.0, 10.0)
); );
expect(tween.lerp(0.5), equals(new Point(0.0, 5.0))); expect(tween.lerp(0.5), equals(const Point(0.0, 5.0)));
expect(tween, hasOneLineDescription); expect(tween, hasOneLineDescription);
tween = new MaterialPointArcTween( tween = new MaterialPointArcTween(
begin: Point.origin, begin: Point.origin,
end: new Point(10.0, 0.0) end: const Point(10.0, 0.0)
); );
expect(tween.lerp(0.5), equals(new Point(5.0, 0.0))); expect(tween.lerp(0.5), equals(const Point(5.0, 0.0)));
}); });
test('on-axis MaterialRectArcTween', () { test('on-axis MaterialRectArcTween', () {
......
...@@ -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(new ValueKey<String>('two'))).toList(); 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);
...@@ -254,7 +254,7 @@ void main() { ...@@ -254,7 +254,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 vertical center as the button. // have the same vertical center as the button.
List<RenderBox> itemBoxes = tester.renderObjectList(find.byKey(new ValueKey<String>('two'))).toList(); 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'
......
...@@ -22,7 +22,7 @@ void main() { ...@@ -22,7 +22,7 @@ void main() {
headerBuilder: (BuildContext context, bool isExpanded) { headerBuilder: (BuildContext context, bool isExpanded) {
return new Text(isExpanded ? 'B' : 'A'); return new Text(isExpanded ? 'B' : 'A');
}, },
body: new SizedBox(height: 100.0) body: const SizedBox(height: 100.0)
) )
] ]
) )
...@@ -53,7 +53,7 @@ void main() { ...@@ -53,7 +53,7 @@ void main() {
headerBuilder: (BuildContext context, bool isExpanded) { headerBuilder: (BuildContext context, bool isExpanded) {
return new Text(isExpanded ? 'B' : 'A'); return new Text(isExpanded ? 'B' : 'A');
}, },
body: new SizedBox(height: 100.0), body: const SizedBox(height: 100.0),
isExpanded: true // this is the addition isExpanded: true // this is the addition
) )
] ]
......
...@@ -11,7 +11,7 @@ void main() { ...@@ -11,7 +11,7 @@ void main() {
testWidgets('Icon sizing - no theme, default size', (WidgetTester tester) async { testWidgets('Icon sizing - no theme, default size', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new Icon(null) child: const Icon(null)
) )
); );
...@@ -22,7 +22,7 @@ void main() { ...@@ -22,7 +22,7 @@ void main() {
testWidgets('Icon sizing - no theme, explicit size', (WidgetTester tester) async { testWidgets('Icon sizing - no theme, explicit size', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new Icon( child: const Icon(
null, null,
size: 96.0 size: 96.0
) )
...@@ -37,8 +37,8 @@ void main() { ...@@ -37,8 +37,8 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new IconTheme( child: new IconTheme(
data: new IconThemeData(size: 36.0), data: const IconThemeData(size: 36.0),
child: new Icon(null) child: const Icon(null)
) )
) )
); );
...@@ -51,8 +51,8 @@ void main() { ...@@ -51,8 +51,8 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new IconTheme( child: new IconTheme(
data: new IconThemeData(size: 36.0), data: const IconThemeData(size: 36.0),
child: new Icon( child: const Icon(
null, null,
size: 48.0 size: 48.0
) )
...@@ -68,8 +68,8 @@ void main() { ...@@ -68,8 +68,8 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new IconTheme( child: new IconTheme(
data: new IconThemeData(), data: const IconThemeData(),
child: new Icon(null) child: const Icon(null)
) )
) )
); );
......
...@@ -11,7 +11,7 @@ void main() { ...@@ -11,7 +11,7 @@ void main() {
testWidgets('ImageIcon sizing - no theme, default size', (WidgetTester tester) async { testWidgets('ImageIcon sizing - no theme, default size', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new ImageIcon(null) child: const ImageIcon(null)
) )
); );
...@@ -22,7 +22,7 @@ void main() { ...@@ -22,7 +22,7 @@ void main() {
testWidgets('ImageIcon sizing - no theme, explicit size', (WidgetTester tester) async { testWidgets('ImageIcon sizing - no theme, explicit size', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new ImageIcon( child: const ImageIcon(
null, null,
size: 96.0 size: 96.0
) )
...@@ -37,8 +37,8 @@ void main() { ...@@ -37,8 +37,8 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new IconTheme( child: new IconTheme(
data: new IconThemeData(size: 36.0), data: const IconThemeData(size: 36.0),
child: new ImageIcon(null) child: const ImageIcon(null)
) )
) )
); );
...@@ -51,8 +51,8 @@ void main() { ...@@ -51,8 +51,8 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new IconTheme( child: new IconTheme(
data: new IconThemeData(size: 36.0), data: const IconThemeData(size: 36.0),
child: new ImageIcon( child: const ImageIcon(
null, null,
size: 48.0 size: 48.0
) )
...@@ -68,8 +68,8 @@ void main() { ...@@ -68,8 +68,8 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new IconTheme( child: new IconTheme(
data: new IconThemeData(), data: const IconThemeData(),
child: new ImageIcon(null) child: const ImageIcon(null)
) )
) )
); );
......
...@@ -15,10 +15,10 @@ void main() { ...@@ -15,10 +15,10 @@ void main() {
)); ));
RenderBox bodyBox = tester.renderObject(find.byKey(bodyKey)); RenderBox bodyBox = tester.renderObject(find.byKey(bodyKey));
expect(bodyBox.size, equals(new Size(800.0, 544.0))); expect(bodyBox.size, equals(const Size(800.0, 544.0)));
await tester.pumpWidget(new MediaQuery( await tester.pumpWidget(new MediaQuery(
data: new MediaQueryData(padding: new EdgeInsets.only(bottom: 100.0)), data: const MediaQueryData(padding: const EdgeInsets.only(bottom: 100.0)),
child: new Scaffold( child: 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)
...@@ -26,10 +26,10 @@ void main() { ...@@ -26,10 +26,10 @@ void main() {
)); ));
bodyBox = tester.renderObject(find.byKey(bodyKey)); bodyBox = tester.renderObject(find.byKey(bodyKey));
expect(bodyBox.size, equals(new Size(800.0, 444.0))); expect(bodyBox.size, equals(const Size(800.0, 444.0)));
await tester.pumpWidget(new MediaQuery( await tester.pumpWidget(new MediaQuery(
data: new MediaQueryData(padding: new EdgeInsets.only(bottom: 100.0)), data: const MediaQueryData(padding: const EdgeInsets.only(bottom: 100.0)),
child: new Scaffold( child: 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),
...@@ -38,7 +38,7 @@ void main() { ...@@ -38,7 +38,7 @@ void main() {
)); ));
bodyBox = tester.renderObject(find.byKey(bodyKey)); bodyBox = tester.renderObject(find.byKey(bodyKey));
expect(bodyBox.size, equals(new Size(800.0, 544.0))); expect(bodyBox.size, equals(const Size(800.0, 544.0)));
}); });
testWidgets('Floating action animation', (WidgetTester tester) async { testWidgets('Floating action animation', (WidgetTester tester) async {
...@@ -137,7 +137,7 @@ void main() { ...@@ -137,7 +137,7 @@ void main() {
new MaterialApp( new MaterialApp(
theme: new ThemeData(platform: TargetPlatform.iOS), theme: new ThemeData(platform: TargetPlatform.iOS),
home: new MediaQuery( home: new MediaQuery(
data: new MediaQueryData(padding: const EdgeInsets.only(top: 25.0)), // status bar data: const MediaQueryData(padding: const EdgeInsets.only(top: 25.0)), // status bar
child: new Scaffold( child: new Scaffold(
scrollableKey: scrollableKey, scrollableKey: scrollableKey,
appBar: new AppBar( appBar: new AppBar(
...@@ -159,7 +159,7 @@ void main() { ...@@ -159,7 +159,7 @@ void main() {
expect(scrollableKey.currentState.scrollOffset, equals(500.0)); expect(scrollableKey.currentState.scrollOffset, equals(500.0));
await tester.tapAt(const Point(100.0, 10.0)); await tester.tapAt(const Point(100.0, 10.0));
await tester.pump(); await tester.pump();
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(scrollableKey.currentState.scrollOffset, equals(0.0)); expect(scrollableKey.currentState.scrollOffset, equals(0.0));
}); });
...@@ -171,7 +171,7 @@ void main() { ...@@ -171,7 +171,7 @@ void main() {
new MaterialApp( new MaterialApp(
theme: new ThemeData(platform: TargetPlatform.android), theme: new ThemeData(platform: TargetPlatform.android),
home: new MediaQuery( home: new MediaQuery(
data: new MediaQueryData(padding: const EdgeInsets.only(top: 25.0)), // status bar data: const MediaQueryData(padding: const EdgeInsets.only(top: 25.0)), // status bar
child: new Scaffold( child: new Scaffold(
scrollableKey: scrollableKey, scrollableKey: scrollableKey,
appBar: new AppBar( appBar: new AppBar(
...@@ -193,7 +193,7 @@ void main() { ...@@ -193,7 +193,7 @@ void main() {
expect(scrollableKey.currentState.scrollOffset, equals(500.0)); expect(scrollableKey.currentState.scrollOffset, equals(500.0));
await tester.tapAt(const Point(100.0, 10.0)); await tester.tapAt(const Point(100.0, 10.0));
await tester.pump(); await tester.pump();
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(scrollableKey.currentState.scrollOffset, equals(500.0)); expect(scrollableKey.currentState.scrollOffset, equals(500.0));
}); });
......
...@@ -18,14 +18,14 @@ void main() { ...@@ -18,14 +18,14 @@ void main() {
steps: <Step>[ steps: <Step>[
new Step( new Step(
title: new Text('Step 1'), title: new Text('Step 1'),
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
), ),
new Step( new Step(
title: new Text('Step 2'), title: new Text('Step 2'),
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
...@@ -47,14 +47,14 @@ void main() { ...@@ -47,14 +47,14 @@ void main() {
steps: <Step>[ steps: <Step>[
new Step( new Step(
title: new Text('Step 1'), title: new Text('Step 1'),
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
), ),
new Step( new Step(
title: new Text('Step 2'), title: new Text('Step 2'),
content: new SizedBox( content: const SizedBox(
width: 200.0, width: 200.0,
height: 200.0 height: 200.0
) )
...@@ -76,14 +76,14 @@ void main() { ...@@ -76,14 +76,14 @@ void main() {
steps: <Step>[ steps: <Step>[
new Step( new Step(
title: new Text('Step 1'), title: new Text('Step 1'),
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
), ),
new Step( new Step(
title: new Text('Step 2'), title: new Text('Step 2'),
content: new SizedBox( content: const SizedBox(
width: 200.0, width: 200.0,
height: 200.0 height: 200.0
) )
...@@ -111,7 +111,7 @@ void main() { ...@@ -111,7 +111,7 @@ void main() {
steps: <Step>[ steps: <Step>[
new Step( new Step(
title: new Text('Step 1'), title: new Text('Step 1'),
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
...@@ -188,14 +188,14 @@ void main() { ...@@ -188,14 +188,14 @@ void main() {
steps: <Step>[ steps: <Step>[
new Step( new Step(
title: new Text('Step 1'), title: new Text('Step 1'),
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
), ),
new Step( new Step(
title: new Text('Step 2'), title: new Text('Step 2'),
content: new SizedBox( content: const SizedBox(
width: 200.0, width: 200.0,
height: 200.0 height: 200.0
) )
...@@ -224,7 +224,7 @@ void main() { ...@@ -224,7 +224,7 @@ void main() {
steps: <Step>[ steps: <Step>[
new Step( new Step(
title: new Text('Step 1'), title: new Text('Step 1'),
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
...@@ -232,7 +232,7 @@ void main() { ...@@ -232,7 +232,7 @@ void main() {
new Step( new Step(
title: new Text('Step 2'), title: new Text('Step 2'),
state: StepState.disabled, state: StepState.disabled,
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
...@@ -253,21 +253,21 @@ void main() { ...@@ -253,21 +253,21 @@ void main() {
steps: <Step>[ steps: <Step>[
new Step( new Step(
title: new Text('Step 1'), title: new Text('Step 1'),
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 300.0 height: 300.0
) )
), ),
new Step( new Step(
title: new Text('Step 2'), title: new Text('Step 2'),
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 300.0 height: 300.0
) )
), ),
new Step( new Step(
title: new Text('Step 3'), title: new Text('Step 3'),
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
...@@ -288,21 +288,21 @@ void main() { ...@@ -288,21 +288,21 @@ void main() {
steps: <Step>[ steps: <Step>[
new Step( new Step(
title: new Text('Step 1'), title: new Text('Step 1'),
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 300.0 height: 300.0
) )
), ),
new Step( new Step(
title: new Text('Step 2'), title: new Text('Step 2'),
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 300.0 height: 300.0
) )
), ),
new Step( new Step(
title: new Text('Step 3'), title: new Text('Step 3'),
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
...@@ -312,7 +312,7 @@ void main() { ...@@ -312,7 +312,7 @@ void main() {
) )
); );
await tester.pump(new Duration(milliseconds: 100)); await tester.pump(const Duration(milliseconds: 100));
expect(scrollableState.scrollOffset, greaterThan(0.0)); expect(scrollableState.scrollOffset, greaterThan(0.0));
}); });
...@@ -325,14 +325,14 @@ void main() { ...@@ -325,14 +325,14 @@ void main() {
new Step( new Step(
title: new Text('A'), title: new Text('A'),
state: StepState.complete, state: StepState.complete,
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
), ),
new Step( new Step(
title: new Text('B'), title: new Text('B'),
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
...@@ -356,7 +356,7 @@ void main() { ...@@ -356,7 +356,7 @@ void main() {
new Step( new Step(
title: new Text('A'), title: new Text('A'),
state: StepState.error, state: StepState.error,
content: new SizedBox( content: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
......
...@@ -211,7 +211,7 @@ void main() { ...@@ -211,7 +211,7 @@ void main() {
await tester.pumpWidget(builder()); await tester.pumpWidget(builder());
TestGesture gesture = await tester.startGesture(tester.getCenter(find.text(tabs[0]))); TestGesture gesture = await tester.startGesture(tester.getCenter(find.text(tabs[0])));
await gesture.moveBy(new Offset(-600.0, 0.0)); await gesture.moveBy(const Offset(-600.0, 0.0));
await tester.pump(); await tester.pump();
expect(value, equals(tabs[0])); expect(value, equals(tabs[0]));
findStateMarkerState(tabs[1]).marker = 'marked'; findStateMarkerState(tabs[1]).marker = 'marked';
...@@ -225,7 +225,7 @@ void main() { ...@@ -225,7 +225,7 @@ void main() {
// Move to the third tab. // Move to the third tab.
gesture = await tester.startGesture(tester.getCenter(find.text(tabs[1]))); gesture = await tester.startGesture(tester.getCenter(find.text(tabs[1])));
await gesture.moveBy(new Offset(-600.0, 0.0)); await gesture.moveBy(const Offset(-600.0, 0.0));
await gesture.up(); await gesture.up();
await tester.pump(); await tester.pump();
expect(findStateMarkerState(tabs[1]).marker, equals('marked')); expect(findStateMarkerState(tabs[1]).marker, equals('marked'));
...@@ -240,7 +240,7 @@ void main() { ...@@ -240,7 +240,7 @@ void main() {
// Move back to the second tab. // Move back to the second tab.
gesture = await tester.startGesture(tester.getCenter(find.text(tabs[2]))); gesture = await tester.startGesture(tester.getCenter(find.text(tabs[2])));
await gesture.moveBy(new Offset(600.0, 0.0)); await gesture.moveBy(const Offset(600.0, 0.0));
await tester.pump(); await tester.pump();
StateMarkerState markerState = findStateMarkerState(tabs[1]); StateMarkerState markerState = findStateMarkerState(tabs[1]);
expect(markerState.marker, isNull); expect(markerState.marker, isNull);
...@@ -267,7 +267,7 @@ void main() { ...@@ -267,7 +267,7 @@ void main() {
// Fling to the left, switch from the 'LEFT' tab to the 'RIGHT' // Fling to the left, switch from the 'LEFT' tab to the 'RIGHT'
Point flingStart = tester.getCenter(find.text('LEFT CHILD')); Point flingStart = tester.getCenter(find.text('LEFT CHILD'));
await tester.flingFrom(flingStart, new Offset(-200.0, 0.0), 10000.0); await tester.flingFrom(flingStart, const Offset(-200.0, 0.0), 10000.0);
await tester.pump(); await tester.pump();
await tester.pump(const Duration(seconds: 1)); // finish the scroll animation await tester.pump(const Duration(seconds: 1)); // finish the scroll animation
expect(selection.value, equals('RIGHT')); expect(selection.value, equals('RIGHT'));
...@@ -276,7 +276,7 @@ void main() { ...@@ -276,7 +276,7 @@ void main() {
// Fling to the right, switch back to the 'LEFT' tab // Fling to the right, switch back to the 'LEFT' tab
flingStart = tester.getCenter(find.text('RIGHT CHILD')); flingStart = tester.getCenter(find.text('RIGHT CHILD'));
await tester.flingFrom(flingStart, new Offset(200.0, 0.0), 10000.0); await tester.flingFrom(flingStart, const Offset(200.0, 0.0), 10000.0);
await tester.pump(); await tester.pump();
await tester.pump(const Duration(seconds: 1)); // finish the scroll animation await tester.pump(const Duration(seconds: 1)); // finish the scroll animation
expect(selection.value, equals('LEFT')); expect(selection.value, equals('LEFT'));
...@@ -301,7 +301,7 @@ void main() { ...@@ -301,7 +301,7 @@ void main() {
// a change to the selected tab, everything should just settle back to // a change to the selected tab, everything should just settle back to
// to where it started. // to where it started.
Point flingStart = tester.getCenter(find.text('LEFT CHILD')); Point flingStart = tester.getCenter(find.text('LEFT CHILD'));
await tester.flingFrom(flingStart, new Offset(-200.0, 0.0), -10000.0); await tester.flingFrom(flingStart, const Offset(-200.0, 0.0), -10000.0);
await tester.pump(); await tester.pump();
await tester.pump(const Duration(seconds: 1)); // finish the scroll animation await tester.pump(const Duration(seconds: 1)); // finish the scroll animation
expect(selection.value, equals('LEFT')); expect(selection.value, equals('LEFT'));
...@@ -342,7 +342,7 @@ void main() { ...@@ -342,7 +342,7 @@ void main() {
); );
// After a small slow fling to the left, we expect the second item to still be visible. // After a small slow fling to the left, we expect the second item to still be visible.
await tester.fling(find.text('AAAAAA'), new Offset(-25.0, 0.0), 100.0); await tester.fling(find.text('AAAAAA'), const Offset(-25.0, 0.0), 100.0);
await tester.pump(); await tester.pump();
await tester.pump(const Duration(seconds: 1)); // finish the scroll animation await tester.pump(const Duration(seconds: 1)); // finish the scroll animation
final RenderBox box = tester.renderObject(find.text('BBBBBB')); final RenderBox box = tester.renderObject(find.text('BBBBBB'));
......
...@@ -200,7 +200,7 @@ void main() { ...@@ -200,7 +200,7 @@ void main() {
showDialog( showDialog(
context: context, context: context,
child: new Scaffold( child: new Scaffold(
body: new SizedBox( body: const SizedBox(
width: 200.0, width: 200.0,
height: 200.0, height: 200.0,
), ),
......
...@@ -7,7 +7,7 @@ import 'package:flutter/painting.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter/painting.dart';
void main() { void main() {
test("BorderSide control test", () { test("BorderSide control test", () {
BorderSide side1 = new BorderSide(); BorderSide side1 = const BorderSide();
BorderSide side2 = side1.copyWith( BorderSide side2 = side1.copyWith(
color: const Color(0xFF00FFFF), color: const Color(0xFF00FFFF),
width: 2.0, width: 2.0,
...@@ -55,13 +55,13 @@ void main() { ...@@ -55,13 +55,13 @@ void main() {
}); });
test("BoxShadow control test", () { test("BoxShadow control test", () {
BoxShadow shadow1 = new BoxShadow(blurRadius: 4.0); BoxShadow shadow1 = const BoxShadow(blurRadius: 4.0);
BoxShadow shadow2 = BoxShadow.lerp(null, shadow1, 0.25); BoxShadow shadow2 = BoxShadow.lerp(null, shadow1, 0.25);
BoxShadow shadow3 = BoxShadow.lerp(shadow1, null, 0.25); 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)));
expect(shadow1, equals(new BoxShadow(blurRadius: 4.0))); expect(shadow1, equals(const BoxShadow(blurRadius: 4.0)));
expect(shadow2.blurRadius, equals(1.0)); expect(shadow2.blurRadius, equals(1.0));
expect(shadow3.blurRadius, equals(3.0)); expect(shadow3.blurRadius, equals(3.0));
......
...@@ -47,8 +47,8 @@ class AsyncTestImageProvider extends ImageProvider<int> { ...@@ -47,8 +47,8 @@ class AsyncTestImageProvider extends ImageProvider<int> {
void main() { void main() {
test("Decoration.lerp()", () { test("Decoration.lerp()", () {
BoxDecoration a = new BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)); BoxDecoration a = const BoxDecoration(backgroundColor: const Color(0xFFFFFFFF));
BoxDecoration b = new BoxDecoration(backgroundColor: const Color(0x00000000)); 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));
...@@ -71,7 +71,7 @@ void main() { ...@@ -71,7 +71,7 @@ void main() {
}); });
TestCanvas canvas = new TestCanvas(); TestCanvas canvas = new TestCanvas();
ImageConfiguration imageConfiguration = new ImageConfiguration(size: Size.zero); 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
...@@ -90,7 +90,7 @@ void main() { ...@@ -90,7 +90,7 @@ void main() {
}); });
TestCanvas canvas = new TestCanvas(); TestCanvas canvas = new TestCanvas();
ImageConfiguration imageConfiguration = new ImageConfiguration(size: Size.zero); 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.
......
...@@ -8,8 +8,8 @@ import 'package:test/test.dart'; ...@@ -8,8 +8,8 @@ import 'package:test/test.dart';
void main() { void main() {
test("EdgeInsets.lerp()", () { test("EdgeInsets.lerp()", () {
EdgeInsets a = new EdgeInsets.all(10.0); EdgeInsets a = const EdgeInsets.all(10.0);
EdgeInsets b = new EdgeInsets.all(20.0); 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)));
......
...@@ -39,7 +39,7 @@ void main() { ...@@ -39,7 +39,7 @@ void main() {
rect: new Rect.fromLTWH(50.0, 75.0, 200.0, 100.0), rect: new Rect.fromLTWH(50.0, 75.0, 200.0, 100.0),
image: image, image: image,
fit: ImageFit.cover, fit: ImageFit.cover,
alignment: new FractionalOffset(0.0, 0.5) alignment: const FractionalOffset(0.0, 0.5)
); );
Invocation command = canvas.invocations.firstWhere((Invocation invocation) { Invocation command = canvas.invocations.firstWhere((Invocation invocation) {
......
...@@ -8,12 +8,12 @@ import 'package:test/test.dart'; ...@@ -8,12 +8,12 @@ import 'package:test/test.dart';
void main() { void main() {
test('TextSpan equals', () { test('TextSpan equals', () {
TextSpan a1 = new TextSpan(text: 'a'); TextSpan a1 = new TextSpan(text: 'a'); // ignore: prefer_const_constructor
TextSpan a2 = new TextSpan(text: 'a'); TextSpan a2 = new TextSpan(text: 'a'); // ignore: prefer_const_constructor
TextSpan b1 = new TextSpan(children: <TextSpan>[ a1 ]); TextSpan b1 = new TextSpan(children: <TextSpan>[ a1 ]);
TextSpan b2 = new TextSpan(children: <TextSpan>[ a2 ]); TextSpan b2 = new TextSpan(children: <TextSpan>[ a2 ]);
TextSpan c1 = new TextSpan(); TextSpan c1 = new TextSpan(); // ignore: prefer_const_constructor
TextSpan c2 = new TextSpan(); TextSpan c2 = new TextSpan(); // ignore: prefer_const_constructor
expect(a1 == a2, isTrue); expect(a1 == a2, isTrue);
expect(b1 == b2, isTrue); expect(b1 == b2, isTrue);
...@@ -29,20 +29,20 @@ void main() { ...@@ -29,20 +29,20 @@ void main() {
}); });
test('TextSpan', () { test('TextSpan', () {
final TextSpan test = new TextSpan( final TextSpan test = const TextSpan(
text: 'a', text: 'a',
style: new TextStyle( style: const TextStyle(
fontSize: 10.0 fontSize: 10.0
), ),
children: <TextSpan>[ children: const <TextSpan>[
new TextSpan( const TextSpan(
text: 'b', text: 'b',
children: <TextSpan>[ children: const <TextSpan>[
new TextSpan() const TextSpan()
] ]
), ),
null, null,
new TextSpan( const TextSpan(
text: 'c' text: 'c'
), ),
] ]
......
...@@ -119,7 +119,7 @@ void main() { ...@@ -119,7 +119,7 @@ void main() {
// 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( SpringSimulation other = new SpringSimulation(
new 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);
}); });
...@@ -261,7 +261,7 @@ void main() { ...@@ -261,7 +261,7 @@ void main() {
spring: spring, spring: spring,
drag: 0.025, drag: 0.025,
); );
scroll.tolerance = new Tolerance(velocity: 45.0, distance: 1.5); scroll.tolerance = const Tolerance(velocity: 45.0, distance: 1.5);
expect(scroll.isDone(0.0), false); expect(scroll.isDone(0.0), false);
expect(scroll.x(0.0), closeTo(500.0, .0001)); expect(scroll.x(0.0), closeTo(500.0, .0001));
......
...@@ -17,7 +17,7 @@ void main() { ...@@ -17,7 +17,7 @@ void main() {
child: parent = new RenderBaseline( child: parent = new RenderBaseline(
baseline: 0.0, baseline: 0.0,
baselineType: TextBaseline.alphabetic, baselineType: TextBaseline.alphabetic,
child: child = new RenderSizedBox(new Size(100.0, 100.0)) child: child = new RenderSizedBox(const Size(100.0, 100.0))
) )
); );
BoxParentData childParentData = child.parentData; BoxParentData childParentData = child.parentData;
...@@ -25,30 +25,30 @@ void main() { ...@@ -25,30 +25,30 @@ void main() {
layout(root, phase: EnginePhase.layout); layout(root, phase: EnginePhase.layout);
expect(childParentData.offset.dx, equals(0.0)); expect(childParentData.offset.dx, equals(0.0));
expect(childParentData.offset.dy, equals(-100.0)); expect(childParentData.offset.dy, equals(-100.0));
expect(parent.size, equals(new Size(100.0, 0.0))); expect(parent.size, equals(const Size(100.0, 0.0)));
parent.baseline = 25.0; parent.baseline = 25.0;
pumpFrame(phase: EnginePhase.layout); pumpFrame(phase: EnginePhase.layout);
expect(childParentData.offset.dx, equals(0.0)); expect(childParentData.offset.dx, equals(0.0));
expect(childParentData.offset.dy, equals(-75.0)); expect(childParentData.offset.dy, equals(-75.0));
expect(parent.size, equals(new Size(100.0, 25.0))); expect(parent.size, equals(const Size(100.0, 25.0)));
parent.baseline = 90.0; parent.baseline = 90.0;
pumpFrame(phase: EnginePhase.layout); pumpFrame(phase: EnginePhase.layout);
expect(childParentData.offset.dx, equals(0.0)); expect(childParentData.offset.dx, equals(0.0));
expect(childParentData.offset.dy, equals(-10.0)); expect(childParentData.offset.dy, equals(-10.0));
expect(parent.size, equals(new Size(100.0, 90.0))); expect(parent.size, equals(const Size(100.0, 90.0)));
parent.baseline = 100.0; parent.baseline = 100.0;
pumpFrame(phase: EnginePhase.layout); pumpFrame(phase: EnginePhase.layout);
expect(childParentData.offset.dx, equals(0.0)); expect(childParentData.offset.dx, equals(0.0));
expect(childParentData.offset.dy, equals(0.0)); expect(childParentData.offset.dy, equals(0.0));
expect(parent.size, equals(new Size(100.0, 100.0))); expect(parent.size, equals(const Size(100.0, 100.0)));
parent.baseline = 110.0; parent.baseline = 110.0;
pumpFrame(phase: EnginePhase.layout); pumpFrame(phase: EnginePhase.layout);
expect(childParentData.offset.dx, equals(0.0)); expect(childParentData.offset.dx, equals(0.0));
expect(childParentData.offset.dy, equals(10.0)); expect(childParentData.offset.dy, equals(10.0));
expect(parent.size, equals(new Size(100.0, 110.0))); expect(parent.size, equals(const Size(100.0, 110.0)));
}); });
} }
...@@ -8,12 +8,12 @@ import 'package:test/test.dart'; ...@@ -8,12 +8,12 @@ import 'package:test/test.dart';
void main() { void main() {
test('BoxConstraints toString', () { test('BoxConstraints toString', () {
expect(const BoxConstraints.expand().toString(), contains('biggest')); expect(const BoxConstraints.expand().toString(), contains('biggest'));
expect(new BoxConstraints().toString(), contains('unconstrained')); expect(const BoxConstraints().toString(), contains('unconstrained'));
expect(new BoxConstraints.tightFor(width: 50.0).toString(), contains('w=50')); expect(const BoxConstraints.tightFor(width: 50.0).toString(), contains('w=50'));
}); });
test('BoxConstraints copyWith', () { test('BoxConstraints copyWith', () {
BoxConstraints constraints = new BoxConstraints( 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 = new BoxConstraints( 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 = new BoxConstraints( BoxConstraints constraints = const BoxConstraints(
minWidth: 3.0, minWidth: 3.0,
maxWidth: 7.0, maxWidth: 7.0,
minHeight: 11.0, minHeight: 11.0,
...@@ -78,7 +78,7 @@ void main() { ...@@ -78,7 +78,7 @@ void main() {
expect(copy.maxWidth, 3.5); expect(copy.maxWidth, 3.5);
expect(copy.minHeight, 5.5); expect(copy.minHeight, 5.5);
expect(copy.maxHeight, 8.5); expect(copy.maxHeight, 8.5);
copy = BoxConstraints.lerp(new BoxConstraints( copy = BoxConstraints.lerp(const BoxConstraints(
minWidth: 13.0, minWidth: 13.0,
maxWidth: 17.0, maxWidth: 17.0,
minHeight: 111.0, minHeight: 111.0,
...@@ -91,7 +91,7 @@ void main() { ...@@ -91,7 +91,7 @@ void main() {
}); });
test('BoxConstraints normalize', () { test('BoxConstraints normalize', () {
BoxConstraints constraints = new BoxConstraints( BoxConstraints constraints = const BoxConstraints(
minWidth: 3.0, minWidth: 3.0,
maxWidth: 2.0, maxWidth: 2.0,
minHeight: 11.0, minHeight: 11.0,
......
...@@ -27,16 +27,16 @@ void main() { ...@@ -27,16 +27,16 @@ void main() {
test('Flex and padding', () { test('Flex and padding', () {
RenderBox size = new RenderConstrainedBox( RenderBox size = new RenderConstrainedBox(
additionalConstraints: new BoxConstraints().tighten(height: 100.0), additionalConstraints: const BoxConstraints().tighten(height: 100.0),
); );
RenderBox inner = new RenderDecoratedBox( RenderBox inner = new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFF00FF00), backgroundColor: const Color(0xFF00FF00),
), ),
child: size, child: size,
); );
RenderBox padding = new RenderPadding( RenderBox padding = new RenderPadding(
padding: new EdgeInsets.all(50.0), padding: const EdgeInsets.all(50.0),
child: inner, child: inner,
); );
RenderBox flex = new RenderFlex( RenderBox flex = new RenderFlex(
...@@ -45,7 +45,7 @@ void main() { ...@@ -45,7 +45,7 @@ void main() {
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
); );
RenderBox outer = new RenderDecoratedBox( RenderBox outer = new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFF0000FF) backgroundColor: const Color(0xFF0000FF)
), ),
child: flex, child: flex,
...@@ -67,14 +67,14 @@ void main() { ...@@ -67,14 +67,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( RenderBox coloredBox = new RenderDecoratedBox(
decoration: new BoxDecoration(), decoration: const BoxDecoration(),
); );
RenderBox paddingBox = new RenderPadding( RenderBox paddingBox = new RenderPadding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: coloredBox, child: coloredBox,
); );
RenderBox root = new RenderDecoratedBox( RenderBox root = new RenderDecoratedBox(
decoration: new BoxDecoration(), decoration: const BoxDecoration(),
child: paddingBox, child: paddingBox,
); );
layout(root); layout(root);
...@@ -84,7 +84,7 @@ void main() { ...@@ -84,7 +84,7 @@ void main() {
test("reparenting should clear position", () { test("reparenting should clear position", () {
RenderDecoratedBox coloredBox = new RenderDecoratedBox( RenderDecoratedBox coloredBox = new RenderDecoratedBox(
decoration: new BoxDecoration(), decoration: const BoxDecoration(),
); );
RenderPadding paddedBox = new RenderPadding( RenderPadding paddedBox = new RenderPadding(
......
...@@ -66,7 +66,7 @@ void main() { ...@@ -66,7 +66,7 @@ void main() {
child: inner = new RenderFixedSize() child: inner = new RenderFixedSize()
) )
), ),
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 0.0, minWidth: 0.0,
minHeight: 0.0, minHeight: 0.0,
maxWidth: 1000.0, maxWidth: 1000.0,
......
...@@ -9,7 +9,7 @@ import 'rendering_tester.dart'; ...@@ -9,7 +9,7 @@ import 'rendering_tester.dart';
void main() { void main() {
test('Overconstrained flex', () { test('Overconstrained flex', () {
RenderDecoratedBox box = new RenderDecoratedBox(decoration: new BoxDecoration()); RenderDecoratedBox box = new RenderDecoratedBox(decoration: const BoxDecoration());
RenderFlex flex = new RenderFlex(children: <RenderBox>[box]); 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)
...@@ -26,13 +26,13 @@ void main() { ...@@ -26,13 +26,13 @@ void main() {
RenderFlex flex = new RenderFlex( RenderFlex flex = new RenderFlex(
direction: Axis.vertical, direction: Axis.vertical,
children: <RenderBox>[ children: <RenderBox>[
new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(height: 200.0)), new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(height: 200.0)),
flexible, flexible,
] ]
); );
FlexParentData flexParentData = flexible.parentData; FlexParentData flexParentData = flexible.parentData;
flexParentData.flex = 1; flexParentData.flex = 1;
BoxConstraints viewport = new BoxConstraints(maxHeight: 100.0, maxWidth: 100.0); 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));
...@@ -48,13 +48,13 @@ void main() { ...@@ -48,13 +48,13 @@ void main() {
RenderFlex flex = new RenderFlex( RenderFlex flex = new RenderFlex(
direction: Axis.horizontal, direction: Axis.horizontal,
children: <RenderBox>[ children: <RenderBox>[
new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 200.0)), new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 200.0)),
flexible, flexible,
] ]
); );
FlexParentData flexParentData = flexible.parentData; FlexParentData flexParentData = flexible.parentData;
flexParentData.flex = 1; flexParentData.flex = 1;
BoxConstraints viewport = new BoxConstraints(maxHeight: 100.0, maxWidth: 100.0); 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));
...@@ -70,7 +70,7 @@ void main() { ...@@ -70,7 +70,7 @@ void main() {
new RenderAspectRatio(aspectRatio: 1.0), new RenderAspectRatio(aspectRatio: 1.0),
] ]
); );
BoxConstraints viewport = new BoxConstraints(maxHeight: 200.0, maxWidth: 1000.0); 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));
}); });
...@@ -85,8 +85,8 @@ void main() { ...@@ -85,8 +85,8 @@ void main() {
}); });
test('Parent data', () { test('Parent data', () {
RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: new BoxDecoration()); RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: const BoxDecoration());
RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: new BoxDecoration()); RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: const BoxDecoration());
RenderFlex flex = new RenderFlex(children: <RenderBox>[box1, box2]); 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,8 +107,8 @@ void main() { ...@@ -107,8 +107,8 @@ void main() {
}); });
test('Stretch', () { test('Stretch', () {
RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: new BoxDecoration()); RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: const BoxDecoration());
RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: new BoxDecoration()); RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: const BoxDecoration());
RenderFlex flex = new RenderFlex(); RenderFlex flex = new RenderFlex();
flex.setupParentData(box2); flex.setupParentData(box2);
final FlexParentData box2ParentData = box2.parentData; final FlexParentData box2ParentData = box2.parentData;
...@@ -138,9 +138,9 @@ void main() { ...@@ -138,9 +138,9 @@ void main() {
}); });
test('Space evenly', () { test('Space evenly', () {
RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderFlex flex = new RenderFlex(mainAxisAlignment: MainAxisAlignment.spaceEvenly); 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(
...@@ -168,9 +168,9 @@ void main() { ...@@ -168,9 +168,9 @@ void main() {
}); });
test('Fit.loose', () { test('Fit.loose', () {
RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderFlex flex = new RenderFlex(mainAxisAlignment: MainAxisAlignment.spaceBetween); 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(
...@@ -204,7 +204,7 @@ void main() { ...@@ -204,7 +204,7 @@ void main() {
expect(getOffset(box3).dx, equals(400.0)); expect(getOffset(box3).dx, equals(400.0));
expect(box3.size.width, equals(100.0)); expect(box3.size.width, equals(100.0));
box1.additionalConstraints = new BoxConstraints.tightFor(width: 1000.0, height: 100.0); box1.additionalConstraints = const BoxConstraints.tightFor(width: 1000.0, height: 100.0);
pumpFrame(); pumpFrame();
expect(getOffset(box1).dx, equals(0.0)); expect(getOffset(box1).dx, equals(0.0));
...@@ -216,9 +216,9 @@ void main() { ...@@ -216,9 +216,9 @@ void main() {
}); });
test('Flexible with MainAxisSize.min', () { test('Flexible with MainAxisSize.min', () {
RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); RenderConstrainedBox box3 = new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 100.0, height: 100.0));
RenderFlex flex = new RenderFlex( RenderFlex flex = new RenderFlex(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween mainAxisAlignment: MainAxisAlignment.spaceBetween
......
...@@ -10,10 +10,10 @@ import 'rendering_tester.dart'; ...@@ -10,10 +10,10 @@ import 'rendering_tester.dart';
void main() { void main() {
test('Basic grid layout test', () { test('Basic grid layout test', () {
List<RenderBox> children = <RenderBox>[ List<RenderBox> children = <RenderBox>[
new RenderDecoratedBox(decoration: new BoxDecoration()), new RenderDecoratedBox(decoration: const BoxDecoration()),
new RenderDecoratedBox(decoration: new BoxDecoration()), new RenderDecoratedBox(decoration: const BoxDecoration()),
new RenderDecoratedBox(decoration: new BoxDecoration()), new RenderDecoratedBox(decoration: const BoxDecoration()),
new RenderDecoratedBox(decoration: new BoxDecoration()) new RenderDecoratedBox(decoration: const BoxDecoration())
]; ];
RenderGrid grid = new RenderGrid( RenderGrid grid = new RenderGrid(
......
...@@ -48,7 +48,7 @@ void main() { ...@@ -48,7 +48,7 @@ void main() {
image = new RenderImage(image: new SquareImage()); image = new RenderImage(image: new SquareImage());
layout(image, layout(image,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 25.0, minWidth: 25.0,
minHeight: 25.0, minHeight: 25.0,
maxWidth: 100.0, maxWidth: 100.0,
...@@ -58,7 +58,7 @@ void main() { ...@@ -58,7 +58,7 @@ void main() {
image = new RenderImage(image: new WideImage()); image = new RenderImage(image: new WideImage());
layout(image, layout(image,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
minHeight: 30.0, minHeight: 30.0,
maxWidth: 100.0, maxWidth: 100.0,
...@@ -68,7 +68,7 @@ void main() { ...@@ -68,7 +68,7 @@ void main() {
image = new RenderImage(image: new TallImage()); image = new RenderImage(image: new TallImage());
layout(image, layout(image,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 50.0, minWidth: 50.0,
minHeight: 5.0, minHeight: 5.0,
maxWidth: 75.0, maxWidth: 75.0,
...@@ -78,7 +78,7 @@ void main() { ...@@ -78,7 +78,7 @@ void main() {
image = new RenderImage(image: new WideImage()); image = new RenderImage(image: new WideImage());
layout(image, layout(image,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
minHeight: 5.0, minHeight: 5.0,
maxWidth: 100.0, maxWidth: 100.0,
...@@ -88,7 +88,7 @@ void main() { ...@@ -88,7 +88,7 @@ void main() {
image = new RenderImage(image: new WideImage()); image = new RenderImage(image: new WideImage());
layout(image, layout(image,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
minHeight: 5.0, minHeight: 5.0,
maxWidth: 16.0, maxWidth: 16.0,
...@@ -98,7 +98,7 @@ void main() { ...@@ -98,7 +98,7 @@ void main() {
image = new RenderImage(image: new TallImage()); image = new RenderImage(image: new TallImage());
layout(image, layout(image,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
minHeight: 5.0, minHeight: 5.0,
maxWidth: 16.0, maxWidth: 16.0,
...@@ -108,7 +108,7 @@ void main() { ...@@ -108,7 +108,7 @@ void main() {
image = new RenderImage(image: new SquareImage()); image = new RenderImage(image: new SquareImage());
layout(image, layout(image,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 4.0, minWidth: 4.0,
minHeight: 4.0, minHeight: 4.0,
maxWidth: 8.0, maxWidth: 8.0,
...@@ -118,7 +118,7 @@ void main() { ...@@ -118,7 +118,7 @@ void main() {
image = new RenderImage(image: new WideImage()); image = new RenderImage(image: new WideImage());
layout(image, layout(image,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 20.0, minWidth: 20.0,
minHeight: 20.0, minHeight: 20.0,
maxWidth: 30.0, maxWidth: 30.0,
...@@ -128,7 +128,7 @@ void main() { ...@@ -128,7 +128,7 @@ void main() {
image = new RenderImage(image: new TallImage()); image = new RenderImage(image: new TallImage());
layout(image, layout(image,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 20.0, minWidth: 20.0,
minHeight: 20.0, minHeight: 20.0,
maxWidth: 30.0, maxWidth: 30.0,
...@@ -142,7 +142,7 @@ void main() { ...@@ -142,7 +142,7 @@ void main() {
image = new RenderImage(); image = new RenderImage();
layout(image, layout(image,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 25.0, minWidth: 25.0,
minHeight: 25.0, minHeight: 25.0,
maxWidth: 100.0, maxWidth: 100.0,
...@@ -152,7 +152,7 @@ void main() { ...@@ -152,7 +152,7 @@ void main() {
image = new RenderImage(width: 50.0); image = new RenderImage(width: 50.0);
layout(image, layout(image,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 25.0, minWidth: 25.0,
minHeight: 25.0, minHeight: 25.0,
maxWidth: 100.0, maxWidth: 100.0,
...@@ -162,7 +162,7 @@ void main() { ...@@ -162,7 +162,7 @@ void main() {
image = new RenderImage(height: 50.0); image = new RenderImage(height: 50.0);
layout(image, layout(image,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 25.0, minWidth: 25.0,
minHeight: 25.0, minHeight: 25.0,
maxWidth: 100.0, maxWidth: 100.0,
...@@ -172,7 +172,7 @@ void main() { ...@@ -172,7 +172,7 @@ void main() {
image = new RenderImage(width: 100.0, height: 100.0); image = new RenderImage(width: 100.0, height: 100.0);
layout(image, layout(image,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 25.0, minWidth: 25.0,
minHeight: 25.0, minHeight: 25.0,
maxWidth: 75.0, maxWidth: 75.0,
......
...@@ -18,7 +18,7 @@ class TestLayout { ...@@ -18,7 +18,7 @@ class TestLayout {
onPaint: () { painted = true; } onPaint: () { painted = true; }
), ),
child: child = new RenderConstrainedBox( child: child = new RenderConstrainedBox(
additionalConstraints: new BoxConstraints.tightFor(height: 10.0, width: 10.0) additionalConstraints: const BoxConstraints.tightFor(height: 10.0, width: 10.0)
) )
) )
); );
...@@ -29,7 +29,7 @@ class TestLayout { ...@@ -29,7 +29,7 @@ class TestLayout {
} }
void main() { void main() {
final ViewConfiguration testConfiguration = new ViewConfiguration( final ViewConfiguration testConfiguration = const ViewConfiguration(
size: const Size(800.0, 600.0), size: const Size(800.0, 600.0),
devicePixelRatio: 1.0 devicePixelRatio: 1.0
); );
......
...@@ -45,10 +45,10 @@ class RenderTestBox extends RenderBox { ...@@ -45,10 +45,10 @@ class RenderTestBox extends RenderBox {
void main() { void main() {
test('Shrink-wrapping width', () { test('Shrink-wrapping width', () {
RenderBox child = new RenderTestBox(new BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0)); RenderBox child = new RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
RenderBox parent = new RenderIntrinsicWidth(child: child); RenderBox parent = new RenderIntrinsicWidth(child: child);
layout(parent, layout(parent,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
minHeight: 8.0, minHeight: 8.0,
maxWidth: 500.0, maxWidth: 500.0,
...@@ -80,10 +80,10 @@ void main() { ...@@ -80,10 +80,10 @@ void main() {
}); });
test('Shrink-wrapping width (stepped width)', () { test('Shrink-wrapping width (stepped width)', () {
RenderBox child = new RenderTestBox(new BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0)); 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); RenderBox parent = new RenderIntrinsicWidth(child: child, stepWidth: 47.0);
layout(parent, layout(parent,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
minHeight: 8.0, minHeight: 8.0,
maxWidth: 500.0, maxWidth: 500.0,
...@@ -115,10 +115,10 @@ void main() { ...@@ -115,10 +115,10 @@ void main() {
}); });
test('Shrink-wrapping width (stepped height)', () { test('Shrink-wrapping width (stepped height)', () {
RenderBox child = new RenderTestBox(new BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0)); 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); RenderBox parent = new RenderIntrinsicWidth(child: child, stepHeight: 47.0);
layout(parent, layout(parent,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
minHeight: 8.0, minHeight: 8.0,
maxWidth: 500.0, maxWidth: 500.0,
...@@ -150,10 +150,10 @@ void main() { ...@@ -150,10 +150,10 @@ void main() {
}); });
test('Shrink-wrapping width (stepped everything)', () { test('Shrink-wrapping width (stepped everything)', () {
RenderBox child = new RenderTestBox(new BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0)); 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); RenderBox parent = new RenderIntrinsicWidth(child: child, stepHeight: 47.0, stepWidth: 37.0);
layout(parent, layout(parent,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
minHeight: 8.0, minHeight: 8.0,
maxWidth: 500.0, maxWidth: 500.0,
...@@ -185,10 +185,10 @@ void main() { ...@@ -185,10 +185,10 @@ void main() {
}); });
test('Shrink-wrapping height', () { test('Shrink-wrapping height', () {
RenderBox child = new RenderTestBox(new BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0)); RenderBox child = new RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
RenderBox parent = new RenderIntrinsicHeight(child: child); RenderBox parent = new RenderIntrinsicHeight(child: child);
layout(parent, layout(parent,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 5.0, minWidth: 5.0,
minHeight: 8.0, minHeight: 8.0,
maxWidth: 500.0, maxWidth: 500.0,
...@@ -221,7 +221,7 @@ void main() { ...@@ -221,7 +221,7 @@ void main() {
test('Padding and boring intrinsics', () { test('Padding and boring intrinsics', () {
RenderBox box = new RenderPadding( RenderBox box = new RenderPadding(
padding: new 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))
); );
...@@ -248,7 +248,7 @@ void main() { ...@@ -248,7 +248,7 @@ void main() {
// also a smoke test: // also a smoke test:
layout( layout(
box, box,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 10.0, minWidth: 10.0,
minHeight: 10.0, minHeight: 10.0,
maxWidth: 10.0, maxWidth: 10.0,
...@@ -259,7 +259,7 @@ void main() { ...@@ -259,7 +259,7 @@ void main() {
test('Padding and interesting intrinsics', () { test('Padding and interesting intrinsics', () {
RenderBox box = new RenderPadding( RenderBox box = new RenderPadding(
padding: new EdgeInsets.all(15.0), padding: const EdgeInsets.all(15.0),
child: new RenderAspectRatio(aspectRatio: 1.0) child: new RenderAspectRatio(aspectRatio: 1.0)
); );
...@@ -286,7 +286,7 @@ void main() { ...@@ -286,7 +286,7 @@ void main() {
// also a smoke test: // also a smoke test:
layout( layout(
box, box,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 10.0, minWidth: 10.0,
minHeight: 10.0, minHeight: 10.0,
maxWidth: 10.0, maxWidth: 10.0,
...@@ -297,7 +297,7 @@ void main() { ...@@ -297,7 +297,7 @@ void main() {
test('Padding and boring intrinsics', () { test('Padding and boring intrinsics', () {
RenderBox box = new RenderPadding( RenderBox box = new RenderPadding(
padding: new 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))
); );
...@@ -324,7 +324,7 @@ void main() { ...@@ -324,7 +324,7 @@ void main() {
// also a smoke test: // also a smoke test:
layout( layout(
box, box,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 10.0, minWidth: 10.0,
minHeight: 10.0, minHeight: 10.0,
maxWidth: 10.0, maxWidth: 10.0,
...@@ -335,7 +335,7 @@ void main() { ...@@ -335,7 +335,7 @@ void main() {
test('Padding and interesting intrinsics', () { test('Padding and interesting intrinsics', () {
RenderBox box = new RenderPadding( RenderBox box = new RenderPadding(
padding: new EdgeInsets.all(15.0), padding: const EdgeInsets.all(15.0),
child: new RenderAspectRatio(aspectRatio: 1.0) child: new RenderAspectRatio(aspectRatio: 1.0)
); );
...@@ -362,7 +362,7 @@ void main() { ...@@ -362,7 +362,7 @@ void main() {
// also a smoke test: // also a smoke test:
layout( layout(
box, box,
constraints: new BoxConstraints( constraints: const BoxConstraints(
minWidth: 10.0, minWidth: 10.0,
minHeight: 10.0, minHeight: 10.0,
maxWidth: 10.0, maxWidth: 10.0,
......
...@@ -11,7 +11,7 @@ import 'rendering_tester.dart'; ...@@ -11,7 +11,7 @@ import 'rendering_tester.dart';
void main() { void main() {
test('parent max size is unconstrained', () { test('parent max size is unconstrained', () {
RenderBox child = new RenderConstrainedBox( RenderBox child = new RenderConstrainedBox(
additionalConstraints: new BoxConstraints.tightFor(width: 300.0, height: 400.0) additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0)
); );
RenderBox parent = new RenderConstrainedOverflowBox( RenderBox parent = new RenderConstrainedOverflowBox(
minWidth: 0.0, minWidth: 0.0,
...@@ -31,7 +31,7 @@ void main() { ...@@ -31,7 +31,7 @@ void main() {
test('parent maxWidth is unconstrained', () { test('parent maxWidth is unconstrained', () {
RenderBox child = new RenderConstrainedBox( RenderBox child = new RenderConstrainedBox(
additionalConstraints: new BoxConstraints.tightFor(width: 300.0, height: 400.0) additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0)
); );
RenderBox parent = new RenderConstrainedOverflowBox( RenderBox parent = new RenderConstrainedOverflowBox(
minWidth: 0.0, minWidth: 0.0,
...@@ -51,7 +51,7 @@ void main() { ...@@ -51,7 +51,7 @@ void main() {
test('parent maxHeight is unconstrained', () { test('parent maxHeight is unconstrained', () {
RenderBox child = new RenderConstrainedBox( RenderBox child = new RenderConstrainedBox(
additionalConstraints: new BoxConstraints.tightFor(width: 300.0, height: 400.0) additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0)
); );
RenderBox parent = new RenderConstrainedOverflowBox( RenderBox parent = new RenderConstrainedOverflowBox(
minWidth: 500.0, minWidth: 500.0,
......
...@@ -48,7 +48,7 @@ void main() { ...@@ -48,7 +48,7 @@ void main() {
RealRoot root = new RealRoot( RealRoot root = new RealRoot(
child = new RenderPositionedBox( child = new RenderPositionedBox(
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
child: new RenderSizedBox(new Size(100.0, 100.0)) child: new RenderSizedBox(const Size(100.0, 100.0))
) )
); );
root.attach(new PipelineOwner()); root.attach(new PipelineOwner());
......
...@@ -21,7 +21,7 @@ void main() { ...@@ -21,7 +21,7 @@ void main() {
onPaint: () { painted = true; } onPaint: () { painted = true; }
), ),
child: child = new RenderConstrainedBox( child: child = new RenderConstrainedBox(
additionalConstraints: new BoxConstraints.tightFor(height: 10.0, width: 10.0) additionalConstraints: const BoxConstraints.tightFor(height: 10.0, width: 10.0)
) )
) )
) )
......
...@@ -15,7 +15,7 @@ void main() { ...@@ -15,7 +15,7 @@ void main() {
root = new RenderPositionedBox( root = new RenderPositionedBox(
child: new RenderCustomPaint( child: new RenderCustomPaint(
child: child = text = new RenderParagraph(new TextSpan(text: 'Hello World')), child: child = text = new RenderParagraph(const TextSpan(text: 'Hello World')),
painter: new TestCallbackPainter( painter: new TestCallbackPainter(
onPaint: () { onPaint: () {
baseline1 = child.getDistanceToBaseline(TextBaseline.alphabetic); baseline1 = child.getDistanceToBaseline(TextBaseline.alphabetic);
...@@ -29,7 +29,7 @@ void main() { ...@@ -29,7 +29,7 @@ void main() {
root = new RenderPositionedBox( root = new RenderPositionedBox(
child: new RenderCustomPaint( child: new RenderCustomPaint(
child: child = new RenderConstrainedOverflowBox( child: child = new RenderConstrainedOverflowBox(
child: text = new RenderParagraph(new TextSpan(text: 'Hello World')), child: text = new RenderParagraph(const TextSpan(text: 'Hello World')),
maxHeight: height1 / 2.0, maxHeight: height1 / 2.0,
alignment: const FractionalOffset(0.0, 0.0) alignment: const FractionalOffset(0.0, 0.0)
), ),
......
...@@ -8,8 +8,8 @@ import 'package:test/test.dart'; ...@@ -8,8 +8,8 @@ import 'package:test/test.dart';
void main() { void main() {
test('block and paragraph intrinsics', () { test('block and paragraph intrinsics', () {
final RenderParagraph paragraph = new RenderParagraph( final RenderParagraph paragraph = new RenderParagraph(
new TextSpan( const TextSpan(
style: new TextStyle(height: 1.0), style: const TextStyle(height: 1.0),
text: 'Hello World' text: 'Hello World'
) )
); );
......
...@@ -10,11 +10,11 @@ import 'rendering_tester.dart'; ...@@ -10,11 +10,11 @@ import 'rendering_tester.dart';
void main() { void main() {
test('RenderPositionedBox expands', () { test('RenderPositionedBox expands', () {
RenderConstrainedBox sizer = new RenderConstrainedBox( RenderConstrainedBox sizer = new RenderConstrainedBox(
additionalConstraints: new BoxConstraints.tight(new Size(100.0, 100.0)), additionalConstraints: new BoxConstraints.tight(const Size(100.0, 100.0)),
child: new RenderDecoratedBox(decoration: new BoxDecoration()) child: new RenderDecoratedBox(decoration: const BoxDecoration())
); );
RenderPositionedBox positioner = new RenderPositionedBox(child: sizer); RenderPositionedBox positioner = new RenderPositionedBox(child: sizer);
layout(positioner, constraints: new BoxConstraints.loose(new Size(200.0, 200.0))); layout(positioner, constraints: new BoxConstraints.loose(const Size(200.0, 200.0)));
expect(positioner.size.width, equals(200.0), reason: "positioner width"); expect(positioner.size.width, equals(200.0), reason: "positioner width");
expect(positioner.size.height, equals(200.0), reason: "positioner height"); expect(positioner.size.height, equals(200.0), reason: "positioner height");
...@@ -22,11 +22,11 @@ void main() { ...@@ -22,11 +22,11 @@ void main() {
test('RenderPositionedBox shrink wraps', () { test('RenderPositionedBox shrink wraps', () {
RenderConstrainedBox sizer = new RenderConstrainedBox( RenderConstrainedBox sizer = new RenderConstrainedBox(
additionalConstraints: new BoxConstraints.tight(new Size(100.0, 100.0)), additionalConstraints: new BoxConstraints.tight(const Size(100.0, 100.0)),
child: new RenderDecoratedBox(decoration: new BoxDecoration()) child: new RenderDecoratedBox(decoration: const BoxDecoration())
); );
RenderPositionedBox positioner = new RenderPositionedBox(child: sizer, widthFactor: 1.0); RenderPositionedBox positioner = new RenderPositionedBox(child: sizer, widthFactor: 1.0);
layout(positioner, constraints: new BoxConstraints.loose(new Size(200.0, 200.0))); layout(positioner, constraints: new BoxConstraints.loose(const Size(200.0, 200.0)));
expect(positioner.size.width, equals(100.0), reason: "positioner width"); expect(positioner.size.width, equals(100.0), reason: "positioner width");
expect(positioner.size.height, equals(200.0), reason: "positioner height"); expect(positioner.size.height, equals(200.0), reason: "positioner height");
...@@ -47,11 +47,11 @@ void main() { ...@@ -47,11 +47,11 @@ void main() {
test('RenderPositionedBox width and height factors', () { test('RenderPositionedBox width and height factors', () {
RenderConstrainedBox sizer = new RenderConstrainedBox( RenderConstrainedBox sizer = new RenderConstrainedBox(
additionalConstraints: new BoxConstraints.tight(new Size(100.0, 100.0)), additionalConstraints: new BoxConstraints.tight(const Size(100.0, 100.0)),
child: new RenderDecoratedBox(decoration: new BoxDecoration()) child: new RenderDecoratedBox(decoration: const BoxDecoration())
); );
RenderPositionedBox positioner = new RenderPositionedBox(child: sizer, widthFactor: 1.0, heightFactor: 0.0); RenderPositionedBox positioner = new RenderPositionedBox(child: sizer, widthFactor: 1.0, heightFactor: 0.0);
layout(positioner, constraints: new BoxConstraints.loose(new Size(200.0, 200.0))); layout(positioner, constraints: new BoxConstraints.loose(const Size(200.0, 200.0)));
expect(positioner.size.width, equals(100.0)); expect(positioner.size.width, equals(100.0));
expect(positioner.size.height, equals(0.0)); expect(positioner.size.height, equals(0.0));
......
...@@ -19,7 +19,7 @@ class TestTree { ...@@ -19,7 +19,7 @@ class TestTree {
// relayout/repaint of the new parent node to satisfy the test. // relayout/repaint of the new parent node to satisfy the test.
child: new RenderRepaintBoundary( child: new RenderRepaintBoundary(
child: new RenderConstrainedBox( child: new RenderConstrainedBox(
additionalConstraints: new BoxConstraints.tightFor(height: 20.0, width: 20.0), additionalConstraints: const BoxConstraints.tightFor(height: 20.0, width: 20.0),
child: new RenderRepaintBoundary( child: new RenderRepaintBoundary(
child: new RenderCustomPaint( child: new RenderCustomPaint(
painter: new TestCallbackPainter( painter: new TestCallbackPainter(
...@@ -27,7 +27,7 @@ class TestTree { ...@@ -27,7 +27,7 @@ class TestTree {
), ),
child: new RenderPositionedBox( child: new RenderPositionedBox(
child: child = new RenderConstrainedBox( child: child = new RenderConstrainedBox(
additionalConstraints: new BoxConstraints.tightFor(height: 20.0, width: 20.0) additionalConstraints: const BoxConstraints.tightFor(height: 20.0, width: 20.0)
) )
) )
) )
...@@ -63,7 +63,7 @@ class TestCompositingBitsTree { ...@@ -63,7 +63,7 @@ class TestCompositingBitsTree {
onPaint: () { painted = true; } onPaint: () { painted = true; }
), ),
child: child = new RenderConstrainedBox( child: child = new RenderConstrainedBox(
additionalConstraints: new BoxConstraints.tightFor(height: 20.0, width: 20.0) additionalConstraints: const BoxConstraints.tightFor(height: 20.0, width: 20.0)
) )
) )
) )
...@@ -87,7 +87,7 @@ void main() { ...@@ -87,7 +87,7 @@ void main() {
expect(testTree.child.owner, isNull); expect(testTree.child.owner, isNull);
// Dirty one of the elements // Dirty one of the elements
testTree.child.additionalConstraints = testTree.child.additionalConstraints =
new BoxConstraints.tightFor(height: 5.0, width: 5.0); const BoxConstraints.tightFor(height: 5.0, width: 5.0);
// Lay out again // Lay out again
layout(testTree.root, phase: EnginePhase.layout); layout(testTree.root, phase: EnginePhase.layout);
expect(testTree.child.size, equals(const Size(5.0, 5.0))); expect(testTree.child.size, equals(const Size(5.0, 5.0)));
......
...@@ -14,14 +14,14 @@ void main() { ...@@ -14,14 +14,14 @@ void main() {
); );
RenderBox red = new RenderDecoratedBox( RenderBox red = new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFFFF0000) backgroundColor: const Color(0xFFFF0000)
), ),
child: size child: size
); );
RenderBox green = new RenderDecoratedBox( RenderBox green = new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFFFF0000) backgroundColor: const Color(0xFFFF0000)
) )
); );
......
...@@ -45,7 +45,7 @@ void main() { ...@@ -45,7 +45,7 @@ void main() {
pumpFrame(); pumpFrame();
expect(table.size, equals(new Size(100.0, 200.0))); expect(table.size, equals(const Size(100.0, 200.0)));
table.setChild(0, 0, sizedBox(10.0, 30.0)); table.setChild(0, 0, sizedBox(10.0, 30.0));
table.setChild(1, 0, sizedBox(20.0, 20.0)); table.setChild(1, 0, sizedBox(20.0, 20.0));
...@@ -53,7 +53,7 @@ void main() { ...@@ -53,7 +53,7 @@ void main() {
pumpFrame(); pumpFrame();
expect(table.size, equals(new Size(130.0, 230.0))); expect(table.size, equals(const Size(130.0, 230.0)));
}); });
test('Table test: removing cells', () { test('Table test: removing cells', () {
......
...@@ -21,7 +21,7 @@ void main() { ...@@ -21,7 +21,7 @@ void main() {
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
child: inner = new RenderSizedBox(const Size(100.0, 100.0)), child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
); );
layout(sizer, constraints: new BoxConstraints.tight(new Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft);
expect(inner.globalToLocal(const Point(0.0, 0.0)), equals(const Point(0.0, 0.0))); expect(inner.globalToLocal(const Point(0.0, 0.0)), equals(const Point(0.0, 0.0)));
expect(inner.globalToLocal(const Point(100.0, 100.0)), equals(const Point(100.0, 100.0))); expect(inner.globalToLocal(const Point(100.0, 100.0)), equals(const Point(100.0, 100.0)));
expect(inner.globalToLocal(const Point(25.0, 75.0)), equals(const Point(25.0, 75.0))); expect(inner.globalToLocal(const Point(25.0, 75.0)), equals(const Point(25.0, 75.0)));
...@@ -38,11 +38,11 @@ void main() { ...@@ -38,11 +38,11 @@ void main() {
transform: new Matrix4.identity(), transform: new Matrix4.identity(),
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
child: new RenderPadding( child: new RenderPadding(
padding: new EdgeInsets.only(left: 20.0), padding: const EdgeInsets.only(left: 20.0),
child: inner = new RenderSizedBox(const Size(80.0, 100.0)), child: inner = new RenderSizedBox(const Size(80.0, 100.0)),
), ),
); );
layout(sizer, constraints: new BoxConstraints.tight(new Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft);
expect(inner.globalToLocal(const Point(0.0, 0.0)), equals(const Point(-20.0, 0.0))); expect(inner.globalToLocal(const Point(0.0, 0.0)), equals(const Point(-20.0, 0.0)));
expect(inner.globalToLocal(const Point(100.0, 100.0)), equals(const Point(80.0, 100.0))); expect(inner.globalToLocal(const Point(100.0, 100.0)), equals(const Point(80.0, 100.0)));
expect(inner.globalToLocal(const Point(25.0, 75.0)), equals(const Point(5.0, 75.0))); expect(inner.globalToLocal(const Point(25.0, 75.0)), equals(const Point(5.0, 75.0)));
...@@ -60,7 +60,7 @@ void main() { ...@@ -60,7 +60,7 @@ void main() {
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
child: inner = new RenderSizedBox(const Size(100.0, 100.0)), child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
); );
layout(sizer, constraints: new BoxConstraints.tight(new Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft);
expect(inner.globalToLocal(const Point(0.0, 0.0)), equals(const Point(-50.0, -200.0))); expect(inner.globalToLocal(const Point(0.0, 0.0)), equals(const Point(-50.0, -200.0)));
expect(inner.globalToLocal(const Point(100.0, 100.0)), equals(const Point(50.0, -100.0))); expect(inner.globalToLocal(const Point(100.0, 100.0)), equals(const Point(50.0, -100.0)));
expect(inner.globalToLocal(const Point(25.0, 75.0)), equals(const Point(-25.0, -125.0))); expect(inner.globalToLocal(const Point(25.0, 75.0)), equals(const Point(-25.0, -125.0)));
...@@ -77,11 +77,11 @@ void main() { ...@@ -77,11 +77,11 @@ void main() {
transform: new Matrix4.translationValues(50.0, 200.0, 0.0), transform: new Matrix4.translationValues(50.0, 200.0, 0.0),
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
child: new RenderPadding( child: new RenderPadding(
padding: new EdgeInsets.only(left: 20.0), padding: const EdgeInsets.only(left: 20.0),
child: inner = new RenderSizedBox(const Size(80.0, 100.0)), child: inner = new RenderSizedBox(const Size(80.0, 100.0)),
), ),
); );
layout(sizer, constraints: new BoxConstraints.tight(new Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft);
expect(inner.globalToLocal(const Point(0.0, 0.0)), equals(const Point(-70.0, -200.0))); expect(inner.globalToLocal(const Point(0.0, 0.0)), equals(const Point(-70.0, -200.0)));
expect(inner.globalToLocal(const Point(100.0, 100.0)), equals(const Point(30.0, -100.0))); expect(inner.globalToLocal(const Point(100.0, 100.0)), equals(const Point(30.0, -100.0)));
expect(inner.globalToLocal(const Point(25.0, 75.0)), equals(const Point(-45.0, -125.0))); expect(inner.globalToLocal(const Point(25.0, 75.0)), equals(const Point(-45.0, -125.0)));
...@@ -99,7 +99,7 @@ void main() { ...@@ -99,7 +99,7 @@ void main() {
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
child: inner = new RenderSizedBox(const Size(100.0, 100.0)), child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
); );
layout(sizer, constraints: new BoxConstraints.tight(new Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft);
expect(round(inner.globalToLocal(const Point(0.0, 0.0))), equals(const Point(100.0, 100.0))); expect(round(inner.globalToLocal(const Point(0.0, 0.0))), equals(const Point(100.0, 100.0)));
expect(round(inner.globalToLocal(const Point(100.0, 100.0))), equals(const Point(0.0, 0.0))); expect(round(inner.globalToLocal(const Point(100.0, 100.0))), equals(const Point(0.0, 0.0)));
expect(round(inner.globalToLocal(const Point(25.0, 75.0))), equals(const Point(75.0, 25.0))); expect(round(inner.globalToLocal(const Point(25.0, 75.0))), equals(const Point(75.0, 25.0)));
...@@ -116,11 +116,11 @@ void main() { ...@@ -116,11 +116,11 @@ void main() {
transform: new Matrix4.rotationZ(math.PI), transform: new Matrix4.rotationZ(math.PI),
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
child: new RenderPadding( child: new RenderPadding(
padding: new EdgeInsets.only(left: 20.0), padding: const EdgeInsets.only(left: 20.0),
child: inner = new RenderSizedBox(const Size(80.0, 100.0)), child: inner = new RenderSizedBox(const Size(80.0, 100.0)),
), ),
); );
layout(sizer, constraints: new BoxConstraints.tight(new Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft);
expect(round(inner.globalToLocal(const Point(0.0, 0.0))), equals(const Point(80.0, 100.0))); expect(round(inner.globalToLocal(const Point(0.0, 0.0))), equals(const Point(80.0, 100.0)));
expect(round(inner.globalToLocal(const Point(100.0, 100.0))), equals(const Point(-20.0, 0.0))); expect(round(inner.globalToLocal(const Point(100.0, 100.0))), equals(const Point(-20.0, 0.0)));
expect(round(inner.globalToLocal(const Point(25.0, 75.0))), equals(const Point(55.0, 25.0))); expect(round(inner.globalToLocal(const Point(25.0, 75.0))), equals(const Point(55.0, 25.0)));
...@@ -138,7 +138,7 @@ void main() { ...@@ -138,7 +138,7 @@ void main() {
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
child: inner = new RenderSizedBox(const Size(100.0, 100.0)), child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
); );
layout(sizer, constraints: new BoxConstraints.tight(new Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft);
expect(round(inner.globalToLocal(const Point(25.0, 50.0))), equals(const Point(25.0, 50.0))); expect(round(inner.globalToLocal(const Point(25.0, 50.0))), equals(const Point(25.0, 50.0)));
expect(inner.globalToLocal(const Point(25.0, 17.0)).y, greaterThan(0.0)); expect(inner.globalToLocal(const Point(25.0, 17.0)).y, greaterThan(0.0));
...@@ -155,7 +155,7 @@ void main() { ...@@ -155,7 +155,7 @@ void main() {
alignment: FractionalOffset.center, alignment: FractionalOffset.center,
child: inner = new RenderSizedBox(const Size(100.0, 100.0)), child: inner = new RenderSizedBox(const Size(100.0, 100.0)),
); );
layout(sizer, constraints: new BoxConstraints.tight(new Size(100.0, 100.0)), alignment: FractionalOffset.topLeft); layout(sizer, constraints: new BoxConstraints.tight(const Size(100.0, 100.0)), alignment: FractionalOffset.topLeft);
// the inner widget has a height of about half a pixel at this rotation, so // the inner widget has a height of about half a pixel at this rotation, so
// everything should end up around the middle of the outer box. // everything should end up around the middle of the outer box.
......
...@@ -10,7 +10,7 @@ import 'rendering_tester.dart'; ...@@ -10,7 +10,7 @@ import 'rendering_tester.dart';
void main() { void main() {
test('Should be able to hit with positive paint offset', () { test('Should be able to hit with positive paint offset', () {
RenderBox green = new RenderDecoratedBox( RenderBox green = new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFF00FF00) backgroundColor: const Color(0xFF00FF00)
)); ));
...@@ -19,22 +19,22 @@ void main() { ...@@ -19,22 +19,22 @@ void main() {
child: green); child: green);
RenderBox red = new RenderDecoratedBox( RenderBox red = new RenderDecoratedBox(
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFFFF0000) backgroundColor: const Color(0xFFFF0000)
), ),
child: size); child: size);
RenderViewport viewport = new RenderViewport(child: red, paintOffset: new Offset(0.0, 10.0)); RenderViewport viewport = new RenderViewport(child: red, paintOffset: const Offset(0.0, 10.0));
layout(viewport); layout(viewport);
HitTestResult result; HitTestResult result;
result = new HitTestResult(); result = new HitTestResult();
renderer.renderView.hitTest(result, position: new Point(15.0, 0.0)); renderer.renderView.hitTest(result, position: const Point(15.0, 0.0));
expect(result.path.first.target.runtimeType, equals(RenderView)); expect(result.path.first.target.runtimeType, equals(RenderView));
result = new HitTestResult(); result = new HitTestResult();
renderer.renderView.hitTest(result, position: new Point(15.0, 15.0)); renderer.renderView.hitTest(result, position: const Point(15.0, 15.0));
expect(result.path.first.target, equals(green)); expect(result.path.first.target, equals(green));
}); });
} }
...@@ -12,10 +12,10 @@ void main() { ...@@ -12,10 +12,10 @@ void main() {
imageCache.maximumSize = 2; imageCache.maximumSize = 2;
TestImageInfo a = await extractOneFrame(new TestProvider(1, 1).resolve(ImageConfiguration.empty)); TestImageInfo a = await extractOneFrame(const TestProvider(1, 1).resolve(ImageConfiguration.empty));
TestImageInfo b = await extractOneFrame(new TestProvider(2, 2).resolve(ImageConfiguration.empty)); TestImageInfo b = await extractOneFrame(const TestProvider(2, 2).resolve(ImageConfiguration.empty));
TestImageInfo c = await extractOneFrame(new TestProvider(3, 3).resolve(ImageConfiguration.empty)); TestImageInfo c = await extractOneFrame(const TestProvider(3, 3).resolve(ImageConfiguration.empty));
TestImageInfo d = await extractOneFrame(new TestProvider(1, 4).resolve(ImageConfiguration.empty)); TestImageInfo d = await extractOneFrame(const TestProvider(1, 4).resolve(ImageConfiguration.empty));
expect(a.value, equals(1)); expect(a.value, equals(1));
expect(b.value, equals(2)); expect(b.value, equals(2));
expect(c.value, equals(3)); expect(c.value, equals(3));
...@@ -23,18 +23,18 @@ void main() { ...@@ -23,18 +23,18 @@ void main() {
imageCache.maximumSize = 0; imageCache.maximumSize = 0;
TestImageInfo e = await extractOneFrame(new TestProvider(1, 5).resolve(ImageConfiguration.empty)); TestImageInfo e = await extractOneFrame(const TestProvider(1, 5).resolve(ImageConfiguration.empty));
expect(e.value, equals(5)); expect(e.value, equals(5));
TestImageInfo f = await extractOneFrame(new TestProvider(1, 6).resolve(ImageConfiguration.empty)); TestImageInfo f = await extractOneFrame(const TestProvider(1, 6).resolve(ImageConfiguration.empty));
expect(f.value, equals(6)); expect(f.value, equals(6));
imageCache.maximumSize = 3; imageCache.maximumSize = 3;
TestImageInfo g = await extractOneFrame(new TestProvider(1, 7).resolve(ImageConfiguration.empty)); TestImageInfo g = await extractOneFrame(const TestProvider(1, 7).resolve(ImageConfiguration.empty));
expect(g.value, equals(7)); expect(g.value, equals(7));
TestImageInfo h = await extractOneFrame(new TestProvider(1, 8).resolve(ImageConfiguration.empty)); TestImageInfo h = await extractOneFrame(const TestProvider(1, 8).resolve(ImageConfiguration.empty));
expect(h.value, equals(7)); expect(h.value, equals(7));
}); });
......
...@@ -12,69 +12,69 @@ void main() { ...@@ -12,69 +12,69 @@ void main() {
imageCache.maximumSize = 3; imageCache.maximumSize = 3;
TestImageInfo a = await extractOneFrame(new TestProvider(1, 1).resolve(ImageConfiguration.empty)); TestImageInfo a = await extractOneFrame(const TestProvider(1, 1).resolve(ImageConfiguration.empty));
expect(a.value, equals(1)); expect(a.value, equals(1));
TestImageInfo b = await extractOneFrame(new TestProvider(1, 2).resolve(ImageConfiguration.empty)); TestImageInfo b = await extractOneFrame(const TestProvider(1, 2).resolve(ImageConfiguration.empty));
expect(b.value, equals(1)); expect(b.value, equals(1));
TestImageInfo c = await extractOneFrame(new TestProvider(1, 3).resolve(ImageConfiguration.empty)); TestImageInfo c = await extractOneFrame(const TestProvider(1, 3).resolve(ImageConfiguration.empty));
expect(c.value, equals(1)); expect(c.value, equals(1));
TestImageInfo d = await extractOneFrame(new TestProvider(1, 4).resolve(ImageConfiguration.empty)); TestImageInfo d = await extractOneFrame(const TestProvider(1, 4).resolve(ImageConfiguration.empty));
expect(d.value, equals(1)); expect(d.value, equals(1));
TestImageInfo e = await extractOneFrame(new TestProvider(1, 5).resolve(ImageConfiguration.empty)); TestImageInfo e = await extractOneFrame(const TestProvider(1, 5).resolve(ImageConfiguration.empty));
expect(e.value, equals(1)); expect(e.value, equals(1));
TestImageInfo f = await extractOneFrame(new TestProvider(1, 6).resolve(ImageConfiguration.empty)); TestImageInfo f = await extractOneFrame(const TestProvider(1, 6).resolve(ImageConfiguration.empty));
expect(f.value, equals(1)); expect(f.value, equals(1));
expect(f, equals(a)); expect(f, equals(a));
// cache still only has one entry in it: 1(1) // cache still only has one entry in it: 1(1)
TestImageInfo g = await extractOneFrame(new TestProvider(2, 7).resolve(ImageConfiguration.empty)); TestImageInfo g = await extractOneFrame(const TestProvider(2, 7).resolve(ImageConfiguration.empty));
expect(g.value, equals(7)); expect(g.value, equals(7));
// cache has two entries in it: 1(1), 2(7) // cache has two entries in it: 1(1), 2(7)
TestImageInfo h = await extractOneFrame(new TestProvider(1, 8).resolve(ImageConfiguration.empty)); TestImageInfo h = await extractOneFrame(const TestProvider(1, 8).resolve(ImageConfiguration.empty));
expect(h.value, equals(1)); expect(h.value, equals(1));
// cache still has two entries in it: 2(7), 1(1) // cache still has two entries in it: 2(7), 1(1)
TestImageInfo i = await extractOneFrame(new TestProvider(3, 9).resolve(ImageConfiguration.empty)); TestImageInfo i = await extractOneFrame(const TestProvider(3, 9).resolve(ImageConfiguration.empty));
expect(i.value, equals(9)); expect(i.value, equals(9));
// cache has three entries in it: 2(7), 1(1), 3(9) // cache has three entries in it: 2(7), 1(1), 3(9)
TestImageInfo j = await extractOneFrame(new TestProvider(1, 10).resolve(ImageConfiguration.empty)); TestImageInfo j = await extractOneFrame(const TestProvider(1, 10).resolve(ImageConfiguration.empty));
expect(j.value, equals(1)); expect(j.value, equals(1));
// cache still has three entries in it: 2(7), 3(9), 1(1) // cache still has three entries in it: 2(7), 3(9), 1(1)
TestImageInfo k = await extractOneFrame(new TestProvider(4, 11).resolve(ImageConfiguration.empty)); TestImageInfo k = await extractOneFrame(const TestProvider(4, 11).resolve(ImageConfiguration.empty));
expect(k.value, equals(11)); expect(k.value, equals(11));
// cache has three entries: 3(9), 1(1), 4(11) // cache has three entries: 3(9), 1(1), 4(11)
TestImageInfo l = await extractOneFrame(new TestProvider(1, 12).resolve(ImageConfiguration.empty)); TestImageInfo l = await extractOneFrame(const TestProvider(1, 12).resolve(ImageConfiguration.empty));
expect(l.value, equals(1)); expect(l.value, equals(1));
// cache has three entries: 3(9), 4(11), 1(1) // cache has three entries: 3(9), 4(11), 1(1)
TestImageInfo m = await extractOneFrame(new TestProvider(2, 13).resolve(ImageConfiguration.empty)); TestImageInfo m = await extractOneFrame(const TestProvider(2, 13).resolve(ImageConfiguration.empty));
expect(m.value, equals(13)); expect(m.value, equals(13));
// cache has three entries: 4(11), 1(1), 2(13) // cache has three entries: 4(11), 1(1), 2(13)
TestImageInfo n = await extractOneFrame(new TestProvider(3, 14).resolve(ImageConfiguration.empty)); TestImageInfo n = await extractOneFrame(const TestProvider(3, 14).resolve(ImageConfiguration.empty));
expect(n.value, equals(14)); expect(n.value, equals(14));
// cache has three entries: 1(1), 2(13), 3(14) // cache has three entries: 1(1), 2(13), 3(14)
TestImageInfo o = await extractOneFrame(new TestProvider(4, 15).resolve(ImageConfiguration.empty)); TestImageInfo o = await extractOneFrame(const TestProvider(4, 15).resolve(ImageConfiguration.empty));
expect(o.value, equals(15)); expect(o.value, equals(15));
// cache has three entries: 2(13), 3(14), 4(15) // cache has three entries: 2(13), 3(14), 4(15)
TestImageInfo p = await extractOneFrame(new TestProvider(1, 16).resolve(ImageConfiguration.empty)); TestImageInfo p = await extractOneFrame(const TestProvider(1, 16).resolve(ImageConfiguration.empty));
expect(p.value, equals(16)); expect(p.value, equals(16));
// cache has three entries: 3(14), 4(15), 1(16) // cache has three entries: 3(14), 4(15), 1(16)
......
...@@ -10,12 +10,12 @@ void main() { ...@@ -10,12 +10,12 @@ void main() {
testWidgets('AnimatedContainer control test', (WidgetTester tester) async { testWidgets('AnimatedContainer control test', (WidgetTester tester) async {
GlobalKey key = new GlobalKey(); GlobalKey key = new GlobalKey();
BoxDecoration decorationA = new BoxDecoration( BoxDecoration decorationA = const BoxDecoration(
backgroundColor: new Color(0xFF00FF00) backgroundColor: const Color(0xFF00FF00)
); );
BoxDecoration decorationB = new BoxDecoration( BoxDecoration decorationB = const BoxDecoration(
backgroundColor: new Color(0xFF0000FF) backgroundColor: const Color(0xFF0000FF)
); );
BoxDecoration actualDecoration; BoxDecoration actualDecoration;
...@@ -54,41 +54,41 @@ void main() { ...@@ -54,41 +54,41 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedContainer( new AnimatedContainer(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFF00FF00) backgroundColor: const Color(0xFF00FF00)
) )
) )
); );
expect(tester.binding.transientCallbackCount, 0); expect(tester.binding.transientCallbackCount, 0);
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(tester.binding.transientCallbackCount, 0); expect(tester.binding.transientCallbackCount, 0);
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedContainer( new AnimatedContainer(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFF00FF00) backgroundColor: const Color(0xFF00FF00)
) )
) )
); );
expect(tester.binding.transientCallbackCount, 0); expect(tester.binding.transientCallbackCount, 0);
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(tester.binding.transientCallbackCount, 0); expect(tester.binding.transientCallbackCount, 0);
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedContainer( new AnimatedContainer(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFF0000FF) backgroundColor: const Color(0xFF0000FF)
) )
) )
); );
expect(tester.binding.transientCallbackCount, 1); // this is the only time an animation should have started! expect(tester.binding.transientCallbackCount, 1); // this is the only time an animation should have started!
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(tester.binding.transientCallbackCount, 0); expect(tester.binding.transientCallbackCount, 0);
await tester.pumpWidget( await tester.pumpWidget(
new AnimatedContainer( new AnimatedContainer(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFF0000FF) backgroundColor: const Color(0xFF0000FF)
) )
) )
); );
...@@ -108,13 +108,13 @@ void main() { ...@@ -108,13 +108,13 @@ void main() {
); );
await tester.pump(); await tester.pump();
await tester.pump(new Duration(milliseconds: 100)); await tester.pump(const Duration(milliseconds: 100));
RenderBox text = tester.renderObject(find.text('X')); RenderBox text = tester.renderObject(find.text('X'));
expect(text.size.width, equals(100.0)); expect(text.size.width, equals(100.0));
expect(text.size.height, equals(100.0)); expect(text.size.height, equals(100.0));
await tester.pump(new Duration(milliseconds: 1000)); await tester.pump(const Duration(milliseconds: 1000));
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
...@@ -127,7 +127,7 @@ void main() { ...@@ -127,7 +127,7 @@ void main() {
) )
); );
await tester.pump(); await tester.pump();
await tester.pump(new Duration(milliseconds: 100)); await tester.pump(const Duration(milliseconds: 100));
text = tester.renderObject(find.text('X')); text = tester.renderObject(find.text('X'));
expect(text.size.width, greaterThan(110.0)); expect(text.size.width, greaterThan(110.0));
...@@ -135,7 +135,7 @@ void main() { ...@@ -135,7 +135,7 @@ void main() {
expect(text.size.height, greaterThan(110.0)); expect(text.size.height, greaterThan(110.0));
expect(text.size.height, lessThan(190.0)); expect(text.size.height, lessThan(190.0));
await tester.pump(new Duration(milliseconds: 1000)); await tester.pump(const Duration(milliseconds: 1000));
expect(text.size.width, equals(200.0)); expect(text.size.width, equals(200.0));
expect(text.size.height, equals(200.0)); expect(text.size.height, equals(200.0));
...@@ -151,13 +151,13 @@ void main() { ...@@ -151,13 +151,13 @@ void main() {
) )
); );
await tester.pump(); await tester.pump();
await tester.pump(new Duration(milliseconds: 100)); await tester.pump(const Duration(milliseconds: 100));
expect(text.size.width, equals(200.0)); expect(text.size.width, equals(200.0));
expect(text.size.height, greaterThan(110.0)); expect(text.size.height, greaterThan(110.0));
expect(text.size.height, lessThan(190.0)); expect(text.size.height, lessThan(190.0));
await tester.pump(new Duration(milliseconds: 1000)); await tester.pump(const Duration(milliseconds: 1000));
expect(text.size.width, equals(200.0)); expect(text.size.width, equals(200.0));
expect(text.size.height, equals(100.0)); expect(text.size.height, equals(100.0));
......
...@@ -11,11 +11,11 @@ void main() { ...@@ -11,11 +11,11 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new AnimatedCrossFade( child: new AnimatedCrossFade(
firstChild: new SizedBox( firstChild: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
), ),
secondChild: new SizedBox( secondChild: const SizedBox(
width: 200.0, width: 200.0,
height: 200.0 height: 200.0
), ),
...@@ -33,11 +33,11 @@ void main() { ...@@ -33,11 +33,11 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new AnimatedCrossFade( child: new AnimatedCrossFade(
firstChild: new SizedBox( firstChild: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
), ),
secondChild: new SizedBox( secondChild: const SizedBox(
width: 200.0, width: 200.0,
height: 200.0 height: 200.0
), ),
...@@ -59,11 +59,11 @@ void main() { ...@@ -59,11 +59,11 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new AnimatedCrossFade( child: new AnimatedCrossFade(
firstChild: new SizedBox( firstChild: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
), ),
secondChild: new SizedBox( secondChild: const SizedBox(
width: 200.0, width: 200.0,
height: 200.0 height: 200.0
), ),
......
...@@ -22,7 +22,7 @@ void main() { ...@@ -22,7 +22,7 @@ void main() {
child: new AnimatedSize( child: new AnimatedSize(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
vsync: tester, vsync: tester,
child: new SizedBox( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
...@@ -37,9 +37,9 @@ void main() { ...@@ -37,9 +37,9 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new AnimatedSize( child: new AnimatedSize(
duration: new Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
vsync: tester, vsync: tester,
child: new SizedBox( child: const SizedBox(
width: 200.0, width: 200.0,
height: 200.0 height: 200.0
) )
...@@ -64,9 +64,9 @@ void main() { ...@@ -64,9 +64,9 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new Center( new Center(
child: new AnimatedSize( child: new AnimatedSize(
duration: new Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
vsync: tester, vsync: tester,
child: new SizedBox( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
...@@ -98,7 +98,7 @@ void main() { ...@@ -98,7 +98,7 @@ void main() {
child: new AnimatedSize( child: new AnimatedSize(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
vsync: tester, vsync: tester,
child: new SizedBox( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
...@@ -119,7 +119,7 @@ void main() { ...@@ -119,7 +119,7 @@ void main() {
child: new AnimatedSize( child: new AnimatedSize(
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
vsync: tester, vsync: tester,
child: new SizedBox( child: const SizedBox(
width: 200.0, width: 200.0,
height: 200.0 height: 200.0
) )
......
...@@ -27,8 +27,8 @@ Future<Size> _getSize(WidgetTester tester, BoxConstraints constraints, double as ...@@ -27,8 +27,8 @@ Future<Size> _getSize(WidgetTester tester, BoxConstraints constraints, double as
void main() { void main() {
testWidgets('Aspect ratio control test', (WidgetTester tester) async { testWidgets('Aspect ratio control test', (WidgetTester tester) async {
expect(await _getSize(tester, new BoxConstraints.loose(new Size(500.0, 500.0)), 2.0), equals(new Size(500.0, 250.0))); expect(await _getSize(tester, new BoxConstraints.loose(const Size(500.0, 500.0)), 2.0), equals(const Size(500.0, 250.0)));
expect(await _getSize(tester, new BoxConstraints.loose(new Size(500.0, 500.0)), 0.5), equals(new Size(250.0, 500.0))); expect(await _getSize(tester, new BoxConstraints.loose(const Size(500.0, 500.0)), 0.5), equals(const Size(250.0, 500.0)));
}); });
testWidgets('Aspect ratio infinite width', (WidgetTester tester) async { testWidgets('Aspect ratio infinite width', (WidgetTester tester) async {
...@@ -47,6 +47,6 @@ void main() { ...@@ -47,6 +47,6 @@ void main() {
) )
); );
RenderBox box = tester.renderObject(find.byKey(childKey)); RenderBox box = tester.renderObject(find.byKey(childKey));
expect(box.size, equals(new Size(1200.0, 600.0))); expect(box.size, equals(const Size(1200.0, 600.0)));
}); });
} }
...@@ -18,14 +18,14 @@ class TestCanvas implements Canvas { ...@@ -18,14 +18,14 @@ class TestCanvas implements Canvas {
void main() { void main() {
test('A Banner with a location of topLeft paints in the top left', () { test('A Banner with a location of topLeft paints in the top left', () {
BannerPainter bannerPainter = new BannerPainter( BannerPainter bannerPainter = const BannerPainter(
message:"foo", message:"foo",
location: BannerLocation.topLeft location: BannerLocation.topLeft
); );
TestCanvas canvas = new TestCanvas(); TestCanvas canvas = new TestCanvas();
bannerPainter.paint(canvas, new Size(1000.0, 1000.0)); bannerPainter.paint(canvas, const Size(1000.0, 1000.0));
Invocation translateCommand = canvas.invocations.firstWhere((Invocation invocation) { Invocation translateCommand = canvas.invocations.firstWhere((Invocation invocation) {
return invocation.memberName == #translate; return invocation.memberName == #translate;
...@@ -44,14 +44,14 @@ void main() { ...@@ -44,14 +44,14 @@ void main() {
}); });
test('A Banner with a location of topRight paints in the top right', () { test('A Banner with a location of topRight paints in the top right', () {
BannerPainter bannerPainter = new BannerPainter( BannerPainter bannerPainter = const BannerPainter(
message:"foo", message:"foo",
location: BannerLocation.topRight location: BannerLocation.topRight
); );
TestCanvas canvas = new TestCanvas(); TestCanvas canvas = new TestCanvas();
bannerPainter.paint(canvas, new Size(1000.0, 1000.0)); bannerPainter.paint(canvas, const Size(1000.0, 1000.0));
Invocation translateCommand = canvas.invocations.firstWhere((Invocation invocation) { Invocation translateCommand = canvas.invocations.firstWhere((Invocation invocation) {
return invocation.memberName == #translate; return invocation.memberName == #translate;
...@@ -70,14 +70,14 @@ void main() { ...@@ -70,14 +70,14 @@ void main() {
}); });
test('A Banner with a location of bottomLeft paints in the bottom left', () { test('A Banner with a location of bottomLeft paints in the bottom left', () {
BannerPainter bannerPainter = new BannerPainter( BannerPainter bannerPainter = const BannerPainter(
message:"foo", message:"foo",
location: BannerLocation.bottomLeft location: BannerLocation.bottomLeft
); );
TestCanvas canvas = new TestCanvas(); TestCanvas canvas = new TestCanvas();
bannerPainter.paint(canvas, new Size(1000.0, 1000.0)); bannerPainter.paint(canvas, const Size(1000.0, 1000.0));
Invocation translateCommand = canvas.invocations.firstWhere((Invocation invocation) { Invocation translateCommand = canvas.invocations.firstWhere((Invocation invocation) {
return invocation.memberName == #translate; return invocation.memberName == #translate;
...@@ -96,14 +96,14 @@ void main() { ...@@ -96,14 +96,14 @@ void main() {
}); });
test('A Banner with a location of bottomRight paints in the bottom right', () { test('A Banner with a location of bottomRight paints in the bottom right', () {
BannerPainter bannerPainter = new BannerPainter( BannerPainter bannerPainter = const BannerPainter(
message:"foo", message:"foo",
location: BannerLocation.bottomRight location: BannerLocation.bottomRight
); );
TestCanvas canvas = new TestCanvas(); TestCanvas canvas = new TestCanvas();
bannerPainter.paint(canvas, new Size(1000.0, 1000.0)); bannerPainter.paint(canvas, const Size(1000.0, 1000.0));
Invocation translateCommand = canvas.invocations.firstWhere((Invocation invocation) { Invocation translateCommand = canvas.invocations.firstWhere((Invocation invocation) {
return invocation.memberName == #translate; return invocation.memberName == #translate;
......
...@@ -74,8 +74,8 @@ void main() { ...@@ -74,8 +74,8 @@ void main() {
onTap: () { ++first; }, onTap: () { ++first; },
child: new Container( child: new Container(
height: 2000.0, // more than 600, the height of the test area height: 2000.0, // more than 600, the height of the test area
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFF00FF00) backgroundColor: const Color(0xFF00FF00)
) )
) )
), ),
...@@ -83,8 +83,8 @@ void main() { ...@@ -83,8 +83,8 @@ void main() {
onTap: () { ++second; }, onTap: () { ++second; },
child: new Container( child: new Container(
height: 2000.0, // more than 600, the height of the test area height: 2000.0, // more than 600, the height of the test area
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFF0000FF) backgroundColor: const Color(0xFF0000FF)
) )
) )
) )
......
...@@ -32,7 +32,7 @@ void main() { ...@@ -32,7 +32,7 @@ void main() {
}); });
await tester.pump(); // bottom sheet show animation starts await tester.pump(); // bottom sheet show animation starts
await tester.pump(new Duration(seconds: 1)); // animation done await tester.pump(const Duration(seconds: 1)); // animation done
expect(find.text('BottomSheet'), findsOneWidget); expect(find.text('BottomSheet'), findsOneWidget);
expect(showBottomSheetThenCalled, isFalse); expect(showBottomSheetThenCalled, isFalse);
...@@ -40,8 +40,8 @@ void main() { ...@@ -40,8 +40,8 @@ void main() {
await tester.tap(find.text('BottomSheet')); await tester.tap(find.text('BottomSheet'));
await tester.pump(); // bottom sheet dismiss animation starts await tester.pump(); // bottom sheet dismiss animation starts
expect(showBottomSheetThenCalled, isTrue); expect(showBottomSheetThenCalled, isTrue);
await tester.pump(new Duration(seconds: 1)); // last frame of animation (sheet is entirely off-screen, but still present) await tester.pump(const Duration(seconds: 1)); // last frame of animation (sheet is entirely off-screen, but still present)
await tester.pump(new Duration(seconds: 1)); // frame after the animation (sheet has been removed) await tester.pump(const Duration(seconds: 1)); // frame after the animation (sheet has been removed)
expect(find.text('BottomSheet'), findsNothing); expect(find.text('BottomSheet'), findsNothing);
showBottomSheetThenCalled = false; showBottomSheetThenCalled = false;
...@@ -53,16 +53,16 @@ void main() { ...@@ -53,16 +53,16 @@ void main() {
showBottomSheetThenCalled = true; showBottomSheetThenCalled = true;
}); });
await tester.pump(); // bottom sheet show animation starts await tester.pump(); // bottom sheet show animation starts
await tester.pump(new Duration(seconds: 1)); // animation done await tester.pump(const Duration(seconds: 1)); // animation done
expect(find.text('BottomSheet'), findsOneWidget); expect(find.text('BottomSheet'), findsOneWidget);
expect(showBottomSheetThenCalled, isFalse); expect(showBottomSheetThenCalled, isFalse);
// Tap above the the bottom sheet to dismiss it // Tap above the the bottom sheet to dismiss it
await tester.tapAt(new Point(20.0, 20.0)); await tester.tapAt(const Point(20.0, 20.0));
await tester.pump(); // bottom sheet dismiss animation starts await tester.pump(); // bottom sheet dismiss animation starts
expect(showBottomSheetThenCalled, isTrue); expect(showBottomSheetThenCalled, isTrue);
await tester.pump(new Duration(seconds: 1)); // animation done await tester.pump(const Duration(seconds: 1)); // animation done
await tester.pump(new Duration(seconds: 1)); // rebuild frame await tester.pump(const Duration(seconds: 1)); // rebuild frame
expect(find.text('BottomSheet'), findsNothing); expect(find.text('BottomSheet'), findsNothing);
}); });
...@@ -82,7 +82,7 @@ void main() { ...@@ -82,7 +82,7 @@ void main() {
scaffoldKey.currentState.showBottomSheet((BuildContext context) { scaffoldKey.currentState.showBottomSheet((BuildContext context) {
return new Container( return new Container(
margin: new EdgeInsets.all(40.0), margin: const EdgeInsets.all(40.0),
child: new Text('BottomSheet') child: new Text('BottomSheet')
); );
}).closed.then((_) { }).closed.then((_) {
...@@ -97,7 +97,7 @@ void main() { ...@@ -97,7 +97,7 @@ void main() {
expect(showBottomSheetThenCalled, isFalse); expect(showBottomSheetThenCalled, isFalse);
expect(find.text('BottomSheet'), findsOneWidget); expect(find.text('BottomSheet'), findsOneWidget);
await tester.pump(new Duration(seconds: 1)); // animation done await tester.pump(const Duration(seconds: 1)); // animation done
expect(showBottomSheetThenCalled, isFalse); expect(showBottomSheetThenCalled, isFalse);
expect(find.text('BottomSheet'), findsOneWidget); expect(find.text('BottomSheet'), findsOneWidget);
...@@ -113,7 +113,7 @@ void main() { ...@@ -113,7 +113,7 @@ void main() {
expect(showBottomSheetThenCalled, isTrue); expect(showBottomSheetThenCalled, isTrue);
expect(find.text('BottomSheet'), findsOneWidget); expect(find.text('BottomSheet'), findsOneWidget);
await tester.pump(new Duration(seconds: 1)); // animation done await tester.pump(const Duration(seconds: 1)); // animation done
expect(showBottomSheetThenCalled, isTrue); expect(showBottomSheetThenCalled, isTrue);
expect(find.text('BottomSheet'), findsNothing); expect(find.text('BottomSheet'), findsNothing);
...@@ -132,19 +132,19 @@ void main() { ...@@ -132,19 +132,19 @@ void main() {
scaffoldKey.currentState.showBottomSheet((BuildContext context) { scaffoldKey.currentState.showBottomSheet((BuildContext context) {
return new Container( return new Container(
margin: new EdgeInsets.all(40.0), margin: const EdgeInsets.all(40.0),
child: new Text('BottomSheet') child: new Text('BottomSheet')
); );
}); });
await tester.pump(); // bottom sheet show animation starts await tester.pump(); // bottom sheet show animation starts
await tester.pump(new Duration(seconds: 1)); // animation done await tester.pump(const Duration(seconds: 1)); // animation done
expect(find.text('BottomSheet'), findsOneWidget); expect(find.text('BottomSheet'), findsOneWidget);
await tester.fling(find.text('BottomSheet'), const Offset(0.0, 400.0), 1000.0); await tester.fling(find.text('BottomSheet'), const Offset(0.0, 400.0), 1000.0);
await tester.pump(); // drain the microtask queue (Future completion callback) await tester.pump(); // drain the microtask queue (Future completion callback)
await tester.pump(); // bottom sheet dismiss animation starts await tester.pump(); // bottom sheet dismiss animation starts
await tester.pump(new Duration(seconds: 1)); // animation done await tester.pump(const Duration(seconds: 1)); // animation done
expect(find.text('BottomSheet'), findsNothing); expect(find.text('BottomSheet'), findsNothing);
}); });
......
...@@ -10,7 +10,7 @@ void main() { ...@@ -10,7 +10,7 @@ void main() {
testWidgets('Circles can have uniform borders', (WidgetTester tester) async { testWidgets('Circles can have uniform borders', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
new Container( new Container(
padding: new EdgeInsets.all(50.0), padding: const EdgeInsets.all(50.0),
decoration: new BoxDecoration( decoration: new BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
border: new Border.all(width: 10.0, color: const Color(0x80FF00FF)), border: new Border.all(width: 10.0, color: const Color(0x80FF00FF)),
......
...@@ -49,11 +49,11 @@ void main() { ...@@ -49,11 +49,11 @@ void main() {
); );
expect(log, equals(<String>['getClip'])); expect(log, equals(<String>['getClip']));
await tester.tapAt(new Point(10.0, 10.0)); await tester.tapAt(const Point(10.0, 10.0));
expect(log, equals(<String>['getClip'])); expect(log, equals(<String>['getClip']));
log.clear(); log.clear();
await tester.tapAt(new Point(100.0, 100.0)); await tester.tapAt(const Point(100.0, 100.0));
expect(log, equals(<String>['tap'])); expect(log, equals(<String>['tap']));
log.clear(); log.clear();
}); });
...@@ -69,11 +69,11 @@ void main() { ...@@ -69,11 +69,11 @@ void main() {
); );
expect(log, equals(<String>[])); expect(log, equals(<String>[]));
await tester.tapAt(new Point(10.0, 10.0)); await tester.tapAt(const Point(10.0, 10.0));
expect(log, equals(<String>[])); expect(log, equals(<String>[]));
log.clear(); log.clear();
await tester.tapAt(new Point(400.0, 300.0)); await tester.tapAt(const Point(400.0, 300.0));
expect(log, equals(<String>['tap'])); expect(log, equals(<String>['tap']));
log.clear(); log.clear();
}); });
...@@ -92,11 +92,11 @@ void main() { ...@@ -92,11 +92,11 @@ void main() {
); );
expect(log, equals(<String>[])); expect(log, equals(<String>[]));
await tester.tapAt(new Point(10.0, 10.0)); await tester.tapAt(const Point(10.0, 10.0));
expect(log, equals(<String>[])); expect(log, equals(<String>[]));
log.clear(); log.clear();
await tester.tapAt(new Point(400.0, 300.0)); await tester.tapAt(const Point(400.0, 300.0));
expect(log, equals(<String>['tap'])); expect(log, equals(<String>['tap']));
log.clear(); log.clear();
}); });
...@@ -120,10 +120,10 @@ void main() { ...@@ -120,10 +120,10 @@ void main() {
); );
expect(log, equals(<String>['a'])); expect(log, equals(<String>['a']));
await tester.tapAt(new Point(10.0, 10.0)); await tester.tapAt(const Point(10.0, 10.0));
expect(log, equals(<String>['a', 'tap'])); expect(log, equals(<String>['a', 'tap']));
await tester.tapAt(new Point(100.0, 100.0)); await tester.tapAt(const Point(100.0, 100.0));
expect(log, equals(<String>['a', 'tap'])); expect(log, equals(<String>['a', 'tap']));
await tester.pumpWidget( await tester.pumpWidget(
...@@ -216,10 +216,10 @@ void main() { ...@@ -216,10 +216,10 @@ void main() {
); );
expect(log, equals(<String>['a', 'tap', 'a', 'b', 'c'])); expect(log, equals(<String>['a', 'tap', 'a', 'b', 'c']));
await tester.tapAt(new Point(30.0, 30.0)); await tester.tapAt(const Point(30.0, 30.0));
expect(log, equals(<String>['a', 'tap', 'a', 'b', 'c', 'tap'])); expect(log, equals(<String>['a', 'tap', 'a', 'b', 'c', 'tap']));
await tester.tapAt(new Point(100.0, 100.0)); await tester.tapAt(const Point(100.0, 100.0));
expect(log, equals(<String>['a', 'tap', 'a', 'b', 'c', 'tap'])); expect(log, equals(<String>['a', 'tap', 'a', 'b', 'c', 'tap']));
}); });
......
...@@ -13,7 +13,7 @@ class TestMultiChildLayoutDelegate extends MultiChildLayoutDelegate { ...@@ -13,7 +13,7 @@ class TestMultiChildLayoutDelegate extends MultiChildLayoutDelegate {
Size getSize(BoxConstraints constraints) { Size getSize(BoxConstraints constraints) {
if (!RenderObject.debugCheckingIntrinsics) if (!RenderObject.debugCheckingIntrinsics)
getSizeConstraints = constraints; getSizeConstraints = constraints;
return new Size(200.0, 300.0); return const Size(200.0, 300.0);
} }
Size performLayoutSize; Size performLayoutSize;
...@@ -143,7 +143,7 @@ void main() { ...@@ -143,7 +143,7 @@ void main() {
await tester.pumpWidget(new Center( await tester.pumpWidget(new Center(
child: new CustomMultiChildLayout( child: new CustomMultiChildLayout(
key: key, key: key,
delegate: new PreferredSizeDelegate(preferredSize: new Size(300.0, 200.0)) delegate: new PreferredSizeDelegate(preferredSize: const Size(300.0, 200.0))
) )
)); ));
...@@ -154,7 +154,7 @@ void main() { ...@@ -154,7 +154,7 @@ void main() {
await tester.pumpWidget(new Center( await tester.pumpWidget(new Center(
child: new CustomMultiChildLayout( child: new CustomMultiChildLayout(
key: key, key: key,
delegate: new PreferredSizeDelegate(preferredSize: new Size(350.0, 250.0)) delegate: new PreferredSizeDelegate(preferredSize: const Size(350.0, 250.0))
) )
)); ));
......
...@@ -16,14 +16,14 @@ class TestSingleChildLayoutDelegate extends SingleChildLayoutDelegate { ...@@ -16,14 +16,14 @@ class TestSingleChildLayoutDelegate extends SingleChildLayoutDelegate {
Size getSize(BoxConstraints constraints) { Size getSize(BoxConstraints constraints) {
if (!RenderObject.debugCheckingIntrinsics) if (!RenderObject.debugCheckingIntrinsics)
constraintsFromGetSize = constraints; constraintsFromGetSize = constraints;
return new Size(200.0, 300.0); return const Size(200.0, 300.0);
} }
@override @override
BoxConstraints getConstraintsForChild(BoxConstraints constraints) { BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
assert(!RenderObject.debugCheckingIntrinsics); assert(!RenderObject.debugCheckingIntrinsics);
constraintsFromGetConstraintsForChild = constraints; constraintsFromGetConstraintsForChild = constraints;
return new BoxConstraints( return const BoxConstraints(
minWidth: 100.0, minWidth: 100.0,
maxWidth: 150.0, maxWidth: 150.0,
minHeight: 200.0, minHeight: 200.0,
......
...@@ -243,7 +243,7 @@ void main() { ...@@ -243,7 +243,7 @@ void main() {
await tester.pumpWidget(widgetBuilder()); await tester.pumpWidget(widgetBuilder());
Point location = tester.getTopLeft(find.text('0')); Point location = tester.getTopLeft(find.text('0'));
Offset offset = new Offset(0.0, 5.0); Offset offset = const Offset(0.0, 5.0);
TestGesture gesture = await tester.startGesture(location, pointer: 5); TestGesture gesture = await tester.startGesture(location, pointer: 5);
await gesture.moveBy(offset); await gesture.moveBy(offset);
await tester.pumpWidget(widgetBuilder()); await tester.pumpWidget(widgetBuilder());
...@@ -279,12 +279,12 @@ void main() { ...@@ -279,12 +279,12 @@ void main() {
expect(find.text('2'), findsOneWidget); expect(find.text('2'), findsOneWidget);
await dismissElement(tester, find.text('2'), gestureDirection: DismissDirection.startToEnd); await dismissElement(tester, find.text('2'), gestureDirection: DismissDirection.startToEnd);
await tester.pump(); // start the slide away await tester.pump(); // start the slide away
await tester.pump(new Duration(seconds: 1)); // finish the slide away await tester.pump(const Duration(seconds: 1)); // finish the slide away
expect(find.text('1'), findsOneWidget); expect(find.text('1'), findsOneWidget);
expect(find.text('2'), findsNothing); expect(find.text('2'), findsNothing);
await dismissElement(tester, find.text('1'), gestureDirection: DismissDirection.startToEnd); await dismissElement(tester, find.text('1'), gestureDirection: DismissDirection.startToEnd);
await tester.pump(); // start the slide away await tester.pump(); // start the slide away
await tester.pump(new Duration(seconds: 1)); // finish the slide away (at which point the child is no longer included in the tree) await tester.pump(const Duration(seconds: 1)); // finish the slide away (at which point the child is no longer included in the tree)
expect(find.text('1'), findsNothing); expect(find.text('1'), findsNothing);
expect(find.text('2'), findsNothing); expect(find.text('2'), findsNothing);
}); });
......
...@@ -690,7 +690,7 @@ void main() { ...@@ -690,7 +690,7 @@ void main() {
expect(onDraggableCanceledCalled, isFalse); expect(onDraggableCanceledCalled, isFalse);
Point flingStart = tester.getTopLeft(find.text('Source')); Point flingStart = tester.getTopLeft(find.text('Source'));
await tester.flingFrom(flingStart, new Offset(0.0, 100.0), 1000.0); await tester.flingFrom(flingStart, const Offset(0.0, 100.0), 1000.0);
await tester.pump(); await tester.pump();
expect(accepted, isEmpty); expect(accepted, isEmpty);
...@@ -700,7 +700,7 @@ void main() { ...@@ -700,7 +700,7 @@ void main() {
expect(onDraggableCanceledCalled, isTrue); expect(onDraggableCanceledCalled, isTrue);
expect(onDraggableCanceledVelocity.pixelsPerSecond.dx.abs(), lessThan(0.0000001)); expect(onDraggableCanceledVelocity.pixelsPerSecond.dx.abs(), lessThan(0.0000001));
expect((onDraggableCanceledVelocity.pixelsPerSecond.dy - 1000.0).abs(), lessThan(0.0000001)); expect((onDraggableCanceledVelocity.pixelsPerSecond.dy - 1000.0).abs(), lessThan(0.0000001));
expect(onDraggableCanceledOffset, equals(new Offset(flingStart.x, flingStart.y) + new Offset(0.0, 100.0))); expect(onDraggableCanceledOffset, equals(new Offset(flingStart.x, flingStart.y) + const Offset(0.0, 100.0)));
}); });
testWidgets('Drag and drop - allow pass thru of unaccepted data test', (WidgetTester tester) async { testWidgets('Drag and drop - allow pass thru of unaccepted data test', (WidgetTester tester) async {
...@@ -1007,15 +1007,15 @@ void main() { ...@@ -1007,15 +1007,15 @@ void main() {
}, },
child: new Draggable<dynamic>( child: new Draggable<dynamic>(
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFFFFFF00) backgroundColor: const Color(0xFFFFFF00)
) )
), ),
feedback: new Container( feedback: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFFFF0000) backgroundColor: const Color(0xFFFF0000)
) )
) )
) )
...@@ -1042,15 +1042,15 @@ void main() { ...@@ -1042,15 +1042,15 @@ void main() {
onTap: () { /* registers a tap recognizer */ }, onTap: () { /* registers a tap recognizer */ },
child: new Draggable<dynamic>( child: new Draggable<dynamic>(
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFFFFFF00) backgroundColor: const Color(0xFFFFFF00)
) )
), ),
feedback: new Container( feedback: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFFFF0000) backgroundColor: const Color(0xFFFF0000)
) )
) )
) )
...@@ -1062,7 +1062,7 @@ void main() { ...@@ -1062,7 +1062,7 @@ void main() {
TestGesture firstGesture = await tester.startGesture(const Point(10.0, 10.0), pointer: 24); TestGesture firstGesture = await tester.startGesture(const Point(10.0, 10.0), pointer: 24);
TestGesture secondGesture = await tester.startGesture(const Point(10.0, 20.0), pointer: 25); TestGesture secondGesture = await tester.startGesture(const Point(10.0, 20.0), pointer: 25);
await firstGesture.moveBy(new Offset(100.0, 0.0)); await firstGesture.moveBy(const Offset(100.0, 0.0));
await secondGesture.up(); await secondGesture.up();
}); });
......
...@@ -30,12 +30,12 @@ void main() { ...@@ -30,12 +30,12 @@ void main() {
scaffoldKey.currentState.openDrawer(); scaffoldKey.currentState.openDrawer();
await tester.pump(); // drawer should be starting to animate in await tester.pump(); // drawer should be starting to animate in
expect(find.text('drawer'), findsOneWidget); expect(find.text('drawer'), findsOneWidget);
await tester.pump(new Duration(seconds: 1)); // animation done await tester.pump(const Duration(seconds: 1)); // animation done
expect(find.text('drawer'), findsOneWidget); expect(find.text('drawer'), findsOneWidget);
Navigator.pop(savedContext); Navigator.pop(savedContext);
await tester.pump(); // drawer should be starting to animate away await tester.pump(); // drawer should be starting to animate away
expect(find.text('drawer'), findsOneWidget); expect(find.text('drawer'), findsOneWidget);
await tester.pump(new Duration(seconds: 1)); // animation done await tester.pump(const Duration(seconds: 1)); // animation done
expect(find.text('drawer'), findsNothing); expect(find.text('drawer'), findsNothing);
}); });
...@@ -55,19 +55,19 @@ void main() { ...@@ -55,19 +55,19 @@ void main() {
scaffoldKey.currentState.openDrawer(); scaffoldKey.currentState.openDrawer();
await tester.pump(); // drawer should be starting to animate in await tester.pump(); // drawer should be starting to animate in
expect(find.text('drawer'), findsOneWidget); expect(find.text('drawer'), findsOneWidget);
await tester.pump(new Duration(seconds: 1)); // animation done await tester.pump(const Duration(seconds: 1)); // animation done
expect(find.text('drawer'), findsOneWidget); expect(find.text('drawer'), findsOneWidget);
await tester.tap(find.text('drawer')); await tester.tap(find.text('drawer'));
await tester.pump(); // nothing should have happened await tester.pump(); // nothing should have happened
expect(find.text('drawer'), findsOneWidget); expect(find.text('drawer'), findsOneWidget);
await tester.pump(new Duration(seconds: 1)); // ditto await tester.pump(const Duration(seconds: 1)); // ditto
expect(find.text('drawer'), findsOneWidget); expect(find.text('drawer'), findsOneWidget);
await tester.tapAt(const Point(750.0, 100.0)); // on the mask await tester.tapAt(const Point(750.0, 100.0)); // on the mask
await tester.pump(); await tester.pump();
await tester.pump(new Duration(milliseconds: 10)); await tester.pump(const Duration(milliseconds: 10));
// drawer should be starting to animate away // drawer should be starting to animate away
expect(find.text('drawer'), findsOneWidget); expect(find.text('drawer'), findsOneWidget);
await tester.pump(new Duration(seconds: 1)); // animation done await tester.pump(const Duration(seconds: 1)); // animation done
expect(find.text('drawer'), findsNothing); expect(find.text('drawer'), findsNothing);
}); });
...@@ -98,27 +98,27 @@ void main() { ...@@ -98,27 +98,27 @@ void main() {
scaffoldKey.currentState.openDrawer(); scaffoldKey.currentState.openDrawer();
await tester.pump(); // drawer should be starting to animate in await tester.pump(); // drawer should be starting to animate in
expect(find.text('drawer'), findsOneWidget); expect(find.text('drawer'), findsOneWidget);
await tester.pump(new Duration(seconds: 1)); // animation done await tester.pump(const Duration(seconds: 1)); // animation done
expect(find.text('drawer'), findsOneWidget); expect(find.text('drawer'), findsOneWidget);
await tester.tapAt(const Point(750.0, 100.0)); // on the mask await tester.tapAt(const Point(750.0, 100.0)); // on the mask
await tester.pump(); await tester.pump();
await tester.pump(new Duration(milliseconds: 10)); await tester.pump(const Duration(milliseconds: 10));
// drawer should be starting to animate away // drawer should be starting to animate away
RenderBox textBox = tester.renderObject(find.text('drawer')); RenderBox textBox = tester.renderObject(find.text('drawer'));
double textLeft = textBox.localToGlobal(Point.origin).x; double textLeft = textBox.localToGlobal(Point.origin).x;
expect(textLeft, lessThan(0.0)); expect(textLeft, lessThan(0.0));
TestGesture gesture = await tester.startGesture(new Point(100.0, 100.0)); TestGesture gesture = await tester.startGesture(const Point(100.0, 100.0));
// drawer should be stopped. // drawer should be stopped.
await tester.pump(); await tester.pump();
await tester.pump(new Duration(milliseconds: 10)); await tester.pump(const Duration(milliseconds: 10));
expect(textBox.localToGlobal(Point.origin).x, equals(textLeft)); expect(textBox.localToGlobal(Point.origin).x, equals(textLeft));
await gesture.moveBy(new Offset(0.0, -50.0)); await gesture.moveBy(const Offset(0.0, -50.0));
// drawer should be returning to visible // drawer should be returning to visible
await tester.pump(); await tester.pump();
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(textBox.localToGlobal(Point.origin).x, equals(0.0)); expect(textBox.localToGlobal(Point.origin).x, equals(0.0));
await gesture.up(); await gesture.up();
...@@ -163,10 +163,10 @@ void main() { ...@@ -163,10 +163,10 @@ void main() {
expect(find.text('drawer'), findsOneWidget); expect(find.text('drawer'), findsOneWidget);
// Tap the close button to pop the drawer route. // Tap the close button to pop the drawer route.
await tester.pump(new Duration(milliseconds: 100)); await tester.pump(const Duration(milliseconds: 100));
await tester.tap(find.text('close')); await tester.tap(find.text('close'));
await tester.pump(); await tester.pump();
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(find.text('drawer'), findsNothing); expect(find.text('drawer'), findsNothing);
// Confirm that a button in the scaffold body is still clickable. // Confirm that a button in the scaffold body is still clickable.
......
...@@ -35,8 +35,8 @@ void main() { ...@@ -35,8 +35,8 @@ void main() {
expect(insideBox.size.width, 100.0); expect(insideBox.size.width, 100.0);
expect(insideBox.size.height, 50.0); expect(insideBox.size.height, 50.0);
Point insidePoint = insideBox.localToGlobal(new Point(100.0, 50.0)); Point insidePoint = insideBox.localToGlobal(const Point(100.0, 50.0));
Point outsidePoint = outsideBox.localToGlobal(new Point(200.0, 100.0)); Point outsidePoint = outsideBox.localToGlobal(const Point(200.0, 100.0));
expect(outsidePoint, equals(const Point(500.0, 350.0))); expect(outsidePoint, equals(const Point(500.0, 350.0)));
expect(insidePoint, equals(outsidePoint)); expect(insidePoint, equals(outsidePoint));
...@@ -71,8 +71,8 @@ void main() { ...@@ -71,8 +71,8 @@ void main() {
expect(insideBox.size.width, 100.0); expect(insideBox.size.width, 100.0);
expect(insideBox.size.height, 50.0); expect(insideBox.size.height, 50.0);
Point insidePoint = insideBox.localToGlobal(new Point(100.0, 0.0)); Point insidePoint = insideBox.localToGlobal(const Point(100.0, 0.0));
Point outsidePoint = outsideBox.localToGlobal(new Point(200.0, 50.0)); Point outsidePoint = outsideBox.localToGlobal(const Point(200.0, 50.0));
expect(insidePoint, equals(outsidePoint)); expect(insidePoint, equals(outsidePoint));
}); });
...@@ -107,8 +107,8 @@ void main() { ...@@ -107,8 +107,8 @@ void main() {
expect(insideBox.size.width, 100.0); expect(insideBox.size.width, 100.0);
expect(insideBox.size.height, 50.0); expect(insideBox.size.height, 50.0);
Point insidePoint = insideBox.localToGlobal(new Point(50.0, 25.0)); Point insidePoint = insideBox.localToGlobal(const Point(50.0, 25.0));
Point outsidePoint = outsideBox.localToGlobal(new Point(100.0, 100.0)); Point outsidePoint = outsideBox.localToGlobal(const Point(100.0, 100.0));
expect(insidePoint, equals(outsidePoint)); expect(insidePoint, equals(outsidePoint));
}); });
......
...@@ -76,14 +76,14 @@ void main() { ...@@ -76,14 +76,14 @@ void main() {
expect(log, equals(<int>[0, 1, 2])); expect(log, equals(<int>[0, 1, 2]));
log.clear(); log.clear();
await tester.tapAt(new Point(20.0, 90.0)); await tester.tapAt(const Point(20.0, 90.0));
expect(log, equals(<int>[1])); expect(log, equals(<int>[1]));
startOffset.value = 50.0; startOffset.value = 50.0;
await tester.pump(); await tester.pump();
log.clear(); log.clear();
await tester.tapAt(new Point(20.0, 90.0)); await tester.tapAt(const Point(20.0, 90.0));
expect(log, equals(<int>[0])); expect(log, equals(<int>[0]));
}); });
} }
...@@ -33,14 +33,14 @@ void main() { ...@@ -33,14 +33,14 @@ void main() {
expect(updatedDragDelta, isNull); expect(updatedDragDelta, isNull);
expect(didEndDrag, isFalse); expect(didEndDrag, isFalse);
Point firstLocation = new Point(10.0, 10.0); Point firstLocation = const Point(10.0, 10.0);
TestGesture gesture = await tester.startGesture(firstLocation, pointer: 7); TestGesture gesture = await tester.startGesture(firstLocation, pointer: 7);
expect(didStartDrag, isTrue); expect(didStartDrag, isTrue);
didStartDrag = false; didStartDrag = false;
expect(updatedDragDelta, isNull); expect(updatedDragDelta, isNull);
expect(didEndDrag, isFalse); expect(didEndDrag, isFalse);
Point secondLocation = new Point(10.0, 9.0); Point secondLocation = const Point(10.0, 9.0);
await gesture.moveTo(secondLocation); await gesture.moveTo(secondLocation);
expect(didStartDrag, isFalse); expect(didStartDrag, isFalse);
expect(updatedDragDelta, -1.0); expect(updatedDragDelta, -1.0);
...@@ -60,8 +60,8 @@ void main() { ...@@ -60,8 +60,8 @@ void main() {
int gestureCount = 0; int gestureCount = 0;
double dragDistance = 0.0; double dragDistance = 0.0;
Point downLocation = new Point(10.0, 10.0); Point downLocation = const Point(10.0, 10.0);
Point upLocation = new Point(10.0, 20.0); Point upLocation = const Point(10.0, 20.0);
Widget widget = new GestureDetector( Widget widget = new GestureDetector(
onVerticalDragUpdate: (DragUpdateDetails details) { dragDistance += details.primaryDelta; }, onVerticalDragUpdate: (DragUpdateDetails details) { dragDistance += details.primaryDelta; },
...@@ -118,7 +118,7 @@ void main() { ...@@ -118,7 +118,7 @@ void main() {
expect(panDelta, isNull); expect(panDelta, isNull);
expect(didEndPan, isFalse); expect(didEndPan, isFalse);
await tester.scrollAt(new Point(10.0, 10.0), new Offset(20.0, 30.0)); await tester.scrollAt(const Point(10.0, 10.0), const Offset(20.0, 30.0));
expect(didStartPan, isTrue); expect(didStartPan, isTrue);
expect(panDelta.dx, 20.0); expect(panDelta.dx, 20.0);
...@@ -164,28 +164,28 @@ void main() { ...@@ -164,28 +164,28 @@ void main() {
didReceivePointerDown = false; didReceivePointerDown = false;
didTap = false; didTap = false;
await pumpWidgetTree(null); await pumpWidgetTree(null);
await tester.tapAt(new Point(10.0, 10.0)); await tester.tapAt(const Point(10.0, 10.0));
expect(didReceivePointerDown, isTrue); expect(didReceivePointerDown, isTrue);
expect(didTap, isTrue); expect(didTap, isTrue);
didReceivePointerDown = false; didReceivePointerDown = false;
didTap = false; didTap = false;
await pumpWidgetTree(HitTestBehavior.deferToChild); await pumpWidgetTree(HitTestBehavior.deferToChild);
await tester.tapAt(new Point(10.0, 10.0)); await tester.tapAt(const Point(10.0, 10.0));
expect(didReceivePointerDown, isTrue); expect(didReceivePointerDown, isTrue);
expect(didTap, isFalse); expect(didTap, isFalse);
didReceivePointerDown = false; didReceivePointerDown = false;
didTap = false; didTap = false;
await pumpWidgetTree(HitTestBehavior.opaque); await pumpWidgetTree(HitTestBehavior.opaque);
await tester.tapAt(new Point(10.0, 10.0)); await tester.tapAt(const Point(10.0, 10.0));
expect(didReceivePointerDown, isFalse); expect(didReceivePointerDown, isFalse);
expect(didTap, isTrue); expect(didTap, isTrue);
didReceivePointerDown = false; didReceivePointerDown = false;
didTap = false; didTap = false;
await pumpWidgetTree(HitTestBehavior.translucent); await pumpWidgetTree(HitTestBehavior.translucent);
await tester.tapAt(new Point(10.0, 10.0)); await tester.tapAt(const Point(10.0, 10.0));
expect(didReceivePointerDown, isTrue); expect(didReceivePointerDown, isTrue);
expect(didTap, isTrue); expect(didTap, isTrue);
...@@ -203,7 +203,7 @@ void main() { ...@@ -203,7 +203,7 @@ void main() {
) )
); );
expect(didTap, isFalse); expect(didTap, isFalse);
await tester.tapAt(new Point(10.0, 10.0)); await tester.tapAt(const Point(10.0, 10.0));
expect(didTap, isTrue); expect(didTap, isTrue);
}); });
...@@ -220,7 +220,7 @@ void main() { ...@@ -220,7 +220,7 @@ void main() {
) )
); );
expect(didTap, isFalse); expect(didTap, isFalse);
await tester.tapAt(new Point(10.0, 10.0)); await tester.tapAt(const Point(10.0, 10.0));
expect(didTap, isFalse); expect(didTap, isFalse);
}); });
} }
...@@ -91,7 +91,7 @@ void main() { ...@@ -91,7 +91,7 @@ void main() {
expect(find.byKey(secondKey), isOnstage); expect(find.byKey(secondKey), isOnstage);
expect(find.byKey(secondKey), isNotInCard); expect(find.byKey(secondKey), isNotInCard);
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
// t=1.032s for the journey. The journey has ended (it ends this frame, in // t=1.032s for the journey. The journey has ended (it ends this frame, in
// fact). The hero should now be in the new page, onstage. The original // fact). The hero should now be in the new page, onstage. The original
...@@ -139,7 +139,7 @@ void main() { ...@@ -139,7 +139,7 @@ void main() {
expect(find.byKey(thirdKey), isOnstage); expect(find.byKey(thirdKey), isOnstage);
expect(find.byKey(thirdKey), isNotInCard); expect(find.byKey(thirdKey), isNotInCard);
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
// t=1.032s for the journey. The journey has ended (it ends this frame, in // t=1.032s for the journey. The journey has ended (it ends this frame, in
// fact). The hero should now be in the new page, onstage. // fact). The hero should now be in the new page, onstage.
...@@ -170,12 +170,12 @@ void main() { ...@@ -170,12 +170,12 @@ void main() {
)); ));
await tester.tap(find.text('two')); await tester.tap(find.text('two'));
await tester.pump(new Duration(milliseconds: 10)); await tester.pump(const Duration(milliseconds: 10));
route.markNeedsBuild(); route.markNeedsBuild();
await tester.pump(new Duration(milliseconds: 10)); await tester.pump(const Duration(milliseconds: 10));
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
}); });
testWidgets('Heroes animation is fastOutSlowIn', (WidgetTester tester) async { testWidgets('Heroes animation is fastOutSlowIn', (WidgetTester tester) async {
...@@ -271,18 +271,18 @@ void main() { ...@@ -271,18 +271,18 @@ void main() {
await tester.tap(find.text('foo', skipOffstage: false)); await tester.tap(find.text('foo', skipOffstage: false));
expect(log, isEmpty); expect(log, isEmpty);
await tester.pump(new Duration(milliseconds: 10)); await tester.pump(const Duration(milliseconds: 10));
await tester.tap(find.text('foo', skipOffstage: false)); await tester.tap(find.text('foo', skipOffstage: false));
expect(log, isEmpty); expect(log, isEmpty);
await tester.tap(find.text('bar', skipOffstage: false)); await tester.tap(find.text('bar', skipOffstage: false));
expect(log, isEmpty); expect(log, isEmpty);
await tester.pump(new Duration(milliseconds: 10)); await tester.pump(const Duration(milliseconds: 10));
expect(find.text('foo'), findsNothing); expect(find.text('foo'), findsNothing);
await tester.tap(find.text('bar', skipOffstage: false)); await tester.tap(find.text('bar', skipOffstage: false));
expect(log, isEmpty); expect(log, isEmpty);
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(find.text('foo'), findsNothing); expect(find.text('foo'), findsNothing);
await tester.tap(find.text('bar')); await tester.tap(find.text('bar'));
expect(log, equals(<String>['bar'])); expect(log, equals(<String>['bar']));
......
...@@ -32,7 +32,7 @@ void main() { ...@@ -32,7 +32,7 @@ void main() {
text: 'xxxxxxxx', text: 'xxxxxxxx',
recognizer: tapLeft recognizer: tapLeft
), ),
new TextSpan(text: 'yyyyyyyy'), const TextSpan(text: 'yyyyyyyy'),
new TextSpan( new TextSpan(
text: 'zzzzzzzzz', text: 'zzzzzzzzz',
recognizer: tapRight recognizer: tapRight
...@@ -48,21 +48,21 @@ void main() { ...@@ -48,21 +48,21 @@ void main() {
expect(didTapLeft, isFalse); expect(didTapLeft, isFalse);
expect(didTapRight, isFalse); expect(didTapRight, isFalse);
await tester.tapAt(box.localToGlobal(Point.origin) + new Offset(2.0, 2.0)); await tester.tapAt(box.localToGlobal(Point.origin) + const Offset(2.0, 2.0));
expect(didTapLeft, isTrue); expect(didTapLeft, isTrue);
expect(didTapRight, isFalse); expect(didTapRight, isFalse);
didTapLeft = false; didTapLeft = false;
await tester.tapAt(box.localToGlobal(Point.origin) + new Offset(30.0, 2.0)); await tester.tapAt(box.localToGlobal(Point.origin) + const Offset(30.0, 2.0));
expect(didTapLeft, isTrue); expect(didTapLeft, isTrue);
expect(didTapRight, isFalse); expect(didTapRight, isFalse);
didTapLeft = false; didTapLeft = false;
await tester.tapAt(box.localToGlobal(new Point(box.size.width, 0.0)) + new Offset(-2.0, 2.0)); await tester.tapAt(box.localToGlobal(new Point(box.size.width, 0.0)) + const Offset(-2.0, 2.0));
expect(didTapLeft, isFalse); expect(didTapLeft, isFalse);
expect(didTapRight, isTrue); expect(didTapRight, isTrue);
......
...@@ -175,13 +175,13 @@ void main() { ...@@ -175,13 +175,13 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new MediaQuery( new MediaQuery(
key: mediaQueryKey1, key: mediaQueryKey1,
data: new MediaQueryData( data: const MediaQueryData(
devicePixelRatio: 10.0, devicePixelRatio: 10.0,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
), ),
child: new MediaQuery( child: new MediaQuery(
key: mediaQueryKey2, key: mediaQueryKey2,
data: new MediaQueryData( data: const MediaQueryData(
devicePixelRatio: 5.0, devicePixelRatio: 5.0,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
), ),
...@@ -201,13 +201,13 @@ void main() { ...@@ -201,13 +201,13 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new MediaQuery( new MediaQuery(
key: mediaQueryKey2, key: mediaQueryKey2,
data: new MediaQueryData( data: const MediaQueryData(
devicePixelRatio: 5.0, devicePixelRatio: 5.0,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
), ),
child: new MediaQuery( child: new MediaQuery(
key: mediaQueryKey1, key: mediaQueryKey1,
data: new MediaQueryData( data: const MediaQueryData(
devicePixelRatio: 10.0, devicePixelRatio: 10.0,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
), ),
...@@ -235,7 +235,7 @@ void main() { ...@@ -235,7 +235,7 @@ void main() {
children: <Widget> [ children: <Widget> [
new MediaQuery( new MediaQuery(
key: mediaQueryKey2, key: mediaQueryKey2,
data: new MediaQueryData( data: const MediaQueryData(
devicePixelRatio: 5.0, devicePixelRatio: 5.0,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
), ),
...@@ -246,7 +246,7 @@ void main() { ...@@ -246,7 +246,7 @@ void main() {
), ),
new MediaQuery( new MediaQuery(
key: mediaQueryKey1, key: mediaQueryKey1,
data: new MediaQueryData( data: const MediaQueryData(
devicePixelRatio: 10.0, devicePixelRatio: 10.0,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
), ),
...@@ -263,7 +263,7 @@ void main() { ...@@ -263,7 +263,7 @@ void main() {
children: <Widget> [ children: <Widget> [
new MediaQuery( new MediaQuery(
key: mediaQueryKey2, key: mediaQueryKey2,
data: new MediaQueryData( data: const MediaQueryData(
devicePixelRatio: 5.0, devicePixelRatio: 5.0,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
), ),
...@@ -271,7 +271,7 @@ void main() { ...@@ -271,7 +271,7 @@ void main() {
), ),
new MediaQuery( new MediaQuery(
key: mediaQueryKey1, key: mediaQueryKey1,
data: new MediaQueryData( data: const MediaQueryData(
devicePixelRatio: 10.0, devicePixelRatio: 10.0,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
), ),
......
...@@ -8,8 +8,8 @@ import 'package:flutter/widgets.dart'; ...@@ -8,8 +8,8 @@ import 'package:flutter/widgets.dart';
void main() { void main() {
testWidgets('BoxConstraintsTween control test', (WidgetTester tester) async { testWidgets('BoxConstraintsTween control test', (WidgetTester tester) async {
BoxConstraintsTween tween = new BoxConstraintsTween( BoxConstraintsTween tween = new BoxConstraintsTween(
begin: new BoxConstraints.tight(new Size(20.0, 50.0)), begin: new BoxConstraints.tight(const Size(20.0, 50.0)),
end: new BoxConstraints.tight(new Size(10.0, 30.0)) end: new BoxConstraints.tight(const Size(10.0, 30.0))
); );
BoxConstraints result = tween.lerp(0.25); BoxConstraints result = tween.lerp(0.25);
expect(result.minWidth, 17.5); expect(result.minWidth, 17.5);
...@@ -20,17 +20,17 @@ void main() { ...@@ -20,17 +20,17 @@ void main() {
testWidgets('DecorationTween control test', (WidgetTester tester) async { testWidgets('DecorationTween control test', (WidgetTester tester) async {
DecorationTween tween = new DecorationTween( DecorationTween tween = new DecorationTween(
begin: new BoxDecoration(backgroundColor: new Color(0xFF00FF00)), begin: const BoxDecoration(backgroundColor: const Color(0xFF00FF00)),
end: new BoxDecoration(backgroundColor: new Color(0xFFFFFF00)) end: const BoxDecoration(backgroundColor: const Color(0xFFFFFF00))
); );
BoxDecoration result = tween.lerp(0.25); BoxDecoration result = tween.lerp(0.25);
expect(result.backgroundColor, new Color(0xFF3FFF00)); expect(result.backgroundColor, const Color(0xFF3FFF00));
}); });
testWidgets('EdgeInsetsTween control test', (WidgetTester tester) async { testWidgets('EdgeInsetsTween control test', (WidgetTester tester) async {
EdgeInsetsTween tween = new EdgeInsetsTween( EdgeInsetsTween tween = new EdgeInsetsTween(
begin: new EdgeInsets.symmetric(vertical: 50.0), begin: const EdgeInsets.symmetric(vertical: 50.0),
end: new EdgeInsets.only(top: 10.0, bottom: 30.0) end: const EdgeInsets.only(top: 10.0, bottom: 30.0)
); );
EdgeInsets result = tween.lerp(0.25); EdgeInsets result = tween.lerp(0.25);
expect(result.left, 0.0); expect(result.left, 0.0);
......
...@@ -9,7 +9,7 @@ import 'package:flutter/rendering.dart'; ...@@ -9,7 +9,7 @@ import 'package:flutter/rendering.dart';
const Size _kTestViewSize = const Size(800.0, 600.0); const Size _kTestViewSize = const Size(800.0, 600.0);
class OffscreenRenderView extends RenderView { class OffscreenRenderView extends RenderView {
OffscreenRenderView() : super(configuration: new ViewConfiguration(size: _kTestViewSize)); OffscreenRenderView() : super(configuration: const ViewConfiguration(size: _kTestViewSize));
@override @override
void compositeFrame() { void compositeFrame() {
......
...@@ -80,7 +80,7 @@ void main() { ...@@ -80,7 +80,7 @@ void main() {
List<TextSelectionPoint> endpoints = renderEditable.getEndpointsForSelection( List<TextSelectionPoint> endpoints = renderEditable.getEndpointsForSelection(
new TextSelection.collapsed(offset: offset)); new TextSelection.collapsed(offset: offset));
expect(endpoints.length, 1); expect(endpoints.length, 1);
return endpoints[0].point + new Offset(0.0, -2.0); return endpoints[0].point + const Offset(0.0, -2.0);
} }
testWidgets('Editable text has consistent size', (WidgetTester tester) async { testWidgets('Editable text has consistent size', (WidgetTester tester) async {
...@@ -164,7 +164,7 @@ void main() { ...@@ -164,7 +164,7 @@ void main() {
await checkCursorToggle(); await checkCursorToggle();
// Try the test again with a nonempty EditableText. // Try the test again with a nonempty EditableText.
updateEditingState(new TextEditingState( updateEditingState(const TextEditingState(
text: 'X', text: 'X',
selectionBase: 1, selectionBase: 1,
selectionExtent: 1, selectionExtent: 1,
...@@ -191,7 +191,7 @@ void main() { ...@@ -191,7 +191,7 @@ void main() {
await showKeyboard(tester); await showKeyboard(tester);
const String testValue = 'ABC'; const String testValue = 'ABC';
updateEditingState(new TextEditingState( updateEditingState(const TextEditingState(
text: testValue, text: testValue,
selectionBase: testValue.length, selectionBase: testValue.length,
selectionExtent: testValue.length, selectionExtent: testValue.length,
...@@ -298,7 +298,7 @@ void main() { ...@@ -298,7 +298,7 @@ void main() {
// Drag the right handle 2 letters to the right. // Drag the right handle 2 letters to the right.
// Note: use a small offset because the endpoint is on the very corner // Note: use a small offset because the endpoint is on the very corner
// of the handle. // of the handle.
Point handlePos = endpoints[1].point + new Offset(1.0, 1.0); Point handlePos = endpoints[1].point + const Offset(1.0, 1.0);
Point newHandlePos = textOffsetToPosition(tester, selection.extentOffset+2); Point newHandlePos = textOffsetToPosition(tester, selection.extentOffset+2);
gesture = await tester.startGesture(handlePos, pointer: 7); gesture = await tester.startGesture(handlePos, pointer: 7);
await tester.pump(); await tester.pump();
...@@ -311,7 +311,7 @@ void main() { ...@@ -311,7 +311,7 @@ void main() {
expect(inputValue.selection.extentOffset, selection.extentOffset+2); expect(inputValue.selection.extentOffset, selection.extentOffset+2);
// Drag the left handle 2 letters to the left. // Drag the left handle 2 letters to the left.
handlePos = endpoints[0].point + new Offset(-1.0, 1.0); handlePos = endpoints[0].point + const Offset(-1.0, 1.0);
newHandlePos = textOffsetToPosition(tester, selection.baseOffset-2); newHandlePos = textOffsetToPosition(tester, selection.baseOffset-2);
gesture = await tester.startGesture(handlePos, pointer: 7); gesture = await tester.startGesture(handlePos, pointer: 7);
await tester.pump(); await tester.pump();
...@@ -362,7 +362,7 @@ void main() { ...@@ -362,7 +362,7 @@ void main() {
RenderEditable renderEditable = findRenderEditable(tester); RenderEditable renderEditable = findRenderEditable(tester);
List<TextSelectionPoint> endpoints = renderEditable.getEndpointsForSelection( List<TextSelectionPoint> endpoints = renderEditable.getEndpointsForSelection(
inputValue.selection); inputValue.selection);
await tester.tapAt(endpoints[0].point + new Offset(1.0, 1.0)); await tester.tapAt(endpoints[0].point + const Offset(1.0, 1.0));
await tester.pumpWidget(builder()); await tester.pumpWidget(builder());
// SELECT ALL should select all the text. // SELECT ALL should select all the text.
...@@ -381,7 +381,7 @@ void main() { ...@@ -381,7 +381,7 @@ void main() {
await tester.pumpWidget(builder()); await tester.pumpWidget(builder());
renderEditable = findRenderEditable(tester); renderEditable = findRenderEditable(tester);
endpoints = renderEditable.getEndpointsForSelection(inputValue.selection); endpoints = renderEditable.getEndpointsForSelection(inputValue.selection);
await tester.tapAt(endpoints[0].point + new Offset(1.0, 1.0)); await tester.tapAt(endpoints[0].point + const Offset(1.0, 1.0));
await tester.pumpWidget(builder()); await tester.pumpWidget(builder());
// PASTE right before the 'e'. // PASTE right before the 'e'.
...@@ -428,7 +428,7 @@ void main() { ...@@ -428,7 +428,7 @@ void main() {
RenderEditable renderEditable = findRenderEditable(tester); RenderEditable renderEditable = findRenderEditable(tester);
List<TextSelectionPoint> endpoints = renderEditable.getEndpointsForSelection( List<TextSelectionPoint> endpoints = renderEditable.getEndpointsForSelection(
inputValue.selection); inputValue.selection);
await tester.tapAt(endpoints[0].point + new Offset(1.0, 1.0)); await tester.tapAt(endpoints[0].point + const Offset(1.0, 1.0));
await tester.pumpWidget(builder()); await tester.pumpWidget(builder());
// Toolbar should fade in. Starting at 0% opacity. // Toolbar should fade in. Starting at 0% opacity.
...@@ -563,7 +563,7 @@ void main() { ...@@ -563,7 +563,7 @@ void main() {
expect(endpoints.length, 2); expect(endpoints.length, 2);
// Drag the right handle to the third line, just after 'Third'. // Drag the right handle to the third line, just after 'Third'.
Point handlePos = endpoints[1].point + new Offset(1.0, 1.0); Point handlePos = endpoints[1].point + const Offset(1.0, 1.0);
Point newHandlePos = textOffsetToPosition(tester, testValue.indexOf('Third') + 5); Point newHandlePos = textOffsetToPosition(tester, testValue.indexOf('Third') + 5);
gesture = await tester.startGesture(handlePos, pointer: 7); gesture = await tester.startGesture(handlePos, pointer: 7);
await tester.pump(); await tester.pump();
...@@ -576,7 +576,7 @@ void main() { ...@@ -576,7 +576,7 @@ void main() {
expect(inputValue.selection.extentOffset, 108); expect(inputValue.selection.extentOffset, 108);
// Drag the left handle to the first line, just after 'First'. // Drag the left handle to the first line, just after 'First'.
handlePos = endpoints[0].point + new Offset(-1.0, 1.0); handlePos = endpoints[0].point + const Offset(-1.0, 1.0);
newHandlePos = textOffsetToPosition(tester, testValue.indexOf('First') + 5); newHandlePos = textOffsetToPosition(tester, testValue.indexOf('First') + 5);
gesture = await tester.startGesture(handlePos, pointer: 7); gesture = await tester.startGesture(handlePos, pointer: 7);
await tester.pump(); await tester.pump();
...@@ -642,11 +642,11 @@ void main() { ...@@ -642,11 +642,11 @@ void main() {
TestGesture gesture = await tester.startGesture(firstPos, pointer: 7); TestGesture gesture = await tester.startGesture(firstPos, pointer: 7);
await tester.pump(); await tester.pump();
await gesture.moveBy(new Offset(0.0, -1000.0)); await gesture.moveBy(const Offset(0.0, -1000.0));
await tester.pump(const Duration(seconds: 2)); await tester.pump(const Duration(seconds: 2));
// Wait and drag again to trigger https://github.com/flutter/flutter/issues/6329 // Wait and drag again to trigger https://github.com/flutter/flutter/issues/6329
// (No idea why this is necessary, but the bug wouldn't repro without it.) // (No idea why this is necessary, but the bug wouldn't repro without it.)
await gesture.moveBy(new Offset(0.0, -1000.0)); await gesture.moveBy(const Offset(0.0, -1000.0));
await tester.pump(const Duration(seconds: 2)); await tester.pump(const Duration(seconds: 2));
await gesture.up(); await gesture.up();
await tester.pump(); await tester.pump();
...@@ -674,11 +674,11 @@ void main() { ...@@ -674,11 +674,11 @@ void main() {
expect(endpoints.length, 2); expect(endpoints.length, 2);
// Drag the left handle to the first line, just after 'First'. // Drag the left handle to the first line, just after 'First'.
Point handlePos = endpoints[0].point + new Offset(-1.0, 1.0); Point handlePos = endpoints[0].point + const Offset(-1.0, 1.0);
Point newHandlePos = textOffsetToPosition(tester, kFourLines.indexOf('First') + 5); Point newHandlePos = textOffsetToPosition(tester, kFourLines.indexOf('First') + 5);
gesture = await tester.startGesture(handlePos, pointer: 7); gesture = await tester.startGesture(handlePos, pointer: 7);
await tester.pump(); await tester.pump();
await gesture.moveTo(newHandlePos + new Offset(0.0, -10.0)); await gesture.moveTo(newHandlePos + const Offset(0.0, -10.0));
await tester.pump(); await tester.pump();
await gesture.up(); await gesture.up();
await tester.pump(); await tester.pump();
......
...@@ -28,7 +28,7 @@ void main() { ...@@ -28,7 +28,7 @@ void main() {
await tester.pumpWidget(new Row(children: <Widget>[ await tester.pumpWidget(new Row(children: <Widget>[
new Wrapper( new Wrapper(
child: new LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) { child: new LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
return new SizedBox(); return const SizedBox();
}), }),
), ),
new Wrapper( new Wrapper(
...@@ -53,7 +53,7 @@ void main() { ...@@ -53,7 +53,7 @@ void main() {
new Wrapper( new Wrapper(
child: new Wrapper( child: new Wrapper(
child: new LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) { child: new LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
return new SizedBox(); return const SizedBox();
}) })
) )
), ),
......
...@@ -140,13 +140,13 @@ void main() { ...@@ -140,13 +140,13 @@ void main() {
expect(built, 0); expect(built, 0);
await tester.pumpWidget(new MediaQuery( await tester.pumpWidget(new MediaQuery(
data: new MediaQueryData(size: const Size(400.0, 300.0)), data: const MediaQueryData(size: const Size(400.0, 300.0)),
child: target child: target
)); ));
expect(built, 1); expect(built, 1);
await tester.pumpWidget(new MediaQuery( await tester.pumpWidget(new MediaQuery(
data: new MediaQueryData(size: const Size(300.0, 400.0)), data: const MediaQueryData(size: const Size(300.0, 400.0)),
child: target child: target
)); ));
expect(built, 1); expect(built, 1);
...@@ -164,13 +164,13 @@ void main() { ...@@ -164,13 +164,13 @@ void main() {
expect(built, 0); expect(built, 0);
await tester.pumpWidget(new MediaQuery( await tester.pumpWidget(new MediaQuery(
data: new MediaQueryData(size: const Size(400.0, 300.0)), data: const MediaQueryData(size: const Size(400.0, 300.0)),
child: target child: target
)); ));
expect(built, 1); expect(built, 1);
await tester.pumpWidget(new MediaQuery( await tester.pumpWidget(new MediaQuery(
data: new MediaQueryData(size: const Size(300.0, 400.0)), data: const MediaQueryData(size: const Size(300.0, 400.0)),
child: target child: target
)); ));
expect(built, 2); expect(built, 2);
......
...@@ -255,14 +255,14 @@ void main() { ...@@ -255,14 +255,14 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new LazyBlockViewport( new LazyBlockViewport(
padding: new EdgeInsets.fromLTRB(7.0, 3.0, 5.0, 11.0), padding: const EdgeInsets.fromLTRB(7.0, 3.0, 5.0, 11.0),
delegate: new LazyBlockBuilder(builder: itemBuilder) delegate: new LazyBlockBuilder(builder: itemBuilder)
) )
); );
RenderBox firstBox = tester.renderObject(find.text('0')); RenderBox firstBox = tester.renderObject(find.text('0'));
Point upperLeft = firstBox.localToGlobal(Point.origin); Point upperLeft = firstBox.localToGlobal(Point.origin);
expect(upperLeft, equals(new Point(7.0, 3.0))); expect(upperLeft, equals(const Point(7.0, 3.0)));
expect(firstBox.size.width, equals(800.0 - 12.0)); expect(firstBox.size.width, equals(800.0 - 12.0));
}); });
......
...@@ -13,8 +13,8 @@ class FirstWidget extends StatelessWidget { ...@@ -13,8 +13,8 @@ class FirstWidget extends StatelessWidget {
Navigator.pushNamed(context, '/second'); Navigator.pushNamed(context, '/second');
}, },
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFFFFFF00) backgroundColor: const Color(0xFFFFFF00)
), ),
child: new Text('X') child: new Text('X')
) )
...@@ -33,8 +33,8 @@ class SecondWidgetState extends State<SecondWidget> { ...@@ -33,8 +33,8 @@ class SecondWidgetState extends State<SecondWidget> {
return new GestureDetector( return new GestureDetector(
onTap: () => Navigator.pop(context), onTap: () => Navigator.pop(context),
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFFFF00FF) backgroundColor: const Color(0xFFFF00FF)
), ),
child: new Text('Y') child: new Text('Y')
) )
...@@ -127,7 +127,7 @@ void main() { ...@@ -127,7 +127,7 @@ void main() {
); );
await tester.pumpWidget(widget); await tester.pumpWidget(widget);
await tester.tap(find.byKey(targetKey)); await tester.tap(find.byKey(targetKey));
expect(exception, new isInstanceOf<FlutterError>()); expect(exception, const isInstanceOf<FlutterError>());
expect('$exception', startsWith('Navigator operation requested with a context')); expect('$exception', startsWith('Navigator operation requested with a context'));
}); });
......
...@@ -149,8 +149,8 @@ void main() { ...@@ -149,8 +149,8 @@ void main() {
expect(find.text('Settings'), isOnstage); expect(find.text('Settings'), isOnstage);
// Drag from left edge to invoke the gesture. // Drag from left edge to invoke the gesture.
TestGesture gesture = await tester.startGesture(new Point(5.0, 100.0)); TestGesture gesture = await tester.startGesture(const Point(5.0, 100.0));
await gesture.moveBy(new Offset(50.0, 0.0)); await gesture.moveBy(const Offset(50.0, 0.0));
await tester.pump(); await tester.pump();
// Home is now visible. // Home is now visible.
...@@ -180,8 +180,8 @@ void main() { ...@@ -180,8 +180,8 @@ void main() {
expect(find.text('Settings'), isOnstage); expect(find.text('Settings'), isOnstage);
// Drag from left edge to invoke the gesture. // Drag from left edge to invoke the gesture.
TestGesture gesture = await tester.startGesture(new Point(5.0, 100.0)); TestGesture gesture = await tester.startGesture(const Point(5.0, 100.0));
await gesture.moveBy(new Offset(50.0, 0.0)); await gesture.moveBy(const Offset(50.0, 0.0));
await tester.pump(); await tester.pump();
expect(find.text('Home'), findsNothing); expect(find.text('Home'), findsNothing);
...@@ -255,7 +255,7 @@ void main() { ...@@ -255,7 +255,7 @@ void main() {
'/': (_) => new Scaffold( '/': (_) => new Scaffold(
key: containerKey1, key: containerKey1,
body: new Container( body: new Container(
decoration: new BoxDecoration(backgroundColor: const Color(0xff00ffff)), decoration: const BoxDecoration(backgroundColor: const Color(0xff00ffff)),
child: new Hero( child: new Hero(
tag: kHeroTag, tag: kHeroTag,
child: new Text('Home') child: new Text('Home')
...@@ -266,7 +266,7 @@ void main() { ...@@ -266,7 +266,7 @@ void main() {
key: containerKey2, key: containerKey2,
body: new Container( body: new Container(
padding: const EdgeInsets.all(100.0), padding: const EdgeInsets.all(100.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xffff00ff)), decoration: const BoxDecoration(backgroundColor: const Color(0xffff00ff)),
child: new Hero( child: new Hero(
tag: kHeroTag, tag: kHeroTag,
child: new Text('Settings') child: new Text('Settings')
...@@ -300,8 +300,8 @@ void main() { ...@@ -300,8 +300,8 @@ void main() {
expect(find.text('Settings'), isOnstage); expect(find.text('Settings'), isOnstage);
// Drag from left edge to invoke the gesture. // Drag from left edge to invoke the gesture.
TestGesture gesture = await tester.startGesture(new Point(5.0, 100.0)); TestGesture gesture = await tester.startGesture(const Point(5.0, 100.0));
await gesture.moveBy(new Offset(50.0, 0.0)); await gesture.moveBy(const Offset(50.0, 0.0));
await tester.pump(); await tester.pump();
// Home is now visible. // Home is now visible.
...@@ -343,8 +343,8 @@ void main() { ...@@ -343,8 +343,8 @@ void main() {
// Drag from left edge to invoke the gesture. (near bottom so we grab // Drag from left edge to invoke the gesture. (near bottom so we grab
// the Settings page as it comes up). // the Settings page as it comes up).
TestGesture gesture = await tester.startGesture(new Point(5.0, 550.0)); TestGesture gesture = await tester.startGesture(const Point(5.0, 550.0));
await gesture.moveBy(new Offset(500.0, 0.0)); await gesture.moveBy(const Offset(500.0, 0.0));
await gesture.up(); await gesture.up();
await tester.pump(); await tester.pump();
await tester.pump(const Duration(milliseconds: 1000)); await tester.pump(const Duration(milliseconds: 1000));
...@@ -355,8 +355,8 @@ void main() { ...@@ -355,8 +355,8 @@ void main() {
expect(find.text('Settings'), isOnstage); expect(find.text('Settings'), isOnstage);
// Try again now that we're settled. // Try again now that we're settled.
gesture = await tester.startGesture(new Point(5.0, 550.0)); gesture = await tester.startGesture(const Point(5.0, 550.0));
await gesture.moveBy(new Offset(500.0, 0.0)); await gesture.moveBy(const Offset(500.0, 0.0));
await gesture.up(); await gesture.up();
await tester.pump(); await tester.pump();
await tester.pump(const Duration(milliseconds: 1000)); await tester.pump(const Duration(milliseconds: 1000));
...@@ -394,8 +394,8 @@ void main() { ...@@ -394,8 +394,8 @@ void main() {
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
// Drag from left edge to invoke the gesture. // Drag from left edge to invoke the gesture.
TestGesture gesture = await tester.startGesture(new Point(5.0, 100.0)); TestGesture gesture = await tester.startGesture(const Point(5.0, 100.0));
await gesture.moveBy(new Offset(500.0, 0.0)); await gesture.moveBy(const Offset(500.0, 0.0));
await gesture.up(); await gesture.up();
await tester.pump(); await tester.pump();
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
...@@ -416,7 +416,7 @@ void main() { ...@@ -416,7 +416,7 @@ void main() {
await tester.pumpWidget(new MaterialApp(routes: routes)); await tester.pumpWidget(new MaterialApp(routes: routes));
PageRoute<Null> route = new MaterialPageRoute<Null>( PageRoute<Null> route = new MaterialPageRoute<Null>(
settings: new RouteSettings(name: '/page'), settings: const RouteSettings(name: '/page'),
builder: (BuildContext context) => new Center(child: new Text('page')), builder: (BuildContext context) => new Center(child: new Text('page')),
); );
......
...@@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
Size pageSize = new Size(600.0, 300.0); Size pageSize = const Size(600.0, 300.0);
const List<int> defaultPages = const <int>[0, 1, 2, 3, 4, 5]; const List<int> defaultPages = const <int>[0, 1, 2, 3, 4, 5];
final List<GlobalKey> globalKeys = defaultPages.map((_) => new GlobalKey()).toList(); final List<GlobalKey> globalKeys = defaultPages.map((_) => new GlobalKey()).toList();
int currentPage; int currentPage;
......
...@@ -62,7 +62,7 @@ Future<Null> performTest(WidgetTester tester, bool maintainState) async { ...@@ -62,7 +62,7 @@ Future<Null> performTest(WidgetTester tester, bool maintainState) async {
Completer<Null> completer = new Completer<Null>(); Completer<Null> completer = new Completer<Null>();
tester.state/*<ScrollableState>*/(find.byType(Scrollable)).scrollTo(1000.0).whenComplete(completer.complete); tester.state/*<ScrollableState>*/(find.byType(Scrollable)).scrollTo(1000.0).whenComplete(completer.complete);
expect(completer.isCompleted, isFalse); expect(completer.isCompleted, isFalse);
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(completer.isCompleted, isTrue); expect(completer.isCompleted, isTrue);
// we're 600 pixels high, each item is 100 pixels high, scroll position is // we're 600 pixels high, each item is 100 pixels high, scroll position is
...@@ -82,7 +82,7 @@ Future<Null> performTest(WidgetTester tester, bool maintainState) async { ...@@ -82,7 +82,7 @@ Future<Null> performTest(WidgetTester tester, bool maintainState) async {
navigatorKey.currentState.pushNamed('/second'); navigatorKey.currentState.pushNamed('/second');
await tester.pump(); // navigating always takes two frames, one to start... await tester.pump(); // navigating always takes two frames, one to start...
await tester.pump(new Duration(seconds: 1)); // ...and one to end the transition await tester.pump(const Duration(seconds: 1)); // ...and one to end the transition
// the second list is now visible, starting at 10000 // the second list is now visible, starting at 10000
expect(find.text('10000'), findsOneWidget); expect(find.text('10000'), findsOneWidget);
...@@ -103,7 +103,7 @@ Future<Null> performTest(WidgetTester tester, bool maintainState) async { ...@@ -103,7 +103,7 @@ Future<Null> performTest(WidgetTester tester, bool maintainState) async {
LazyListViewport viewport = tester.firstWidget(find.byType(LazyListViewport)); LazyListViewport viewport = tester.firstWidget(find.byType(LazyListViewport));
expect(viewport.scrollOffset, equals(1000.0)); expect(viewport.scrollOffset, equals(1000.0));
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
// we're 600 pixels high, each item is 100 pixels high, scroll position is // we're 600 pixels high, each item is 100 pixels high, scroll position is
// 1000, so we should have exactly 6 items, 10..15. // 1000, so we should have exactly 6 items, 10..15.
......
...@@ -6,9 +6,9 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -6,9 +6,9 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
final BoxDecoration kBoxDecorationA = new BoxDecoration(); final BoxDecoration kBoxDecorationA = new BoxDecoration(); // ignore: prefer_const_constructor
final BoxDecoration kBoxDecorationB = new BoxDecoration(); final BoxDecoration kBoxDecorationB = new BoxDecoration(); // ignore: prefer_const_constructor
final BoxDecoration kBoxDecorationC = new BoxDecoration(); final BoxDecoration kBoxDecorationC = new BoxDecoration(); // ignore: prefer_const_constructor
class TestWidget extends StatelessWidget { class TestWidget extends StatelessWidget {
const TestWidget({ this.child }); const TestWidget({ this.child });
...@@ -26,9 +26,9 @@ class TestOrientedBox extends SingleChildRenderObjectWidget { ...@@ -26,9 +26,9 @@ class TestOrientedBox extends SingleChildRenderObjectWidget {
Orientation orientation = MediaQuery.of(context).orientation; Orientation orientation = MediaQuery.of(context).orientation;
switch (orientation) { switch (orientation) {
case Orientation.landscape: case Orientation.landscape:
return new BoxDecoration(backgroundColor: const Color(0xFF00FF00)); return const BoxDecoration(backgroundColor: const Color(0xFF00FF00));
case Orientation.portrait: case Orientation.portrait:
return new BoxDecoration(backgroundColor: const Color(0xFF0000FF)); return const BoxDecoration(backgroundColor: const Color(0xFF0000FF));
} }
assert(orientation != null); assert(orientation != null);
return null; return null;
...@@ -194,20 +194,20 @@ void main() { ...@@ -194,20 +194,20 @@ void main() {
TestOrientedBox box = new TestOrientedBox(key: boxKey); TestOrientedBox box = new TestOrientedBox(key: boxKey);
await tester.pumpWidget(new MediaQuery( await tester.pumpWidget(new MediaQuery(
data: new MediaQueryData(size: const Size(400.0, 300.0)), data: const MediaQueryData(size: const Size(400.0, 300.0)),
child: box child: box
)); ));
RenderDecoratedBox renderBox = tester.renderObject(find.byKey(boxKey)); RenderDecoratedBox renderBox = tester.renderObject(find.byKey(boxKey));
BoxDecoration decoration = renderBox.decoration; BoxDecoration decoration = renderBox.decoration;
expect(decoration.backgroundColor, equals(new Color(0xFF00FF00))); expect(decoration.backgroundColor, equals(const Color(0xFF00FF00)));
await tester.pumpWidget(new MediaQuery( await tester.pumpWidget(new MediaQuery(
data: new MediaQueryData(size: const Size(300.0, 400.0)), data: const MediaQueryData(size: const Size(300.0, 400.0)),
child: box child: box
)); ));
decoration = renderBox.decoration; decoration = renderBox.decoration;
expect(decoration.backgroundColor, equals(new Color(0xFF0000FF))); expect(decoration.backgroundColor, equals(const Color(0xFF0000FF)));
}); });
} }
...@@ -44,11 +44,11 @@ void main() { ...@@ -44,11 +44,11 @@ void main() {
expect(box.size.width, equals(65.0)); expect(box.size.width, equals(65.0));
expect(box.size.height, equals(175.0)); expect(box.size.height, equals(175.0));
await tester.tapAt(new Point(420.0, 280.0)); await tester.tapAt(const Point(420.0, 280.0));
expect(log, equals(<String>['left'])); expect(log, equals(<String>['left']));
log.clear(); log.clear();
await tester.tapAt(new Point(380.0, 320.0)); await tester.tapAt(const Point(380.0, 320.0));
expect(log, equals(<String>['right'])); expect(log, equals(<String>['right']));
log.clear(); log.clear();
}); });
......
...@@ -80,7 +80,7 @@ void main() { ...@@ -80,7 +80,7 @@ void main() {
expect(delegate, isNotNull); expect(delegate, isNotNull);
expect(delegate.flag, isTrue); expect(delegate.flag, isTrue);
expect(behavior, new isInstanceOf<BoundedBehavior>()); expect(behavior, const isInstanceOf<BoundedBehavior>());
expect(behavior.contentExtent, equals(1000.0)); expect(behavior.contentExtent, equals(1000.0));
expect(behavior.containerExtent, equals(600.0)); expect(behavior.containerExtent, equals(600.0));
...@@ -103,7 +103,7 @@ void main() { ...@@ -103,7 +103,7 @@ void main() {
expect(delegate, isNotNull); expect(delegate, isNotNull);
expect(delegate.flag, isFalse); expect(delegate.flag, isFalse);
expect(behavior, new isInstanceOf<UnboundedBehavior>()); expect(behavior, const isInstanceOf<UnboundedBehavior>());
// Regression test for https://github.com/flutter/flutter/issues/5856 // Regression test for https://github.com/flutter/flutter/issues/5856
expect(behavior.contentExtent, equals(1000.0)); expect(behavior.contentExtent, equals(1000.0));
expect(behavior.containerExtent, equals(600.0)); expect(behavior.containerExtent, equals(600.0));
......
...@@ -37,11 +37,11 @@ void main() { ...@@ -37,11 +37,11 @@ void main() {
await tester.pumpWidget(_buildScroller(log: log)); await tester.pumpWidget(_buildScroller(log: log));
expect(log, equals(<String>[])); expect(log, equals(<String>[]));
TestGesture gesture = await tester.startGesture(new Point(100.0, 100.0)); TestGesture gesture = await tester.startGesture(const Point(100.0, 100.0));
expect(log, equals(<String>['scrollstart'])); expect(log, equals(<String>['scrollstart']));
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(log, equals(<String>['scrollstart'])); expect(log, equals(<String>['scrollstart']));
await gesture.moveBy(new Offset(-10.0, -10.0)); await gesture.moveBy(const Offset(-10.0, -10.0));
expect(log, equals(<String>['scrollstart', 'scroll'])); expect(log, equals(<String>['scrollstart', 'scroll']));
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(log, equals(<String>['scrollstart', 'scroll'])); expect(log, equals(<String>['scrollstart', 'scroll']));
...@@ -138,15 +138,15 @@ void main() { ...@@ -138,15 +138,15 @@ void main() {
await tester.pumpWidget(_buildScroller(key: scrollKey, log: log)); await tester.pumpWidget(_buildScroller(key: scrollKey, log: log));
expect(log, equals(<String>[])); expect(log, equals(<String>[]));
await tester.flingFrom(new Point(100.0, 100.0), new Offset(-50.0, -50.0), 500.0); await tester.flingFrom(const Point(100.0, 100.0), const Offset(-50.0, -50.0), 500.0);
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
log.removeWhere((String value) => value == 'scroll'); log.removeWhere((String value) => value == 'scroll');
expect(log, equals(<String>['scrollstart'])); expect(log, equals(<String>['scrollstart']));
await tester.flingFrom(new Point(100.0, 100.0), new Offset(-50.0, -50.0), 500.0); await tester.flingFrom(const Point(100.0, 100.0), const Offset(-50.0, -50.0), 500.0);
log.removeWhere((String value) => value == 'scroll'); log.removeWhere((String value) => value == 'scroll');
expect(log, equals(<String>['scrollstart', 'scrollend', 'scrollstart'])); expect(log, equals(<String>['scrollstart', 'scrollend', 'scrollstart']));
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
log.removeWhere((String value) => value == 'scroll'); log.removeWhere((String value) => value == 'scroll');
expect(log, equals(<String>['scrollstart', 'scrollend', 'scrollstart', 'scrollend'])); expect(log, equals(<String>['scrollstart', 'scrollend', 'scrollstart', 'scrollend']));
}); });
...@@ -157,10 +157,10 @@ void main() { ...@@ -157,10 +157,10 @@ void main() {
await tester.pumpWidget(_buildScroller(key: scrollKey, log: log)); await tester.pumpWidget(_buildScroller(key: scrollKey, log: log));
expect(log, equals(<String>[])); expect(log, equals(<String>[]));
await tester.flingFrom(new Point(100.0, 100.0), new Offset(50.0, 50.0), 500.0); await tester.flingFrom(const Point(100.0, 100.0), const Offset(50.0, 50.0), 500.0);
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
await tester.pump(new Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(log.first, equals('scrollstart')); expect(log.first, equals('scrollstart'));
expect(log.last, equals('scrollend')); expect(log.last, equals('scrollend'));
log.removeWhere((String value) => value == 'scroll'); log.removeWhere((String value) => value == 'scroll');
......
...@@ -18,7 +18,7 @@ void main() { ...@@ -18,7 +18,7 @@ void main() {
expect(scrollable.scrollOffset, equals(0.0)); expect(scrollable.scrollOffset, equals(0.0));
await tester.flingFrom(new Point(200.0, 300.0), new Offset(0.0, -200.0), 500.0); await tester.flingFrom(const Point(200.0, 300.0), const Offset(0.0, -200.0), 500.0);
await tester.pump(); await tester.pump();
await tester.pump(const Duration(seconds: 5)); await tester.pump(const Duration(seconds: 5));
...@@ -26,7 +26,7 @@ void main() { ...@@ -26,7 +26,7 @@ void main() {
double oldOffset = scrollable.scrollOffset; double oldOffset = scrollable.scrollOffset;
await tester.flingFrom(new Point(200.0, 300.0), new Offset(0.0, -200.0), 500.0); await tester.flingFrom(const Point(200.0, 300.0), const Offset(0.0, -200.0), 500.0);
await tester.pump(); await tester.pump();
await tester.pump(const Duration(seconds: 5)); await tester.pump(const Duration(seconds: 5));
......
...@@ -15,27 +15,27 @@ void main() { ...@@ -15,27 +15,27 @@ void main() {
return false; return false;
}, },
child: new ScrollableViewport( child: new ScrollableViewport(
child: new SizedBox(height: 1200.0) child: const SizedBox(height: 1200.0)
) )
)); ));
TestGesture gesture = await tester.startGesture(new Point(100.0, 100.0)); TestGesture gesture = await tester.startGesture(const Point(100.0, 100.0));
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(notification.kind, equals(ScrollNotificationKind.started)); expect(notification.kind, equals(ScrollNotificationKind.started));
expect(notification.depth, equals(0)); expect(notification.depth, equals(0));
expect(notification.dragStartDetails, isNotNull); expect(notification.dragStartDetails, isNotNull);
expect(notification.dragStartDetails.globalPosition, equals(new Point(100.0, 100.0))); expect(notification.dragStartDetails.globalPosition, equals(const Point(100.0, 100.0)));
expect(notification.dragUpdateDetails, isNull); expect(notification.dragUpdateDetails, isNull);
expect(notification.dragEndDetails, isNull); expect(notification.dragEndDetails, isNull);
await gesture.moveBy(new Offset(-10.0, -10.0)); await gesture.moveBy(const Offset(-10.0, -10.0));
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(notification.kind, equals(ScrollNotificationKind.updated)); expect(notification.kind, equals(ScrollNotificationKind.updated));
expect(notification.depth, equals(0)); expect(notification.depth, equals(0));
expect(notification.dragStartDetails, isNull); expect(notification.dragStartDetails, isNull);
expect(notification.dragUpdateDetails, isNotNull); expect(notification.dragUpdateDetails, isNotNull);
expect(notification.dragUpdateDetails.globalPosition, equals(new Point(90.0, 90.0))); expect(notification.dragUpdateDetails.globalPosition, equals(const Point(90.0, 90.0)));
expect(notification.dragUpdateDetails.delta, equals(new Offset(0.0, -10.0))); expect(notification.dragUpdateDetails.delta, equals(const Offset(0.0, -10.0)));
expect(notification.dragEndDetails, isNull); expect(notification.dragEndDetails, isNull);
await gesture.up(); await gesture.up();
...@@ -71,16 +71,16 @@ void main() { ...@@ -71,16 +71,16 @@ void main() {
}, },
child: new Container( child: new Container(
padding: const EdgeInsets.all(50.0), padding: const EdgeInsets.all(50.0),
child: new ScrollableViewport(child: new SizedBox(height: 1200.0)) child: new ScrollableViewport(child: const SizedBox(height: 1200.0))
) )
) )
) )
) )
)); ));
TestGesture gesture = await tester.startGesture(new Point(100.0, 100.0)); TestGesture gesture = await tester.startGesture(const Point(100.0, 100.0));
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
await gesture.moveBy(new Offset(-10.0, -10.0)); await gesture.moveBy(const Offset(-10.0, -10.0));
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
await gesture.up(); await gesture.up();
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
......
...@@ -17,10 +17,10 @@ void main() { ...@@ -17,10 +17,10 @@ void main() {
right: new Container() right: new Container()
)); ));
await tester.fling(find.byType(Scrollable), new Offset(0.0, -200.0), 1000.0); await tester.fling(find.byType(Scrollable), const Offset(0.0, -200.0), 1000.0);
await tester.pump(); await tester.pump();
tester.state/*<FlipWidgetState>*/(find.byType(FlipWidget)).flip(); tester.state/*<FlipWidgetState>*/(find.byType(FlipWidget)).flip();
await tester.pump(new Duration(hours: 5)); await tester.pump(const Duration(hours: 5));
}); });
} }
...@@ -73,7 +73,7 @@ void main() { ...@@ -73,7 +73,7 @@ void main() {
await tester.tap(find.byType(Scrollable)); await tester.tap(find.byType(Scrollable));
await tester.pump(const Duration(milliseconds: 50)); await tester.pump(const Duration(milliseconds: 50));
expect(log, equals(<String>['tap 18'])); expect(log, equals(<String>['tap 18']));
await tester.fling(find.byType(Scrollable), new Offset(0.0, -200.0), 1000.0); await tester.fling(find.byType(Scrollable), const Offset(0.0, -200.0), 1000.0);
await tester.pump(const Duration(milliseconds: 50)); await tester.pump(const Duration(milliseconds: 50));
expect(log, equals(<String>['tap 18'])); expect(log, equals(<String>['tap 18']));
await tester.tap(find.byType(Scrollable)); await tester.tap(find.byType(Scrollable));
...@@ -96,7 +96,7 @@ void main() { ...@@ -96,7 +96,7 @@ void main() {
await tester.tap(find.byType(Scrollable)); await tester.tap(find.byType(Scrollable));
await tester.pump(const Duration(milliseconds: 50)); await tester.pump(const Duration(milliseconds: 50));
expect(log, equals(<String>['tap 18'])); expect(log, equals(<String>['tap 18']));
await tester.fling(find.byType(Scrollable), new Offset(0.0, -200.0), 1000.0); await tester.fling(find.byType(Scrollable), const Offset(0.0, -200.0), 1000.0);
await tester.pump(const Duration(milliseconds: 50)); await tester.pump(const Duration(milliseconds: 50));
expect(log, equals(<String>['tap 18'])); expect(log, equals(<String>['tap 18']));
await tester.pump(const Duration(seconds: 50)); await tester.pump(const Duration(seconds: 50));
......
...@@ -16,7 +16,7 @@ void main() { ...@@ -16,7 +16,7 @@ void main() {
// Tests https://github.com/flutter/flutter/issues/5522 // Tests https://github.com/flutter/flutter/issues/5522
testWidgets('ScrollableGrid displays correct children with nonzero padding', (WidgetTester tester) async { testWidgets('ScrollableGrid displays correct children with nonzero padding', (WidgetTester tester) async {
GlobalKey<ScrollableState> scrollableKey = new GlobalKey<ScrollableState>(); GlobalKey<ScrollableState> scrollableKey = new GlobalKey<ScrollableState>();
final EdgeInsets padding = new EdgeInsets.fromLTRB(0.0, 100.0, 0.0, 0.0); final EdgeInsets padding = const EdgeInsets.fromLTRB(0.0, 100.0, 0.0, 0.0);
Widget testWidget = new Align( Widget testWidget = new Align(
child: new SizedBox( child: new SizedBox(
......
...@@ -94,7 +94,7 @@ void main() { ...@@ -94,7 +94,7 @@ void main() {
new ScrollableList( new ScrollableList(
key: new GlobalKey(), key: new GlobalKey(),
itemExtent: 290.0, itemExtent: 290.0,
padding: new EdgeInsets.fromLTRB(5.0, 20.0, 15.0, 10.0), padding: const EdgeInsets.fromLTRB(5.0, 20.0, 15.0, 10.0),
children: items.map((int item) { children: items.map((int item) {
return new Container( return new Container(
child: new GestureDetector( child: new GestureDetector(
...@@ -105,17 +105,17 @@ void main() { ...@@ -105,17 +105,17 @@ void main() {
}) })
) )
); );
await tester.tapAt(new Point(200.0, 19.0)); await tester.tapAt(const Point(200.0, 19.0));
expect(tapped, equals(<int>[])); expect(tapped, equals(<int>[]));
await tester.tapAt(new Point(200.0, 21.0)); await tester.tapAt(const Point(200.0, 21.0));
expect(tapped, equals(<int>[0])); expect(tapped, equals(<int>[0]));
await tester.tapAt(new Point(4.0, 400.0)); await tester.tapAt(const Point(4.0, 400.0));
expect(tapped, equals(<int>[0])); expect(tapped, equals(<int>[0]));
await tester.tapAt(new Point(6.0, 400.0)); await tester.tapAt(const Point(6.0, 400.0));
expect(tapped, equals(<int>[0, 1])); expect(tapped, equals(<int>[0, 1]));
await tester.tapAt(new Point(800.0 - 14.0, 400.0)); await tester.tapAt(const Point(800.0 - 14.0, 400.0));
expect(tapped, equals(<int>[0, 1])); expect(tapped, equals(<int>[0, 1]));
await tester.tapAt(new Point(800.0 - 16.0, 400.0)); await tester.tapAt(const Point(800.0 - 16.0, 400.0));
expect(tapped, equals(<int>[0, 1, 1])); expect(tapped, equals(<int>[0, 1, 1]));
}); });
...@@ -127,7 +127,7 @@ void main() { ...@@ -127,7 +127,7 @@ void main() {
key: new GlobalKey(), key: new GlobalKey(),
itemExtent: 290.0, itemExtent: 290.0,
scrollAnchor: ViewportAnchor.end, scrollAnchor: ViewportAnchor.end,
padding: new EdgeInsets.fromLTRB(5.0, 20.0, 15.0, 10.0), padding: const EdgeInsets.fromLTRB(5.0, 20.0, 15.0, 10.0),
children: items.map((int item) { children: items.map((int item) {
return new Container( return new Container(
child: new GestureDetector( child: new GestureDetector(
...@@ -138,17 +138,17 @@ void main() { ...@@ -138,17 +138,17 @@ void main() {
}) })
) )
); );
await tester.tapAt(new Point(200.0, 600.0 - 9.0)); await tester.tapAt(const Point(200.0, 600.0 - 9.0));
expect(tapped, equals(<int>[])); expect(tapped, equals(<int>[]));
await tester.tapAt(new Point(200.0, 600.0 - 11.0)); await tester.tapAt(const Point(200.0, 600.0 - 11.0));
expect(tapped, equals(<int>[5])); expect(tapped, equals(<int>[5]));
await tester.tapAt(new Point(4.0, 200.0)); await tester.tapAt(const Point(4.0, 200.0));
expect(tapped, equals(<int>[5])); expect(tapped, equals(<int>[5]));
await tester.tapAt(new Point(6.0, 200.0)); await tester.tapAt(const Point(6.0, 200.0));
expect(tapped, equals(<int>[5, 4])); expect(tapped, equals(<int>[5, 4]));
await tester.tapAt(new Point(800.0 - 14.0, 200.0)); await tester.tapAt(const Point(800.0 - 14.0, 200.0));
expect(tapped, equals(<int>[5, 4])); expect(tapped, equals(<int>[5, 4]));
await tester.tapAt(new Point(800.0 - 16.0, 200.0)); await tester.tapAt(const Point(800.0 - 16.0, 200.0));
expect(tapped, equals(<int>[5, 4, 4])); expect(tapped, equals(<int>[5, 4, 4]));
}); });
...@@ -179,7 +179,7 @@ void main() { ...@@ -179,7 +179,7 @@ void main() {
expect(scrollableKey.currentState.scrollOffset, equals(0.0)); expect(scrollableKey.currentState.scrollOffset, equals(0.0));
expect(scrollableKey.currentState.virtualScrollOffset, lessThan(0.0)); expect(scrollableKey.currentState.virtualScrollOffset, lessThan(0.0));
await tester.tapAt(new Point(200.0, 100.0)); await tester.tapAt(const Point(200.0, 100.0));
expect(tapped, equals(<int>[0])); expect(tapped, equals(<int>[0]));
}); });
} }
...@@ -67,7 +67,7 @@ void main() { ...@@ -67,7 +67,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new ScrollableList( new ScrollableList(
itemExtent: 290.0, itemExtent: 290.0,
padding: new EdgeInsets.only(top: 250.0), padding: const EdgeInsets.only(top: 250.0),
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
children: items.map((int item) { children: items.map((int item) {
return new Container( return new Container(
......
...@@ -24,7 +24,7 @@ void main() { ...@@ -24,7 +24,7 @@ void main() {
return true; return true;
}, },
child: new SizeChangedLayoutNotifier( child: new SizeChangedLayoutNotifier(
child: new SizedBox( child: const SizedBox(
width: 100.0, width: 100.0,
height: 100.0 height: 100.0
) )
...@@ -39,7 +39,7 @@ void main() { ...@@ -39,7 +39,7 @@ void main() {
return true; return true;
}, },
child: new SizeChangedLayoutNotifier( child: new SizeChangedLayoutNotifier(
child: new SizedBox( child: const SizedBox(
width: 200.0, width: 200.0,
height: 100.0 height: 100.0
) )
......
...@@ -199,8 +199,8 @@ void main() { ...@@ -199,8 +199,8 @@ void main() {
testWidgets('Can set width and height', (WidgetTester tester) async { testWidgets('Can set width and height', (WidgetTester tester) async {
Key key = new Key('container'); Key key = new Key('container');
BoxDecoration kBoxDecoration = new BoxDecoration( BoxDecoration kBoxDecoration = const BoxDecoration(
backgroundColor: new Color(0xFF00FF00) backgroundColor: const Color(0xFF00FF00)
); );
await tester.pumpWidget( await tester.pumpWidget(
...@@ -273,7 +273,7 @@ void main() { ...@@ -273,7 +273,7 @@ void main() {
new GestureDetector( new GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { print("HELLO"); tapped = true; }, onTap: () { print("HELLO"); tapped = true; },
child: new SizedBox( child: const SizedBox(
width: 200.0, width: 200.0,
height: 200.0, height: 200.0,
), ),
......
...@@ -30,39 +30,39 @@ class FooState extends State<Foo> { ...@@ -30,39 +30,39 @@ class FooState extends State<Foo> {
scrollableKey.currentState.scrollBy(200.0, duration: const Duration(milliseconds: 500)); scrollableKey.currentState.scrollBy(200.0, duration: const Duration(milliseconds: 500));
}, },
child: new DecoratedBox( child: new DecoratedBox(
decoration: new BoxDecoration(backgroundColor: const Color(0)), decoration: const BoxDecoration(backgroundColor: const Color(0)),
child: new SizedBox( child: const SizedBox(
height: 200.0, height: 200.0,
), ),
) )
), ),
new DecoratedBox( new DecoratedBox(
decoration: new BoxDecoration(backgroundColor: const Color(0)), decoration: const BoxDecoration(backgroundColor: const Color(0)),
child: new SizedBox( child: const SizedBox(
height: 200.0, height: 200.0,
), ),
), ),
new DecoratedBox( new DecoratedBox(
decoration: new BoxDecoration(backgroundColor: const Color(0)), decoration: const BoxDecoration(backgroundColor: const Color(0)),
child: new SizedBox( child: const SizedBox(
height: 200.0, height: 200.0,
), ),
), ),
new DecoratedBox( new DecoratedBox(
decoration: new BoxDecoration(backgroundColor: const Color(0)), decoration: const BoxDecoration(backgroundColor: const Color(0)),
child: new SizedBox( child: const SizedBox(
height: 200.0, height: 200.0,
), ),
), ),
new DecoratedBox( new DecoratedBox(
decoration: new BoxDecoration(backgroundColor: const Color(0)), decoration: const BoxDecoration(backgroundColor: const Color(0)),
child: new SizedBox( child: const SizedBox(
height: 200.0, height: 200.0,
), ),
), ),
new DecoratedBox( new DecoratedBox(
decoration: new BoxDecoration(backgroundColor: const Color(0)), decoration: const BoxDecoration(backgroundColor: const Color(0)),
child: new SizedBox( child: const SizedBox(
height: 200.0, height: 200.0,
), ),
), ),
......
...@@ -288,7 +288,7 @@ void main() { ...@@ -288,7 +288,7 @@ void main() {
new Table( new Table(
children: <TableRow>[ children: <TableRow>[
new TableRow( new TableRow(
key: new ValueKey<int>(1), key: const ValueKey<int>(1),
children: <Widget>[ children: <Widget>[
new StatefulBuilder( new StatefulBuilder(
builder: (BuildContext context, StateSetter setState) { builder: (BuildContext context, StateSetter setState) {
...@@ -315,7 +315,7 @@ void main() { ...@@ -315,7 +315,7 @@ void main() {
] ]
), ),
new TableRow( new TableRow(
key: new ValueKey<int>(1), key: const ValueKey<int>(1),
children: <Widget>[ children: <Widget>[
new StatefulBuilder( new StatefulBuilder(
builder: (BuildContext context, StateSetter setState) { builder: (BuildContext context, StateSetter setState) {
......
...@@ -5,15 +5,15 @@ ...@@ -5,15 +5,15 @@
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
final BoxDecoration kBoxDecorationA = new BoxDecoration( final BoxDecoration kBoxDecorationA = const BoxDecoration(
backgroundColor: const Color(0xFFFF0000) backgroundColor: const Color(0xFFFF0000)
); );
final BoxDecoration kBoxDecorationB = new BoxDecoration( final BoxDecoration kBoxDecorationB = const BoxDecoration(
backgroundColor: const Color(0xFF00FF00) backgroundColor: const Color(0xFF00FF00)
); );
final BoxDecoration kBoxDecorationC = new BoxDecoration( final BoxDecoration kBoxDecorationC = const BoxDecoration(
backgroundColor: const Color(0xFF0000FF) backgroundColor: const Color(0xFF0000FF)
); );
......
...@@ -8,7 +8,7 @@ import 'package:flutter/widgets.dart'; ...@@ -8,7 +8,7 @@ import 'package:flutter/widgets.dart';
void main() { void main() {
testWidgets('Text respects media query', (WidgetTester tester) async { testWidgets('Text respects media query', (WidgetTester tester) async {
await tester.pumpWidget(new MediaQuery( await tester.pumpWidget(new MediaQuery(
data: new MediaQueryData(textScaleFactor: 1.5), data: const MediaQueryData(textScaleFactor: 1.5),
child: new Center( child: new Center(
child: new Text('Hello') child: new Text('Hello')
) )
......
...@@ -19,8 +19,8 @@ void main() { ...@@ -19,8 +19,8 @@ void main() {
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFF0000FF), backgroundColor: const Color(0xFF0000FF),
), ),
), ),
), ),
...@@ -32,14 +32,14 @@ void main() { ...@@ -32,14 +32,14 @@ void main() {
height: 100.0, height: 100.0,
child: new Transform( child: new Transform(
transform: new Matrix4.diagonal3Values(0.5, 0.5, 1.0), transform: new Matrix4.diagonal3Values(0.5, 0.5, 1.0),
origin: new Offset(100.0, 50.0), origin: const Offset(100.0, 50.0),
child: new GestureDetector( child: new GestureDetector(
onTap: () { onTap: () {
didReceiveTap = true; didReceiveTap = true;
}, },
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFF00FFFF), backgroundColor: const Color(0xFF00FFFF),
), ),
), ),
), ),
...@@ -51,9 +51,9 @@ void main() { ...@@ -51,9 +51,9 @@ void main() {
); );
expect(didReceiveTap, isFalse); expect(didReceiveTap, isFalse);
await tester.tapAt(new Point(110.0, 110.0)); await tester.tapAt(const Point(110.0, 110.0));
expect(didReceiveTap, isFalse); expect(didReceiveTap, isFalse);
await tester.tapAt(new Point(190.0, 150.0)); await tester.tapAt(const Point(190.0, 150.0));
expect(didReceiveTap, isTrue); expect(didReceiveTap, isTrue);
}); });
...@@ -68,8 +68,8 @@ void main() { ...@@ -68,8 +68,8 @@ void main() {
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFF0000FF), backgroundColor: const Color(0xFF0000FF),
), ),
), ),
), ),
...@@ -81,14 +81,14 @@ void main() { ...@@ -81,14 +81,14 @@ void main() {
height: 100.0, height: 100.0,
child: new Transform( child: new Transform(
transform: new Matrix4.diagonal3Values(0.5, 0.5, 1.0), transform: new Matrix4.diagonal3Values(0.5, 0.5, 1.0),
alignment: new FractionalOffset(1.0, 0.5), alignment: const FractionalOffset(1.0, 0.5),
child: new GestureDetector( child: new GestureDetector(
onTap: () { onTap: () {
didReceiveTap = true; didReceiveTap = true;
}, },
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFF00FFFF), backgroundColor: const Color(0xFF00FFFF),
), ),
), ),
), ),
...@@ -100,9 +100,9 @@ void main() { ...@@ -100,9 +100,9 @@ void main() {
); );
expect(didReceiveTap, isFalse); expect(didReceiveTap, isFalse);
await tester.tapAt(new Point(110.0, 110.0)); await tester.tapAt(const Point(110.0, 110.0));
expect(didReceiveTap, isFalse); expect(didReceiveTap, isFalse);
await tester.tapAt(new Point(190.0, 150.0)); await tester.tapAt(const Point(190.0, 150.0));
expect(didReceiveTap, isTrue); expect(didReceiveTap, isTrue);
}); });
...@@ -116,8 +116,8 @@ void main() { ...@@ -116,8 +116,8 @@ void main() {
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFF0000FF), backgroundColor: const Color(0xFF0000FF),
), ),
), ),
), ),
...@@ -129,15 +129,15 @@ void main() { ...@@ -129,15 +129,15 @@ void main() {
height: 100.0, height: 100.0,
child: new Transform( child: new Transform(
transform: new Matrix4.diagonal3Values(0.5, 0.5, 1.0), transform: new Matrix4.diagonal3Values(0.5, 0.5, 1.0),
origin: new Offset(100.0, 0.0), origin: const Offset(100.0, 0.0),
alignment: new FractionalOffset(0.0, 0.5), alignment: const FractionalOffset(0.0, 0.5),
child: new GestureDetector( child: new GestureDetector(
onTap: () { onTap: () {
didReceiveTap = true; didReceiveTap = true;
}, },
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: new Color(0xFF00FFFF), backgroundColor: const Color(0xFF00FFFF),
), ),
), ),
), ),
...@@ -148,9 +148,9 @@ void main() { ...@@ -148,9 +148,9 @@ void main() {
)); ));
expect(didReceiveTap, isFalse); expect(didReceiveTap, isFalse);
await tester.tapAt(new Point(110.0, 110.0)); await tester.tapAt(const Point(110.0, 110.0));
expect(didReceiveTap, isFalse); expect(didReceiveTap, isFalse);
await tester.tapAt(new Point(190.0, 150.0)); await tester.tapAt(const Point(190.0, 150.0));
expect(didReceiveTap, isTrue); expect(didReceiveTap, isTrue);
}); });
...@@ -166,7 +166,7 @@ void main() { ...@@ -166,7 +166,7 @@ void main() {
child: new Opacity( child: new Opacity(
opacity: 0.9, opacity: 0.9,
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFF00FF00), backgroundColor: const Color(0xFF00FF00),
), ),
), ),
......
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