From c8447c91a93cdee28eddb01ee3ace27b9362220f Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Sat, 10 Dec 2016 00:20:27 +0100 Subject: [PATCH] prefer_const_constructor in packages/flutter/test (#7181) --- .../test/animation/animations_test.dart | 2 +- .../flutter/test/animation/curves_test.dart | 6 +- .../flutter/test/animation/tween_test.dart | 4 +- .../test/cassowary/cassowary_test.dart | 12 +- packages/flutter/test/engine/color_test.dart | 8 +- .../test/foundation/licenses_test.dart | 16 +- .../test/gestures/double_tap_test.dart | 8 +- .../flutter/test/gestures/events_test.dart | 4 +- .../test/gestures/gesture_binding_test.dart | 42 +-- packages/flutter/test/gestures/tap_test.dart | 2 +- .../test/gestures/velocity_tracker_test.dart | 12 +- .../flutter/test/material/app_bar_test.dart | 8 +- packages/flutter/test/material/arc_test.dart | 8 +- .../flutter/test/material/drop_down_test.dart | 4 +- .../test/material/expansion_panel_test.dart | 4 +- packages/flutter/test/material/icon_test.dart | 16 +- .../test/material/image_icon_test.dart | 16 +- .../material/mergeable_material_test.dart | 276 +++++++++--------- .../flutter/test/material/scaffold_test.dart | 18 +- .../flutter/test/material/snack_bar_test.dart | 78 ++--- .../flutter/test/material/stepper_test.dart | 42 +-- packages/flutter/test/material/tabs_test.dart | 14 +- .../flutter/test/material/theme_test.dart | 2 +- .../test/painting/box_painter_test.dart | 6 +- .../test/painting/decoration_test.dart | 8 +- .../test/painting/edge_insets_test.dart | 4 +- .../test/painting/paint_image_test.dart | 2 +- .../flutter/test/painting/text_span_test.dart | 22 +- .../flutter/test/physics/newton_test.dart | 4 +- .../flutter/test/rendering/baseline_test.dart | 12 +- .../test/rendering/box_constraints_test.dart | 14 +- packages/flutter/test/rendering/box_test.dart | 14 +- .../rendering/dynamic_intrinsics_test.dart | 2 +- .../flutter/test/rendering/flex_test.dart | 40 +-- .../flutter/test/rendering/grid_test.dart | 8 +- .../flutter/test/rendering/image_test.dart | 26 +- .../rendering/independent_layout_test.dart | 4 +- .../test/rendering/intrinsic_width_test.dart | 36 +-- .../test/rendering/limited_box_test.dart | 6 +- .../non_render_object_root_test.dart | 2 +- .../flutter/test/rendering/offstage_test.dart | 2 +- .../flutter/test/rendering/overflow_test.dart | 4 +- .../rendering/paragraph_intrinsics_test.dart | 4 +- .../test/rendering/positioned_box_test.dart | 18 +- .../flutter/test/rendering/reattach_test.dart | 8 +- .../flutter/test/rendering/stack_test.dart | 4 +- .../flutter/test/rendering/table_test.dart | 4 +- .../test/rendering/transform_test.dart | 22 +- .../flutter/test/rendering/viewport_test.dart | 10 +- .../services/image_cache_resize_test.dart | 16 +- .../test/services/image_cache_test.dart | 32 +- .../test/widgets/animated_container_test.dart | 42 +-- .../widgets/animated_cross_fade_test.dart | 12 +- .../test/widgets/animated_size_test.dart | 14 +- .../test/widgets/aspect_ratio_test.dart | 6 +- .../flutter/test/widgets/banner_test.dart | 16 +- packages/flutter/test/widgets/block_test.dart | 8 +- .../test/widgets/bottom_sheet_test.dart | 26 +- .../test/widgets/box_decoration_test.dart | 2 +- packages/flutter/test/widgets/clip_test.dart | 20 +- .../custom_multi_child_layout_test.dart | 6 +- .../widgets/custom_one_child_layout_test.dart | 4 +- .../test/widgets/dismissable_test.dart | 6 +- .../flutter/test/widgets/draggable_test.dart | 22 +- .../flutter/test/widgets/drawer_test.dart | 28 +- .../flutter/test/widgets/fitted_box_test.dart | 12 +- packages/flutter/test/widgets/flow_test.dart | 4 +- .../test/widgets/gesture_detector_test.dart | 22 +- .../flutter/test/widgets/heroes_test.dart | 16 +- .../flutter/test/widgets/hyperlink_test.dart | 8 +- packages/flutter/test/widgets/image_test.dart | 16 +- .../widgets/implicit_animations_test.dart | 14 +- .../independent_widget_layout_test.dart | 2 +- packages/flutter/test/widgets/input_test.dart | 28 +- .../layout_builder_mutations_test.dart | 4 +- .../test/widgets/layout_builder_test.dart | 8 +- .../widgets/lazy_block_viewport_test.dart | 4 +- .../flutter/test/widgets/navigator_test.dart | 10 +- .../test/widgets/page_transitions_test.dart | 30 +- .../test/widgets/pageable_list_test.dart | 2 +- .../remember_scroll_position_test.dart | 6 +- .../widgets/render_object_widget_test.dart | 18 +- .../test/widgets/rotated_box_test.dart | 4 +- .../test/widgets/scroll_behavior_test.dart | 4 +- .../test/widgets/scroll_events_test.dart | 22 +- .../test/widgets/scroll_interaction_test.dart | 4 +- .../widgets/scroll_notification_test.dart | 18 +- .../test/widgets/scrollable_dispose_test.dart | 4 +- .../test/widgets/scrollable_fling_test.dart | 4 +- .../test/widgets/scrollable_grid_test.dart | 2 +- .../scrollable_list_hit_testing_test.dart | 30 +- .../scrollable_list_vertical_test.dart | 2 +- ...size_changed_layout_notification_test.dart | 4 +- packages/flutter/test/widgets/stack_test.dart | 6 +- .../state_setting_in_scrollables_test.dart | 24 +- packages/flutter/test/widgets/table_test.dart | 4 +- .../flutter/test/widgets/test_widgets.dart | 6 +- packages/flutter/test/widgets/text_test.dart | 2 +- .../flutter/test/widgets/transform_test.dart | 46 +-- 99 files changed, 769 insertions(+), 769 deletions(-) diff --git a/packages/flutter/test/animation/animations_test.dart b/packages/flutter/test/animation/animations_test.dart index f5708d253e..062edcb95b 100644 --- a/packages/flutter/test/animation/animations_test.dart +++ b/packages/flutter/test/animation/animations_test.dart @@ -17,7 +17,7 @@ void main() { test('toString control test', () { expect(kAlwaysCompleteAnimation.toString(), hasOneLineDescription); expect(kAlwaysDismissedAnimation.toString(), hasOneLineDescription); - expect(new AlwaysStoppedAnimation(0.5).toString(), hasOneLineDescription); + expect(const AlwaysStoppedAnimation(0.5).toString(), hasOneLineDescription); CurvedAnimation curvedAnimation = new CurvedAnimation( parent: kAlwaysDismissedAnimation, curve: Curves.ease diff --git a/packages/flutter/test/animation/curves_test.dart b/packages/flutter/test/animation/curves_test.dart index f3921c1ccd..22c118d1fa 100644 --- a/packages/flutter/test/animation/curves_test.dart +++ b/packages/flutter/test/animation/curves_test.dart @@ -11,8 +11,8 @@ import 'package:flutter/widgets.dart'; void main() { test('toString control test', () { expect(Curves.linear, hasOneLineDescription); - expect(new SawTooth(3), hasOneLineDescription); - expect(new Interval(0.25, 0.75), hasOneLineDescription); + expect(const SawTooth(3), hasOneLineDescription); + expect(const Interval(0.25, 0.75), hasOneLineDescription); expect(new Interval(0.25, 0.75, curve: Curves.ease), hasOneLineDescription); }); @@ -26,7 +26,7 @@ void main() { }); 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.24), 0.0); expect(step.transform(0.25), 1.0); diff --git a/packages/flutter/test/animation/tween_test.dart b/packages/flutter/test/animation/tween_test.dart index 17579e66f5..10ef4a4b8e 100644 --- a/packages/flutter/test/animation/tween_test.dart +++ b/packages/flutter/test/animation/tween_test.dart @@ -33,8 +33,8 @@ void main() { }); test('SizeTween', () { - SizeTween tween = new SizeTween(begin: Size.zero, end: new Size(20.0, 30.0)); - expect(tween.lerp(0.5), equals(new Size(10.0, 15.0))); + SizeTween tween = new SizeTween(begin: Size.zero, end: const Size(20.0, 30.0)); + expect(tween.lerp(0.5), equals(const Size(10.0, 15.0))); expect(tween, hasOneLineDescription); }); diff --git a/packages/flutter/test/cassowary/cassowary_test.dart b/packages/flutter/test/cassowary/cassowary_test.dart index b7b5fccff8..8861dd3911 100644 --- a/packages/flutter/test/cassowary/cassowary_test.dart +++ b/packages/flutter/test/cassowary/cassowary_test.dart @@ -386,12 +386,12 @@ void main() { Expression e = new Expression([t], 0.0); expect((c * c).value, 100); - expect(() => v * v, throwsA(new isInstanceOf())); - expect(() => v / v, throwsA(new isInstanceOf())); - expect(() => v * t, throwsA(new isInstanceOf())); - expect(() => v / t, throwsA(new isInstanceOf())); - expect(() => v * e, throwsA(new isInstanceOf())); - expect(() => v / e, throwsA(new isInstanceOf())); + expect(() => v * v, throwsA(const isInstanceOf())); + expect(() => v / v, throwsA(const isInstanceOf())); + expect(() => v * t, throwsA(const isInstanceOf())); + expect(() => v / t, throwsA(const isInstanceOf())); + expect(() => v * e, throwsA(const isInstanceOf())); + expect(() => v / e, throwsA(const isInstanceOf())); expect(() => v * c, returnsNormally); expect(() => v / c, returnsNormally); }); diff --git a/packages/flutter/test/engine/color_test.dart b/packages/flutter/test/engine/color_test.dart index f4accabf64..2b231f94ba 100644 --- a/packages/flutter/test/engine/color_test.dart +++ b/packages/flutter/test/engine/color_test.dart @@ -8,7 +8,7 @@ import 'package:test/test.dart'; void main() { test("color accessors should work", () { - Color foo = new Color(0x12345678); + Color foo = const Color(0x12345678); expect(foo.alpha, equals(0x12)); expect(foo.red, equals(0x34)); expect(foo.green, equals(0x56)); @@ -16,7 +16,7 @@ void main() { }); test("paint set to black", () { - Color c = new Color(0x00000000); + Color c = const Color(0x00000000); Paint p = new Paint(); p.color = c; expect(c.toString(), equals('Color(0x00000000)')); @@ -24,7 +24,7 @@ void main() { test("color created with out of bounds value", () { try { - Color c = new Color(0x100 << 24); + Color c = const Color(0x100 << 24); Paint p = new Paint(); p.color = c; } catch (e) { @@ -34,7 +34,7 @@ void main() { test("color created with wildly out of bounds value", () { try { - Color c = new Color(1 << 1000000); + Color c = const Color(1 << 1000000); Paint p = new Paint(); p.color = c; } catch (e) { diff --git a/packages/flutter/test/foundation/licenses_test.dart b/packages/flutter/test/foundation/licenses_test.dart index 5f8bc33128..a1d22d71f2 100644 --- a/packages/flutter/test/foundation/licenses_test.dart +++ b/packages/flutter/test/foundation/licenses_test.dart @@ -9,7 +9,7 @@ void main() { test('LicenseEntryWithLineBreaks - most cases', () { // There's some trailing spaces in this string. // To avoid IDEs stripping them, I've escaped them as \u0020. - List paragraphs = new LicenseEntryWithLineBreaks(null, ''' + List paragraphs = const LicenseEntryWithLineBreaks(null, ''' A A A @@ -157,16 +157,16 @@ S }); 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 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].indent, 0); 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].indent, 0); expect(paragraphs, hasLength(1)); @@ -175,12 +175,12 @@ S test('LicenseRegistry', () async { expect(await LicenseRegistry.licenses.toList(), isEmpty); LicenseRegistry.addLicense(() async* { - yield new LicenseEntryWithLineBreaks(null, 'A'); - yield new LicenseEntryWithLineBreaks(null, 'B'); + yield const LicenseEntryWithLineBreaks(null, 'A'); + yield const LicenseEntryWithLineBreaks(null, 'B'); }); LicenseRegistry.addLicense(() async* { - yield new LicenseEntryWithLineBreaks(null, 'C'); - yield new LicenseEntryWithLineBreaks(null, 'D'); + yield const LicenseEntryWithLineBreaks(null, 'C'); + yield const LicenseEntryWithLineBreaks(null, 'D'); }); expect(await LicenseRegistry.licenses.toList(), hasLength(4)); List licenses = await LicenseRegistry.licenses.toList(); diff --git a/packages/flutter/test/gestures/double_tap_test.dart b/packages/flutter/test/gestures/double_tap_test.dart index f44f20eb13..b63f6bde63 100644 --- a/packages/flutter/test/gestures/double_tap_test.dart +++ b/packages/flutter/test/gestures/double_tap_test.dart @@ -206,7 +206,7 @@ void main() { GestureBinding.instance.gestureArena.sweep(1); expect(doubleTapRecognized, isFalse); - tester.async.elapse(new Duration(milliseconds: 5000)); + tester.async.elapse(const Duration(milliseconds: 5000)); tap.addPointer(down2); tester.closeArena(2); expect(doubleTapRecognized, isFalse); @@ -240,7 +240,7 @@ void main() { GestureBinding.instance.gestureArena.sweep(1); expect(doubleTapRecognized, isFalse); - tester.async.elapse(new Duration(milliseconds: 5000)); + tester.async.elapse(const Duration(milliseconds: 5000)); tap.addPointer(down2); tester.closeArena(2); expect(doubleTapRecognized, isFalse); @@ -252,7 +252,7 @@ void main() { GestureBinding.instance.gestureArena.sweep(2); expect(doubleTapRecognized, isFalse); - tester.async.elapse(new Duration(milliseconds: 100)); + tester.async.elapse(const Duration(milliseconds: 100)); tap.addPointer(down5); tester.closeArena(5); expect(doubleTapRecognized, isFalse); @@ -281,7 +281,7 @@ void main() { tester.route(down1); expect(doubleTapRecognized, isFalse); - tester.async.elapse(new Duration(milliseconds: 1000)); + tester.async.elapse(const Duration(milliseconds: 1000)); tester.route(up1); expect(doubleTapRecognized, isFalse); GestureBinding.instance.gestureArena.sweep(1); diff --git a/packages/flutter/test/gestures/events_test.dart b/packages/flutter/test/gestures/events_test.dart index e818e66a5b..94d1fdbb4f 100644 --- a/packages/flutter/test/gestures/events_test.dart +++ b/packages/flutter/test/gestures/events_test.dart @@ -11,8 +11,8 @@ void main() { setUp(ensureGestureBinding); testGesture('toString control tests', (GestureTester tester) { - expect(new PointerDownEvent(), hasOneLineDescription); - expect(new PointerDownEvent().toStringFull(), hasOneLineDescription); + expect(const PointerDownEvent(), hasOneLineDescription); + expect(const PointerDownEvent().toStringFull(), hasOneLineDescription); }); testGesture('nthMouseButton control tests', (GestureTester tester) { diff --git a/packages/flutter/test/gestures/gesture_binding_test.dart b/packages/flutter/test/gestures/gesture_binding_test.dart index 171c4d0f8b..20612bc397 100644 --- a/packages/flutter/test/gestures/gesture_binding_test.dart +++ b/packages/flutter/test/gestures/gesture_binding_test.dart @@ -33,10 +33,10 @@ void main() { setUp(ensureTestGestureBinding); test('Pointer tap events', () { - ui.PointerDataPacket packet = new ui.PointerDataPacket( - data: [ - new ui.PointerData(change: ui.PointerChange.down), - new ui.PointerData(change: ui.PointerChange.up), + ui.PointerDataPacket packet = const ui.PointerDataPacket( + data: const [ + const ui.PointerData(change: ui.PointerChange.down), + const ui.PointerData(change: ui.PointerChange.up), ] ); @@ -50,11 +50,11 @@ void main() { }); test('Pointer move events', () { - ui.PointerDataPacket packet = new ui.PointerDataPacket( - data: [ - new ui.PointerData(change: ui.PointerChange.down), - new ui.PointerData(change: ui.PointerChange.move), - new ui.PointerData(change: ui.PointerChange.up), + ui.PointerDataPacket packet = const ui.PointerDataPacket( + data: const [ + const ui.PointerData(change: ui.PointerChange.down), + const ui.PointerData(change: ui.PointerChange.move), + const ui.PointerData(change: ui.PointerChange.up), ] ); @@ -69,14 +69,14 @@ void main() { }); test('Synthetic move events', () { - ui.PointerDataPacket packet = new ui.PointerDataPacket( - data: [ - new ui.PointerData( + ui.PointerDataPacket packet = const ui.PointerDataPacket( + data: const [ + const ui.PointerData( change: ui.PointerChange.down, physicalX: 1.0, physicalY: 3.0, ), - new ui.PointerData( + const ui.PointerData( change: ui.PointerChange.up, physicalX: 10.0, physicalY: 15.0, @@ -96,10 +96,10 @@ void main() { }); test('Pointer cancel events', () { - ui.PointerDataPacket packet = new ui.PointerDataPacket( - data: [ - new ui.PointerData(change: ui.PointerChange.down), - new ui.PointerData(change: ui.PointerChange.cancel), + ui.PointerDataPacket packet = const ui.PointerDataPacket( + data: const [ + const ui.PointerData(change: ui.PointerChange.down), + const ui.PointerData(change: ui.PointerChange.cancel), ] ); @@ -113,10 +113,10 @@ void main() { }); test('Can cancel pointers', () { - ui.PointerDataPacket packet = new ui.PointerDataPacket( - data: [ - new ui.PointerData(change: ui.PointerChange.down), - new ui.PointerData(change: ui.PointerChange.up), + ui.PointerDataPacket packet = const ui.PointerDataPacket( + data: const [ + const ui.PointerData(change: ui.PointerChange.down), + const ui.PointerData(change: ui.PointerChange.up), ] ); diff --git a/packages/flutter/test/gestures/tap_test.dart b/packages/flutter/test/gestures/tap_test.dart index 517c608a8e..aed08fe3ea 100644 --- a/packages/flutter/test/gestures/tap_test.dart +++ b/packages/flutter/test/gestures/tap_test.dart @@ -193,7 +193,7 @@ void main() { tester.route(down1); expect(tapRecognized, isFalse); - tester.async.elapse(new Duration(milliseconds: 500)); + tester.async.elapse(const Duration(milliseconds: 500)); expect(tapRecognized, isFalse); tester.route(up1); expect(tapRecognized, isTrue); diff --git a/packages/flutter/test/gestures/velocity_tracker_test.dart b/packages/flutter/test/gestures/velocity_tracker_test.dart index 1beeebbc93..f4a193dda2 100644 --- a/packages/flutter/test/gestures/velocity_tracker_test.dart +++ b/packages/flutter/test/gestures/velocity_tracker_test.dart @@ -49,13 +49,13 @@ void main() { }); test('Velocity control test', () { - Velocity velocity1 = new Velocity(pixelsPerSecond: const Offset(7.0, 0.0)); - Velocity velocity2 = new Velocity(pixelsPerSecond: const Offset(12.0, 0.0)); - expect(velocity1, equals(new Velocity(pixelsPerSecond: new Offset(7.0, 0.0)))); + Velocity velocity1 = const Velocity(pixelsPerSecond: const Offset(7.0, 0.0)); + Velocity velocity2 = const Velocity(pixelsPerSecond: const Offset(12.0, 0.0)); + expect(velocity1, equals(const Velocity(pixelsPerSecond: const Offset(7.0, 0.0)))); expect(velocity1, isNot(equals(velocity2))); - expect(velocity2 - velocity1, equals(new Velocity(pixelsPerSecond: new Offset(5.0, 0.0)))); - expect((-velocity1).pixelsPerSecond, new Offset(-7.0, 0.0)); - expect(velocity1 + velocity2, equals(new Velocity(pixelsPerSecond: new Offset(19.0, 0.0)))); + expect(velocity2 - velocity1, equals(const Velocity(pixelsPerSecond: const Offset(5.0, 0.0)))); + expect((-velocity1).pixelsPerSecond, const Offset(-7.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, hasOneLineDescription); }); diff --git a/packages/flutter/test/material/app_bar_test.dart b/packages/flutter/test/material/app_bar_test.dart index 263ff0dee8..05830a685b 100644 --- a/packages/flutter/test/material/app_bar_test.dart +++ b/packages/flutter/test/material/app_bar_test.dart @@ -111,8 +111,8 @@ void main() { expect(tester.getSize(title).width, equals(800.0 - 72.0 - 8.0)); actions = [ - new SizedBox(width: 100.0), - new SizedBox(width: 100.0) + const SizedBox(width: 100.0), + const SizedBox(width: 100.0) ]; await tester.pumpWidget(buildApp()); @@ -171,8 +171,8 @@ void main() { leading = null; titleWidth = 620.0; actions = [ - new SizedBox(width: 45.0), - new SizedBox(width: 45.0) + const SizedBox(width: 45.0), + const SizedBox(width: 45.0) ]; await tester.pumpWidget(buildApp()); expect(tester.getTopLeft(title).x, 800 - 620 - 45 - 45 - 8); diff --git a/packages/flutter/test/material/arc_test.dart b/packages/flutter/test/material/arc_test.dart index abfc0a1b4f..5112f8ac2a 100644 --- a/packages/flutter/test/material/arc_test.dart +++ b/packages/flutter/test/material/arc_test.dart @@ -9,16 +9,16 @@ void main() { test('on-axis MaterialPointArcTween', () { MaterialPointArcTween tween = new MaterialPointArcTween( 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); tween = new MaterialPointArcTween( 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', () { diff --git a/packages/flutter/test/material/drop_down_test.dart b/packages/flutter/test/material/drop_down_test.dart index 6b574d6b0d..7dfb8b182b 100644 --- a/packages/flutter/test/material/drop_down_test.dart +++ b/packages/flutter/test/material/drop_down_test.dart @@ -224,7 +224,7 @@ void main() { // 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 // have the same origin and height as the dropdown button. - List itemBoxes = tester.renderObjectList(find.byKey(new ValueKey('two'))).toList(); + List itemBoxes = tester.renderObjectList(find.byKey(const ValueKey('two'))).toList(); expect(itemBoxes.length, equals(2)); for(RenderBox itemBox in itemBoxes) { assert(itemBox.attached); @@ -254,7 +254,7 @@ void main() { // 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 // have the same vertical center as the button. - List itemBoxes = tester.renderObjectList(find.byKey(new ValueKey('two'))).toList(); + List itemBoxes = tester.renderObjectList(find.byKey(const ValueKey('two'))).toList(); expect(itemBoxes.length, equals(2)); // When isDense is true, the button's height is reduced. The menu items' diff --git a/packages/flutter/test/material/expansion_panel_test.dart b/packages/flutter/test/material/expansion_panel_test.dart index 43afc43389..e025ff20fc 100644 --- a/packages/flutter/test/material/expansion_panel_test.dart +++ b/packages/flutter/test/material/expansion_panel_test.dart @@ -22,7 +22,7 @@ void main() { headerBuilder: (BuildContext context, bool isExpanded) { return new Text(isExpanded ? 'B' : 'A'); }, - body: new SizedBox(height: 100.0) + body: const SizedBox(height: 100.0) ) ] ) @@ -53,7 +53,7 @@ void main() { headerBuilder: (BuildContext context, bool isExpanded) { return new Text(isExpanded ? 'B' : 'A'); }, - body: new SizedBox(height: 100.0), + body: const SizedBox(height: 100.0), isExpanded: true // this is the addition ) ] diff --git a/packages/flutter/test/material/icon_test.dart b/packages/flutter/test/material/icon_test.dart index 1383141fc1..223d3d4043 100644 --- a/packages/flutter/test/material/icon_test.dart +++ b/packages/flutter/test/material/icon_test.dart @@ -11,7 +11,7 @@ void main() { testWidgets('Icon sizing - no theme, default size', (WidgetTester tester) async { await tester.pumpWidget( new Center( - child: new Icon(null) + child: const Icon(null) ) ); @@ -22,7 +22,7 @@ void main() { testWidgets('Icon sizing - no theme, explicit size', (WidgetTester tester) async { await tester.pumpWidget( new Center( - child: new Icon( + child: const Icon( null, size: 96.0 ) @@ -37,8 +37,8 @@ void main() { await tester.pumpWidget( new Center( child: new IconTheme( - data: new IconThemeData(size: 36.0), - child: new Icon(null) + data: const IconThemeData(size: 36.0), + child: const Icon(null) ) ) ); @@ -51,8 +51,8 @@ void main() { await tester.pumpWidget( new Center( child: new IconTheme( - data: new IconThemeData(size: 36.0), - child: new Icon( + data: const IconThemeData(size: 36.0), + child: const Icon( null, size: 48.0 ) @@ -68,8 +68,8 @@ void main() { await tester.pumpWidget( new Center( child: new IconTheme( - data: new IconThemeData(), - child: new Icon(null) + data: const IconThemeData(), + child: const Icon(null) ) ) ); diff --git a/packages/flutter/test/material/image_icon_test.dart b/packages/flutter/test/material/image_icon_test.dart index 5d8bca01f2..783f9eae12 100644 --- a/packages/flutter/test/material/image_icon_test.dart +++ b/packages/flutter/test/material/image_icon_test.dart @@ -11,7 +11,7 @@ void main() { testWidgets('ImageIcon sizing - no theme, default size', (WidgetTester tester) async { await tester.pumpWidget( new Center( - child: new ImageIcon(null) + child: const ImageIcon(null) ) ); @@ -22,7 +22,7 @@ void main() { testWidgets('ImageIcon sizing - no theme, explicit size', (WidgetTester tester) async { await tester.pumpWidget( new Center( - child: new ImageIcon( + child: const ImageIcon( null, size: 96.0 ) @@ -37,8 +37,8 @@ void main() { await tester.pumpWidget( new Center( child: new IconTheme( - data: new IconThemeData(size: 36.0), - child: new ImageIcon(null) + data: const IconThemeData(size: 36.0), + child: const ImageIcon(null) ) ) ); @@ -51,8 +51,8 @@ void main() { await tester.pumpWidget( new Center( child: new IconTheme( - data: new IconThemeData(size: 36.0), - child: new ImageIcon( + data: const IconThemeData(size: 36.0), + child: const ImageIcon( null, size: 48.0 ) @@ -68,8 +68,8 @@ void main() { await tester.pumpWidget( new Center( child: new IconTheme( - data: new IconThemeData(), - child: new ImageIcon(null) + data: const IconThemeData(), + child: const ImageIcon(null) ) ) ); diff --git a/packages/flutter/test/material/mergeable_material_test.dart b/packages/flutter/test/material/mergeable_material_test.dart index 91b3326630..270961926a 100644 --- a/packages/flutter/test/material/mergeable_material_test.dart +++ b/packages/flutter/test/material/mergeable_material_test.dart @@ -101,8 +101,8 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -122,8 +122,8 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 200.0 ) @@ -145,15 +145,15 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -175,15 +175,15 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -210,8 +210,8 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -247,18 +247,18 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('x') + key: const ValueKey('x') ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -281,15 +281,15 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -320,15 +320,15 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -350,18 +350,18 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('x') + key: const ValueKey('x') ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -392,15 +392,15 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -422,18 +422,18 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('x') + key: const ValueKey('x') ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -462,15 +462,15 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -499,18 +499,18 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('x') + key: const ValueKey('x') ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -541,15 +541,15 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('C'), - child: new SizedBox( + key: const ValueKey('C'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -571,22 +571,22 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('C'), - child: new SizedBox( + key: const ValueKey('C'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -609,22 +609,22 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('C'), - child: new SizedBox( + key: const ValueKey('C'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -646,15 +646,15 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('C'), - child: new SizedBox( + key: const ValueKey('C'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -678,15 +678,15 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('C'), - child: new SizedBox( + key: const ValueKey('C'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -708,28 +708,28 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('x') + key: const ValueKey('x') ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('y') + key: const ValueKey('y') ), new MaterialSlice( - key: new ValueKey('C'), - child: new SizedBox( + key: const ValueKey('C'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -762,28 +762,28 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('x') + key: const ValueKey('x') ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('y') + key: const ValueKey('y') ), new MaterialSlice( - key: new ValueKey('C'), - child: new SizedBox( + key: const ValueKey('C'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -807,15 +807,15 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('C'), - child: new SizedBox( + key: const ValueKey('C'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -846,18 +846,18 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('x') + key: const ValueKey('x') ), new MaterialSlice( - key: new ValueKey('C'), - child: new SizedBox( + key: const ValueKey('C'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -880,28 +880,28 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('y') + key: const ValueKey('y') ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('z') + key: const ValueKey('z') ), new MaterialSlice( - key: new ValueKey('C'), - child: new SizedBox( + key: const ValueKey('C'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -934,28 +934,28 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('x') + key: const ValueKey('x') ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('y') + key: const ValueKey('y') ), new MaterialSlice( - key: new ValueKey('C'), - child: new SizedBox( + key: const ValueKey('C'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -979,18 +979,18 @@ void main() { child: new MergeableMaterial( children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('z') + key: const ValueKey('z') ), new MaterialSlice( - key: new ValueKey('C'), - child: new SizedBox( + key: const ValueKey('C'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -1016,7 +1016,7 @@ void main() { bool isDivider(Widget widget, bool top, bool bottom) { final DecoratedBox box = widget; - final BorderSide side = new BorderSide(color: const Color(0x1F000000), width: 0.5); + final BorderSide side = const BorderSide(color: const Color(0x1F000000), width: 0.5); return box.decoration == new BoxDecoration( border: new Border( @@ -1034,29 +1034,29 @@ void main() { hasDividers: true, children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('C'), - child: new SizedBox( + key: const ValueKey('C'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('D'), - child: new SizedBox( + key: const ValueKey('D'), + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -1082,32 +1082,32 @@ void main() { hasDividers: true, children: [ new MaterialSlice( - key: new ValueKey('A'), - child: new SizedBox( + key: const ValueKey('A'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('B'), - child: new SizedBox( + key: const ValueKey('B'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialGap( - key: new ValueKey('x') + key: const ValueKey('x') ), new MaterialSlice( - key: new ValueKey('C'), - child: new SizedBox( + key: const ValueKey('C'), + child: const SizedBox( width: 100.0, height: 100.0 ) ), new MaterialSlice( - key: new ValueKey('D'), - child: new SizedBox( + key: const ValueKey('D'), + child: const SizedBox( width: 100.0, height: 100.0 ) diff --git a/packages/flutter/test/material/scaffold_test.dart b/packages/flutter/test/material/scaffold_test.dart index cc31c6d4e8..d97b212407 100644 --- a/packages/flutter/test/material/scaffold_test.dart +++ b/packages/flutter/test/material/scaffold_test.dart @@ -15,10 +15,10 @@ void main() { )); 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( - data: new MediaQueryData(padding: new EdgeInsets.only(bottom: 100.0)), + data: const MediaQueryData(padding: const EdgeInsets.only(bottom: 100.0)), child: new Scaffold( appBar: new AppBar(title: new Text('Title')), body: new Container(key: bodyKey) @@ -26,10 +26,10 @@ void main() { )); 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( - data: new MediaQueryData(padding: new EdgeInsets.only(bottom: 100.0)), + data: const MediaQueryData(padding: const EdgeInsets.only(bottom: 100.0)), child: new Scaffold( appBar: new AppBar(title: new Text('Title')), body: new Container(key: bodyKey), @@ -38,7 +38,7 @@ void main() { )); 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 { @@ -137,7 +137,7 @@ void main() { new MaterialApp( theme: new ThemeData(platform: TargetPlatform.iOS), 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( scrollableKey: scrollableKey, appBar: new AppBar( @@ -159,7 +159,7 @@ void main() { expect(scrollableKey.currentState.scrollOffset, equals(500.0)); await tester.tapAt(const Point(100.0, 10.0)); await tester.pump(); - await tester.pump(new Duration(seconds: 1)); + await tester.pump(const Duration(seconds: 1)); expect(scrollableKey.currentState.scrollOffset, equals(0.0)); }); @@ -171,7 +171,7 @@ void main() { new MaterialApp( theme: new ThemeData(platform: TargetPlatform.android), 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( scrollableKey: scrollableKey, appBar: new AppBar( @@ -193,7 +193,7 @@ void main() { expect(scrollableKey.currentState.scrollOffset, equals(500.0)); await tester.tapAt(const Point(100.0, 10.0)); await tester.pump(); - await tester.pump(new Duration(seconds: 1)); + await tester.pump(const Duration(seconds: 1)); expect(scrollableKey.currentState.scrollOffset, equals(500.0)); }); diff --git a/packages/flutter/test/material/snack_bar_test.dart b/packages/flutter/test/material/snack_bar_test.dart index eb5be6ad18..97eeda1583 100644 --- a/packages/flutter/test/material/snack_bar_test.dart +++ b/packages/flutter/test/material/snack_bar_test.dart @@ -17,7 +17,7 @@ void main() { onTap: () { Scaffold.of(context).showSnackBar(new SnackBar( content: new Text(helloSnackBar), - duration: new Duration(seconds: 2) + duration: const Duration(seconds: 2) )); }, behavior: HitTestBehavior.opaque, @@ -38,16 +38,16 @@ void main() { expect(find.text(helloSnackBar), findsOneWidget); await tester.pump(); // begin animation expect(find.text(helloSnackBar), findsOneWidget); - await tester.pump(new Duration(milliseconds: 750)); // 0.75s // animation last frame; two second timer starts here + await tester.pump(const Duration(milliseconds: 750)); // 0.75s // animation last frame; two second timer starts here expect(find.text(helloSnackBar), findsOneWidget); - await tester.pump(new Duration(milliseconds: 750)); // 1.50s + await tester.pump(const Duration(milliseconds: 750)); // 1.50s expect(find.text(helloSnackBar), findsOneWidget); - await tester.pump(new Duration(milliseconds: 750)); // 2.25s + await tester.pump(const Duration(milliseconds: 750)); // 2.25s expect(find.text(helloSnackBar), findsOneWidget); - await tester.pump(new Duration(milliseconds: 750)); // 3.00s // timer triggers to dismiss snackbar, reverse animation is scheduled + await tester.pump(const Duration(milliseconds: 750)); // 3.00s // timer triggers to dismiss snackbar, reverse animation is scheduled await tester.pump(); // begin animation expect(find.text(helloSnackBar), findsOneWidget); // frame 0 of dismiss animation - await tester.pump(new Duration(milliseconds: 750)); // 3.75s // last frame of animation, snackbar removed from build + await tester.pump(const Duration(milliseconds: 750)); // 3.75s // last frame of animation, snackbar removed from build expect(find.text(helloSnackBar), findsNothing); }); @@ -63,7 +63,7 @@ void main() { snackBarCount += 1; Scaffold.of(context).showSnackBar(new SnackBar( content: new Text("bar$snackBarCount"), - duration: new Duration(seconds: 2) + duration: const Duration(seconds: 2) )); }, behavior: HitTestBehavior.opaque, @@ -89,39 +89,39 @@ void main() { await tester.pump(); // begin animation expect(find.text('bar1'), findsOneWidget); expect(find.text('bar2'), findsNothing); - await tester.pump(new Duration(milliseconds: 750)); // 0.75s // animation last frame; two second timer starts here + await tester.pump(const Duration(milliseconds: 750)); // 0.75s // animation last frame; two second timer starts here expect(find.text('bar1'), findsOneWidget); expect(find.text('bar2'), findsNothing); - await tester.pump(new Duration(milliseconds: 750)); // 1.50s + await tester.pump(const Duration(milliseconds: 750)); // 1.50s expect(find.text('bar1'), findsOneWidget); expect(find.text('bar2'), findsNothing); - await tester.pump(new Duration(milliseconds: 750)); // 2.25s + await tester.pump(const Duration(milliseconds: 750)); // 2.25s expect(find.text('bar1'), findsOneWidget); expect(find.text('bar2'), findsNothing); - await tester.pump(new Duration(milliseconds: 750)); // 3.00s // timer triggers to dismiss snackbar, reverse animation is scheduled + await tester.pump(const Duration(milliseconds: 750)); // 3.00s // timer triggers to dismiss snackbar, reverse animation is scheduled await tester.pump(); // begin animation expect(find.text('bar1'), findsOneWidget); expect(find.text('bar2'), findsNothing); - await tester.pump(new Duration(milliseconds: 750)); // 3.75s // last frame of animation, snackbar removed from build, new snack bar put in its place + await tester.pump(const Duration(milliseconds: 750)); // 3.75s // last frame of animation, snackbar removed from build, new snack bar put in its place expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsOneWidget); await tester.pump(); // begin animation expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsOneWidget); - await tester.pump(new Duration(milliseconds: 750)); // 4.50s // animation last frame; two second timer starts here + await tester.pump(const Duration(milliseconds: 750)); // 4.50s // animation last frame; two second timer starts here expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsOneWidget); - await tester.pump(new Duration(milliseconds: 750)); // 5.25s + await tester.pump(const Duration(milliseconds: 750)); // 5.25s expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsOneWidget); - await tester.pump(new Duration(milliseconds: 750)); // 6.00s + await tester.pump(const Duration(milliseconds: 750)); // 6.00s expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsOneWidget); - await tester.pump(new Duration(milliseconds: 750)); // 6.75s // timer triggers to dismiss snackbar, reverse animation is scheduled + await tester.pump(const Duration(milliseconds: 750)); // 6.75s // timer triggers to dismiss snackbar, reverse animation is scheduled await tester.pump(); // begin animation expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsOneWidget); - await tester.pump(new Duration(milliseconds: 750)); // 7.50s // last frame of animation, snackbar removed from build, new snack bar put in its place + await tester.pump(const Duration(milliseconds: 750)); // 7.50s // last frame of animation, snackbar removed from build, new snack bar put in its place expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsNothing); }); @@ -169,45 +169,45 @@ void main() { await tester.pump(); // begin animation expect(find.text('bar1'), findsOneWidget); expect(find.text('bar2'), findsNothing); - await tester.pump(new Duration(milliseconds: 750)); // 0.75s // animation last frame; two second timer starts here + await tester.pump(const Duration(milliseconds: 750)); // 0.75s // animation last frame; two second timer starts here expect(find.text('bar1'), findsOneWidget); expect(find.text('bar2'), findsNothing); - await tester.pump(new Duration(milliseconds: 750)); // 1.50s + await tester.pump(const Duration(milliseconds: 750)); // 1.50s expect(find.text('bar1'), findsOneWidget); expect(find.text('bar2'), findsNothing); - await tester.pump(new Duration(milliseconds: 750)); // 2.25s + await tester.pump(const Duration(milliseconds: 750)); // 2.25s expect(find.text('bar1'), findsOneWidget); expect(find.text('bar2'), findsNothing); - await tester.pump(new Duration(milliseconds: 10000)); // 12.25s + await tester.pump(const Duration(milliseconds: 10000)); // 12.25s expect(find.text('bar1'), findsOneWidget); expect(find.text('bar2'), findsNothing); firstController.close(); // snackbar is manually dismissed - await tester.pump(new Duration(milliseconds: 750)); // 13.00s // reverse animation is scheduled + await tester.pump(const Duration(milliseconds: 750)); // 13.00s // reverse animation is scheduled await tester.pump(); // begin animation expect(find.text('bar1'), findsOneWidget); expect(find.text('bar2'), findsNothing); - await tester.pump(new Duration(milliseconds: 750)); // 13.75s // last frame of animation, snackbar removed from build, new snack bar put in its place + await tester.pump(const Duration(milliseconds: 750)); // 13.75s // last frame of animation, snackbar removed from build, new snack bar put in its place expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsOneWidget); await tester.pump(); // begin animation expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsOneWidget); - await tester.pump(new Duration(milliseconds: 750)); // 14.50s // animation last frame; two second timer starts here + await tester.pump(const Duration(milliseconds: 750)); // 14.50s // animation last frame; two second timer starts here expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsOneWidget); - await tester.pump(new Duration(milliseconds: 750)); // 15.25s + await tester.pump(const Duration(milliseconds: 750)); // 15.25s expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsOneWidget); - await tester.pump(new Duration(milliseconds: 750)); // 16.00s + await tester.pump(const Duration(milliseconds: 750)); // 16.00s expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsOneWidget); - await tester.pump(new Duration(milliseconds: 750)); // 16.75s // timer triggers to dismiss snackbar, reverse animation is scheduled + await tester.pump(const Duration(milliseconds: 750)); // 16.75s // timer triggers to dismiss snackbar, reverse animation is scheduled await tester.pump(); // begin animation expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsOneWidget); - await tester.pump(new Duration(milliseconds: 750)); // 17.50s // last frame of animation, snackbar removed from build, new snack bar put in its place + await tester.pump(const Duration(milliseconds: 750)); // 17.50s // last frame of animation, snackbar removed from build, new snack bar put in its place expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsNothing); }); @@ -224,7 +224,7 @@ void main() { snackBarCount += 1; Scaffold.of(context).showSnackBar(new SnackBar( content: new Text("bar$snackBarCount"), - duration: new Duration(seconds: 2) + duration: const Duration(seconds: 2) )); }, behavior: HitTestBehavior.opaque, @@ -250,8 +250,8 @@ void main() { await tester.pump(); // begin animation expect(find.text('bar1'), findsOneWidget); expect(find.text('bar2'), findsNothing); - await tester.pump(new Duration(milliseconds: 750)); // 0.75s // animation last frame; two second timer starts here - await tester.scroll(find.text('bar1'), new Offset(0.0, 50.0)); + await tester.pump(const Duration(milliseconds: 750)); // 0.75s // animation last frame; two second timer starts here + await tester.scroll(find.text('bar1'), const Offset(0.0, 50.0)); await tester.pump(); // bar1 dismissed, bar2 begins animating expect(find.text('bar1'), findsNothing); expect(find.text('bar2'), findsOneWidget); @@ -267,7 +267,7 @@ void main() { onTap: () { Scaffold.of(context).showSnackBar(new SnackBar( content: new Text('I am a snack bar.'), - duration: new Duration(seconds: 2), + duration: const Duration(seconds: 2), action: new SnackBarAction( label: 'ACTION', onPressed: () { @@ -305,7 +305,7 @@ void main() { onTap: () { Scaffold.of(context).showSnackBar(new SnackBar( content: new Text('I am a snack bar.'), - duration: new Duration(seconds: 2), + duration: const Duration(seconds: 2), action: new SnackBarAction(label: 'ACTION', onPressed: () {}) )); }, @@ -349,7 +349,7 @@ void main() { onTap: () { Scaffold.of(context).showSnackBar(new SnackBar( content: new Text('snack'), - duration: new Duration(seconds: 2), + duration: const Duration(seconds: 2), action: new SnackBarAction( label: 'ACTION', onPressed: () { @@ -381,7 +381,7 @@ void main() { await tester.tap(find.text('X')); await tester.pump(const Duration(milliseconds: 750)); await tester.pump(const Duration(milliseconds: 750)); - await tester.scroll(find.text('snack'), new Offset(0.0, 50.0)); + await tester.scroll(find.text('snack'), const Offset(0.0, 50.0)); await tester.pump(); expect(closedReason, equals(SnackBarClosedReason.swipe)); @@ -401,11 +401,11 @@ void main() { // Pop up the snack bar and then let it time out. await tester.tap(find.text('X')); - await tester.pump(new Duration(milliseconds: 750)); - await tester.pump(new Duration(milliseconds: 750)); - await tester.pump(new Duration(milliseconds: 1500)); + await tester.pump(const Duration(milliseconds: 750)); + await tester.pump(const Duration(milliseconds: 750)); + await tester.pump(const Duration(milliseconds: 1500)); await tester.pump(); // begin animation - await tester.pump(new Duration(milliseconds: 750)); + await tester.pump(const Duration(milliseconds: 750)); expect(closedReason, equals(SnackBarClosedReason.timeout)); }); diff --git a/packages/flutter/test/material/stepper_test.dart b/packages/flutter/test/material/stepper_test.dart index 2819c12338..d3bed31f7d 100644 --- a/packages/flutter/test/material/stepper_test.dart +++ b/packages/flutter/test/material/stepper_test.dart @@ -18,14 +18,14 @@ void main() { steps: [ new Step( title: new Text('Step 1'), - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 100.0 ) ), new Step( title: new Text('Step 2'), - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 100.0 ) @@ -47,14 +47,14 @@ void main() { steps: [ new Step( title: new Text('Step 1'), - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 100.0 ) ), new Step( title: new Text('Step 2'), - content: new SizedBox( + content: const SizedBox( width: 200.0, height: 200.0 ) @@ -76,14 +76,14 @@ void main() { steps: [ new Step( title: new Text('Step 1'), - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 100.0 ) ), new Step( title: new Text('Step 2'), - content: new SizedBox( + content: const SizedBox( width: 200.0, height: 200.0 ) @@ -111,7 +111,7 @@ void main() { steps: [ new Step( title: new Text('Step 1'), - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 100.0 ) @@ -188,14 +188,14 @@ void main() { steps: [ new Step( title: new Text('Step 1'), - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 100.0 ) ), new Step( title: new Text('Step 2'), - content: new SizedBox( + content: const SizedBox( width: 200.0, height: 200.0 ) @@ -224,7 +224,7 @@ void main() { steps: [ new Step( title: new Text('Step 1'), - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 100.0 ) @@ -232,7 +232,7 @@ void main() { new Step( title: new Text('Step 2'), state: StepState.disabled, - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 100.0 ) @@ -253,21 +253,21 @@ void main() { steps: [ new Step( title: new Text('Step 1'), - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 300.0 ) ), new Step( title: new Text('Step 2'), - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 300.0 ) ), new Step( title: new Text('Step 3'), - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 100.0 ) @@ -288,21 +288,21 @@ void main() { steps: [ new Step( title: new Text('Step 1'), - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 300.0 ) ), new Step( title: new Text('Step 2'), - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 300.0 ) ), new Step( title: new Text('Step 3'), - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 100.0 ) @@ -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)); }); @@ -325,14 +325,14 @@ void main() { new Step( title: new Text('A'), state: StepState.complete, - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 100.0 ) ), new Step( title: new Text('B'), - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 100.0 ) @@ -356,7 +356,7 @@ void main() { new Step( title: new Text('A'), state: StepState.error, - content: new SizedBox( + content: const SizedBox( width: 100.0, height: 100.0 ) diff --git a/packages/flutter/test/material/tabs_test.dart b/packages/flutter/test/material/tabs_test.dart index 623b5126bf..8d3d5d08af 100644 --- a/packages/flutter/test/material/tabs_test.dart +++ b/packages/flutter/test/material/tabs_test.dart @@ -211,7 +211,7 @@ void main() { await tester.pumpWidget(builder()); 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(); expect(value, equals(tabs[0])); findStateMarkerState(tabs[1]).marker = 'marked'; @@ -225,7 +225,7 @@ void main() { // Move to the third tab. 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 tester.pump(); expect(findStateMarkerState(tabs[1]).marker, equals('marked')); @@ -240,7 +240,7 @@ void main() { // Move back to the second tab. 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(); StateMarkerState markerState = findStateMarkerState(tabs[1]); expect(markerState.marker, isNull); @@ -267,7 +267,7 @@ void main() { // Fling to the left, switch from the 'LEFT' tab to the 'RIGHT' 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(const Duration(seconds: 1)); // finish the scroll animation expect(selection.value, equals('RIGHT')); @@ -276,7 +276,7 @@ void main() { // Fling to the right, switch back to the 'LEFT' tab 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(const Duration(seconds: 1)); // finish the scroll animation expect(selection.value, equals('LEFT')); @@ -301,7 +301,7 @@ void main() { // a change to the selected tab, everything should just settle back to // to where it started. 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(const Duration(seconds: 1)); // finish the scroll animation expect(selection.value, equals('LEFT')); @@ -342,7 +342,7 @@ void main() { ); // 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(const Duration(seconds: 1)); // finish the scroll animation final RenderBox box = tester.renderObject(find.text('BBBBBB')); diff --git a/packages/flutter/test/material/theme_test.dart b/packages/flutter/test/material/theme_test.dart index 6e5af20714..311af3c2d3 100644 --- a/packages/flutter/test/material/theme_test.dart +++ b/packages/flutter/test/material/theme_test.dart @@ -200,7 +200,7 @@ void main() { showDialog( context: context, child: new Scaffold( - body: new SizedBox( + body: const SizedBox( width: 200.0, height: 200.0, ), diff --git a/packages/flutter/test/painting/box_painter_test.dart b/packages/flutter/test/painting/box_painter_test.dart index abaccb5abf..d303435fcb 100644 --- a/packages/flutter/test/painting/box_painter_test.dart +++ b/packages/flutter/test/painting/box_painter_test.dart @@ -7,7 +7,7 @@ import 'package:flutter/painting.dart'; void main() { test("BorderSide control test", () { - BorderSide side1 = new BorderSide(); + BorderSide side1 = const BorderSide(); BorderSide side2 = side1.copyWith( color: const Color(0xFF00FFFF), width: 2.0, @@ -55,13 +55,13 @@ void main() { }); 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 shadow3 = BoxShadow.lerp(shadow1, null, 0.25); expect(shadow1, hasOneLineDescription); 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(shadow3.blurRadius, equals(3.0)); diff --git a/packages/flutter/test/painting/decoration_test.dart b/packages/flutter/test/painting/decoration_test.dart index e9f30767fe..356541b17a 100644 --- a/packages/flutter/test/painting/decoration_test.dart +++ b/packages/flutter/test/painting/decoration_test.dart @@ -47,8 +47,8 @@ class AsyncTestImageProvider extends ImageProvider { void main() { test("Decoration.lerp()", () { - BoxDecoration a = new BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)); - BoxDecoration b = new BoxDecoration(backgroundColor: const Color(0x00000000)); + BoxDecoration a = const BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)); + BoxDecoration b = const BoxDecoration(backgroundColor: const Color(0x00000000)); BoxDecoration c = Decoration.lerp(a, b, 0.0); expect(c.backgroundColor, equals(a.backgroundColor)); @@ -71,7 +71,7 @@ void main() { }); TestCanvas canvas = new TestCanvas(); - ImageConfiguration imageConfiguration = new ImageConfiguration(size: Size.zero); + ImageConfiguration imageConfiguration = const ImageConfiguration(size: Size.zero); boxPainter.paint(canvas, Offset.zero, imageConfiguration); // The onChanged callback should not be invoked during the call to boxPainter.paint @@ -90,7 +90,7 @@ void main() { }); TestCanvas canvas = new TestCanvas(); - ImageConfiguration imageConfiguration = new ImageConfiguration(size: Size.zero); + ImageConfiguration imageConfiguration = const ImageConfiguration(size: Size.zero); boxPainter.paint(canvas, Offset.zero, imageConfiguration); // The onChanged callback should be invoked asynchronously. diff --git a/packages/flutter/test/painting/edge_insets_test.dart b/packages/flutter/test/painting/edge_insets_test.dart index 672e2c5104..9eccb9e6be 100644 --- a/packages/flutter/test/painting/edge_insets_test.dart +++ b/packages/flutter/test/painting/edge_insets_test.dart @@ -8,8 +8,8 @@ import 'package:test/test.dart'; void main() { test("EdgeInsets.lerp()", () { - EdgeInsets a = new EdgeInsets.all(10.0); - EdgeInsets b = new EdgeInsets.all(20.0); + EdgeInsets a = const EdgeInsets.all(10.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(b * 0.625)); expect(EdgeInsets.lerp(a, b, 0.25), equals(a + const EdgeInsets.all(2.5))); diff --git a/packages/flutter/test/painting/paint_image_test.dart b/packages/flutter/test/painting/paint_image_test.dart index 7b3f36e7a3..252668a170 100644 --- a/packages/flutter/test/painting/paint_image_test.dart +++ b/packages/flutter/test/painting/paint_image_test.dart @@ -39,7 +39,7 @@ void main() { rect: new Rect.fromLTWH(50.0, 75.0, 200.0, 100.0), image: image, fit: ImageFit.cover, - alignment: new FractionalOffset(0.0, 0.5) + alignment: const FractionalOffset(0.0, 0.5) ); Invocation command = canvas.invocations.firstWhere((Invocation invocation) { diff --git a/packages/flutter/test/painting/text_span_test.dart b/packages/flutter/test/painting/text_span_test.dart index cd9c521899..951ca73fa4 100644 --- a/packages/flutter/test/painting/text_span_test.dart +++ b/packages/flutter/test/painting/text_span_test.dart @@ -8,12 +8,12 @@ import 'package:test/test.dart'; void main() { test('TextSpan equals', () { - TextSpan a1 = new TextSpan(text: 'a'); - TextSpan a2 = new TextSpan(text: 'a'); + TextSpan a1 = new TextSpan(text: 'a'); // ignore: prefer_const_constructor + TextSpan a2 = new TextSpan(text: 'a'); // ignore: prefer_const_constructor TextSpan b1 = new TextSpan(children: [ a1 ]); TextSpan b2 = new TextSpan(children: [ a2 ]); - TextSpan c1 = new TextSpan(); - TextSpan c2 = new TextSpan(); + TextSpan c1 = new TextSpan(); // ignore: prefer_const_constructor + TextSpan c2 = new TextSpan(); // ignore: prefer_const_constructor expect(a1 == a2, isTrue); expect(b1 == b2, isTrue); @@ -29,20 +29,20 @@ void main() { }); test('TextSpan', () { - final TextSpan test = new TextSpan( + final TextSpan test = const TextSpan( text: 'a', - style: new TextStyle( + style: const TextStyle( fontSize: 10.0 ), - children: [ - new TextSpan( + children: const [ + const TextSpan( text: 'b', - children: [ - new TextSpan() + children: const [ + const TextSpan() ] ), null, - new TextSpan( + const TextSpan( text: 'c' ), ] diff --git a/packages/flutter/test/physics/newton_test.dart b/packages/flutter/test/physics/newton_test.dart index 5b7aa56669..b99220cea5 100644 --- a/packages/flutter/test/physics/newton_test.dart +++ b/packages/flutter/test/physics/newton_test.dart @@ -119,7 +119,7 @@ void main() { // Just so we don't forget how to create a desc without the ratio. 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); expect(other.type, SpringType.criticallyDamped); }); @@ -261,7 +261,7 @@ void main() { spring: spring, 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.x(0.0), closeTo(500.0, .0001)); diff --git a/packages/flutter/test/rendering/baseline_test.dart b/packages/flutter/test/rendering/baseline_test.dart index 1e77f03b8a..b9cf37fca7 100644 --- a/packages/flutter/test/rendering/baseline_test.dart +++ b/packages/flutter/test/rendering/baseline_test.dart @@ -17,7 +17,7 @@ void main() { child: parent = new RenderBaseline( baseline: 0.0, 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; @@ -25,30 +25,30 @@ void main() { layout(root, phase: EnginePhase.layout); expect(childParentData.offset.dx, equals(0.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; pumpFrame(phase: EnginePhase.layout); expect(childParentData.offset.dx, equals(0.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; pumpFrame(phase: EnginePhase.layout); expect(childParentData.offset.dx, equals(0.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; pumpFrame(phase: EnginePhase.layout); expect(childParentData.offset.dx, 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; pumpFrame(phase: EnginePhase.layout); expect(childParentData.offset.dx, equals(0.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))); }); } diff --git a/packages/flutter/test/rendering/box_constraints_test.dart b/packages/flutter/test/rendering/box_constraints_test.dart index e44125745e..0287880983 100644 --- a/packages/flutter/test/rendering/box_constraints_test.dart +++ b/packages/flutter/test/rendering/box_constraints_test.dart @@ -8,12 +8,12 @@ import 'package:test/test.dart'; void main() { test('BoxConstraints toString', () { expect(const BoxConstraints.expand().toString(), contains('biggest')); - expect(new BoxConstraints().toString(), contains('unconstrained')); - expect(new BoxConstraints.tightFor(width: 50.0).toString(), contains('w=50')); + expect(const BoxConstraints().toString(), contains('unconstrained')); + expect(const BoxConstraints.tightFor(width: 50.0).toString(), contains('w=50')); }); test('BoxConstraints copyWith', () { - BoxConstraints constraints = new BoxConstraints( + BoxConstraints constraints = const BoxConstraints( minWidth: 3.0, maxWidth: 7.0, minHeight: 11.0, @@ -36,7 +36,7 @@ void main() { }); test('BoxConstraints operators', () { - BoxConstraints constraints = new BoxConstraints( + BoxConstraints constraints = const BoxConstraints( minWidth: 3.0, maxWidth: 7.0, minHeight: 11.0, @@ -62,7 +62,7 @@ void main() { test('BoxConstraints lerp', () { expect(BoxConstraints.lerp(null, null, 0.5), isNull); - BoxConstraints constraints = new BoxConstraints( + BoxConstraints constraints = const BoxConstraints( minWidth: 3.0, maxWidth: 7.0, minHeight: 11.0, @@ -78,7 +78,7 @@ void main() { expect(copy.maxWidth, 3.5); expect(copy.minHeight, 5.5); expect(copy.maxHeight, 8.5); - copy = BoxConstraints.lerp(new BoxConstraints( + copy = BoxConstraints.lerp(const BoxConstraints( minWidth: 13.0, maxWidth: 17.0, minHeight: 111.0, @@ -91,7 +91,7 @@ void main() { }); test('BoxConstraints normalize', () { - BoxConstraints constraints = new BoxConstraints( + BoxConstraints constraints = const BoxConstraints( minWidth: 3.0, maxWidth: 2.0, minHeight: 11.0, diff --git a/packages/flutter/test/rendering/box_test.dart b/packages/flutter/test/rendering/box_test.dart index dc03fd4420..415d24bc2d 100644 --- a/packages/flutter/test/rendering/box_test.dart +++ b/packages/flutter/test/rendering/box_test.dart @@ -27,16 +27,16 @@ void main() { test('Flex and padding', () { RenderBox size = new RenderConstrainedBox( - additionalConstraints: new BoxConstraints().tighten(height: 100.0), + additionalConstraints: const BoxConstraints().tighten(height: 100.0), ); RenderBox inner = new RenderDecoratedBox( - decoration: new BoxDecoration( + decoration: const BoxDecoration( backgroundColor: const Color(0xFF00FF00), ), child: size, ); RenderBox padding = new RenderPadding( - padding: new EdgeInsets.all(50.0), + padding: const EdgeInsets.all(50.0), child: inner, ); RenderBox flex = new RenderFlex( @@ -45,7 +45,7 @@ void main() { crossAxisAlignment: CrossAxisAlignment.stretch, ); RenderBox outer = new RenderDecoratedBox( - decoration: new BoxDecoration( + decoration: const BoxDecoration( backgroundColor: const Color(0xFF0000FF) ), child: flex, @@ -67,14 +67,14 @@ void main() { test("should not have a 0 sized colored Box", () { RenderBox coloredBox = new RenderDecoratedBox( - decoration: new BoxDecoration(), + decoration: const BoxDecoration(), ); RenderBox paddingBox = new RenderPadding( padding: const EdgeInsets.all(10.0), child: coloredBox, ); RenderBox root = new RenderDecoratedBox( - decoration: new BoxDecoration(), + decoration: const BoxDecoration(), child: paddingBox, ); layout(root); @@ -84,7 +84,7 @@ void main() { test("reparenting should clear position", () { RenderDecoratedBox coloredBox = new RenderDecoratedBox( - decoration: new BoxDecoration(), + decoration: const BoxDecoration(), ); RenderPadding paddedBox = new RenderPadding( diff --git a/packages/flutter/test/rendering/dynamic_intrinsics_test.dart b/packages/flutter/test/rendering/dynamic_intrinsics_test.dart index 33a9082b6d..5eac2397e5 100644 --- a/packages/flutter/test/rendering/dynamic_intrinsics_test.dart +++ b/packages/flutter/test/rendering/dynamic_intrinsics_test.dart @@ -66,7 +66,7 @@ void main() { child: inner = new RenderFixedSize() ) ), - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 0.0, minHeight: 0.0, maxWidth: 1000.0, diff --git a/packages/flutter/test/rendering/flex_test.dart b/packages/flutter/test/rendering/flex_test.dart index fd5e6fa6e3..12d3bd0bf6 100644 --- a/packages/flutter/test/rendering/flex_test.dart +++ b/packages/flutter/test/rendering/flex_test.dart @@ -9,7 +9,7 @@ import 'rendering_tester.dart'; void main() { test('Overconstrained flex', () { - RenderDecoratedBox box = new RenderDecoratedBox(decoration: new BoxDecoration()); + RenderDecoratedBox box = new RenderDecoratedBox(decoration: const BoxDecoration()); RenderFlex flex = new RenderFlex(children: [box]); layout(flex, constraints: const BoxConstraints( minWidth: 200.0, maxWidth: 200.0, minHeight: 200.0, maxHeight: 200.0) @@ -26,13 +26,13 @@ void main() { RenderFlex flex = new RenderFlex( direction: Axis.vertical, children: [ - new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(height: 200.0)), + new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(height: 200.0)), flexible, ] ); FlexParentData flexParentData = flexible.parentData; 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); expect(flexible.size.height, equals(0.0)); expect(flex.getMinIntrinsicHeight(100.0), equals(200.0)); @@ -48,13 +48,13 @@ void main() { RenderFlex flex = new RenderFlex( direction: Axis.horizontal, children: [ - new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 200.0)), + new RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 200.0)), flexible, ] ); FlexParentData flexParentData = flexible.parentData; 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); expect(flexible.size.width, equals(0.0)); expect(flex.getMinIntrinsicHeight(100.0), equals(0.0)); @@ -70,7 +70,7 @@ void main() { 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); expect(flex.getMaxIntrinsicWidth(200.0), equals(0.0)); }); @@ -85,8 +85,8 @@ void main() { }); test('Parent data', () { - RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: new BoxDecoration()); - RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: new BoxDecoration()); + RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: const BoxDecoration()); + RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: const BoxDecoration()); RenderFlex flex = new RenderFlex(children: [box1, box2]); layout(flex, constraints: const BoxConstraints( minWidth: 0.0, maxWidth: 100.0, minHeight: 0.0, maxHeight: 100.0) @@ -107,8 +107,8 @@ void main() { }); test('Stretch', () { - RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: new BoxDecoration()); - RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: new BoxDecoration()); + RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: const BoxDecoration()); + RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: const BoxDecoration()); RenderFlex flex = new RenderFlex(); flex.setupParentData(box2); final FlexParentData box2ParentData = box2.parentData; @@ -138,9 +138,9 @@ void main() { }); test('Space evenly', () { - RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); - RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); - RenderConstrainedBox box3 = 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: const 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); flex.addAll([box1, box2, box3]); layout(flex, constraints: const BoxConstraints( @@ -168,9 +168,9 @@ void main() { }); test('Fit.loose', () { - RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); - RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); - RenderConstrainedBox box3 = 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: const 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); flex.addAll([box1, box2, box3]); layout(flex, constraints: const BoxConstraints( @@ -204,7 +204,7 @@ void main() { expect(getOffset(box3).dx, equals(400.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(); expect(getOffset(box1).dx, equals(0.0)); @@ -216,9 +216,9 @@ void main() { }); test('Flexible with MainAxisSize.min', () { - RenderConstrainedBox box1 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); - RenderConstrainedBox box2 = new RenderConstrainedBox(additionalConstraints: new BoxConstraints.tightFor(width: 100.0, height: 100.0)); - RenderConstrainedBox box3 = 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: const 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( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.spaceBetween diff --git a/packages/flutter/test/rendering/grid_test.dart b/packages/flutter/test/rendering/grid_test.dart index f2d885f1ca..b8ac493f32 100644 --- a/packages/flutter/test/rendering/grid_test.dart +++ b/packages/flutter/test/rendering/grid_test.dart @@ -10,10 +10,10 @@ import 'rendering_tester.dart'; void main() { test('Basic grid layout test', () { List children = [ - new RenderDecoratedBox(decoration: new BoxDecoration()), - new RenderDecoratedBox(decoration: new BoxDecoration()), - new RenderDecoratedBox(decoration: new BoxDecoration()), - new RenderDecoratedBox(decoration: new BoxDecoration()) + new RenderDecoratedBox(decoration: const BoxDecoration()), + new RenderDecoratedBox(decoration: const BoxDecoration()), + new RenderDecoratedBox(decoration: const BoxDecoration()), + new RenderDecoratedBox(decoration: const BoxDecoration()) ]; RenderGrid grid = new RenderGrid( diff --git a/packages/flutter/test/rendering/image_test.dart b/packages/flutter/test/rendering/image_test.dart index f5e30613f1..afe17994cb 100644 --- a/packages/flutter/test/rendering/image_test.dart +++ b/packages/flutter/test/rendering/image_test.dart @@ -48,7 +48,7 @@ void main() { image = new RenderImage(image: new SquareImage()); layout(image, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 25.0, minHeight: 25.0, maxWidth: 100.0, @@ -58,7 +58,7 @@ void main() { image = new RenderImage(image: new WideImage()); layout(image, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 5.0, minHeight: 30.0, maxWidth: 100.0, @@ -68,7 +68,7 @@ void main() { image = new RenderImage(image: new TallImage()); layout(image, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 50.0, minHeight: 5.0, maxWidth: 75.0, @@ -78,7 +78,7 @@ void main() { image = new RenderImage(image: new WideImage()); layout(image, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 5.0, minHeight: 5.0, maxWidth: 100.0, @@ -88,7 +88,7 @@ void main() { image = new RenderImage(image: new WideImage()); layout(image, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 5.0, minHeight: 5.0, maxWidth: 16.0, @@ -98,7 +98,7 @@ void main() { image = new RenderImage(image: new TallImage()); layout(image, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 5.0, minHeight: 5.0, maxWidth: 16.0, @@ -108,7 +108,7 @@ void main() { image = new RenderImage(image: new SquareImage()); layout(image, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 4.0, minHeight: 4.0, maxWidth: 8.0, @@ -118,7 +118,7 @@ void main() { image = new RenderImage(image: new WideImage()); layout(image, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 20.0, minHeight: 20.0, maxWidth: 30.0, @@ -128,7 +128,7 @@ void main() { image = new RenderImage(image: new TallImage()); layout(image, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 20.0, minHeight: 20.0, maxWidth: 30.0, @@ -142,7 +142,7 @@ void main() { image = new RenderImage(); layout(image, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 25.0, minHeight: 25.0, maxWidth: 100.0, @@ -152,7 +152,7 @@ void main() { image = new RenderImage(width: 50.0); layout(image, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 25.0, minHeight: 25.0, maxWidth: 100.0, @@ -162,7 +162,7 @@ void main() { image = new RenderImage(height: 50.0); layout(image, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 25.0, minHeight: 25.0, maxWidth: 100.0, @@ -172,7 +172,7 @@ void main() { image = new RenderImage(width: 100.0, height: 100.0); layout(image, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 25.0, minHeight: 25.0, maxWidth: 75.0, diff --git a/packages/flutter/test/rendering/independent_layout_test.dart b/packages/flutter/test/rendering/independent_layout_test.dart index 91e7837d46..aa896137d0 100644 --- a/packages/flutter/test/rendering/independent_layout_test.dart +++ b/packages/flutter/test/rendering/independent_layout_test.dart @@ -18,7 +18,7 @@ class TestLayout { onPaint: () { painted = true; } ), 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 { } void main() { - final ViewConfiguration testConfiguration = new ViewConfiguration( + final ViewConfiguration testConfiguration = const ViewConfiguration( size: const Size(800.0, 600.0), devicePixelRatio: 1.0 ); diff --git a/packages/flutter/test/rendering/intrinsic_width_test.dart b/packages/flutter/test/rendering/intrinsic_width_test.dart index 94f9fd5690..f14aa66c12 100644 --- a/packages/flutter/test/rendering/intrinsic_width_test.dart +++ b/packages/flutter/test/rendering/intrinsic_width_test.dart @@ -45,10 +45,10 @@ class RenderTestBox extends RenderBox { void main() { 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); layout(parent, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 5.0, minHeight: 8.0, maxWidth: 500.0, @@ -80,10 +80,10 @@ void main() { }); 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); layout(parent, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 5.0, minHeight: 8.0, maxWidth: 500.0, @@ -115,10 +115,10 @@ void main() { }); 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); layout(parent, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 5.0, minHeight: 8.0, maxWidth: 500.0, @@ -150,10 +150,10 @@ void main() { }); 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); layout(parent, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 5.0, minHeight: 8.0, maxWidth: 500.0, @@ -185,10 +185,10 @@ void main() { }); 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); layout(parent, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 5.0, minHeight: 8.0, maxWidth: 500.0, @@ -221,7 +221,7 @@ void main() { test('Padding and boring intrinsics', () { 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)) ); @@ -248,7 +248,7 @@ void main() { // also a smoke test: layout( box, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 10.0, minHeight: 10.0, maxWidth: 10.0, @@ -259,7 +259,7 @@ void main() { test('Padding and interesting intrinsics', () { RenderBox box = new RenderPadding( - padding: new EdgeInsets.all(15.0), + padding: const EdgeInsets.all(15.0), child: new RenderAspectRatio(aspectRatio: 1.0) ); @@ -286,7 +286,7 @@ void main() { // also a smoke test: layout( box, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 10.0, minHeight: 10.0, maxWidth: 10.0, @@ -297,7 +297,7 @@ void main() { test('Padding and boring intrinsics', () { 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)) ); @@ -324,7 +324,7 @@ void main() { // also a smoke test: layout( box, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 10.0, minHeight: 10.0, maxWidth: 10.0, @@ -335,7 +335,7 @@ void main() { test('Padding and interesting intrinsics', () { RenderBox box = new RenderPadding( - padding: new EdgeInsets.all(15.0), + padding: const EdgeInsets.all(15.0), child: new RenderAspectRatio(aspectRatio: 1.0) ); @@ -362,7 +362,7 @@ void main() { // also a smoke test: layout( box, - constraints: new BoxConstraints( + constraints: const BoxConstraints( minWidth: 10.0, minHeight: 10.0, maxWidth: 10.0, diff --git a/packages/flutter/test/rendering/limited_box_test.dart b/packages/flutter/test/rendering/limited_box_test.dart index e0fd8d34aa..0f65eed0ec 100644 --- a/packages/flutter/test/rendering/limited_box_test.dart +++ b/packages/flutter/test/rendering/limited_box_test.dart @@ -11,7 +11,7 @@ import 'rendering_tester.dart'; void main() { test('parent max size is unconstrained', () { 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( minWidth: 0.0, @@ -31,7 +31,7 @@ void main() { test('parent maxWidth is unconstrained', () { 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( minWidth: 0.0, @@ -51,7 +51,7 @@ void main() { test('parent maxHeight is unconstrained', () { 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( minWidth: 500.0, diff --git a/packages/flutter/test/rendering/non_render_object_root_test.dart b/packages/flutter/test/rendering/non_render_object_root_test.dart index 728a7448bf..c6d8cb9d10 100644 --- a/packages/flutter/test/rendering/non_render_object_root_test.dart +++ b/packages/flutter/test/rendering/non_render_object_root_test.dart @@ -48,7 +48,7 @@ void main() { RealRoot root = new RealRoot( child = new RenderPositionedBox( 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()); diff --git a/packages/flutter/test/rendering/offstage_test.dart b/packages/flutter/test/rendering/offstage_test.dart index 87e7c6fac6..a6080d3c5d 100644 --- a/packages/flutter/test/rendering/offstage_test.dart +++ b/packages/flutter/test/rendering/offstage_test.dart @@ -21,7 +21,7 @@ void main() { onPaint: () { painted = true; } ), child: child = new RenderConstrainedBox( - additionalConstraints: new BoxConstraints.tightFor(height: 10.0, width: 10.0) + additionalConstraints: const BoxConstraints.tightFor(height: 10.0, width: 10.0) ) ) ) diff --git a/packages/flutter/test/rendering/overflow_test.dart b/packages/flutter/test/rendering/overflow_test.dart index c06e1b9598..63e03f0d63 100644 --- a/packages/flutter/test/rendering/overflow_test.dart +++ b/packages/flutter/test/rendering/overflow_test.dart @@ -15,7 +15,7 @@ void main() { root = new RenderPositionedBox( 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( onPaint: () { baseline1 = child.getDistanceToBaseline(TextBaseline.alphabetic); @@ -29,7 +29,7 @@ void main() { root = new RenderPositionedBox( child: new RenderCustomPaint( 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, alignment: const FractionalOffset(0.0, 0.0) ), diff --git a/packages/flutter/test/rendering/paragraph_intrinsics_test.dart b/packages/flutter/test/rendering/paragraph_intrinsics_test.dart index 0931e5faa7..69803f4a1c 100644 --- a/packages/flutter/test/rendering/paragraph_intrinsics_test.dart +++ b/packages/flutter/test/rendering/paragraph_intrinsics_test.dart @@ -8,8 +8,8 @@ import 'package:test/test.dart'; void main() { test('block and paragraph intrinsics', () { final RenderParagraph paragraph = new RenderParagraph( - new TextSpan( - style: new TextStyle(height: 1.0), + const TextSpan( + style: const TextStyle(height: 1.0), text: 'Hello World' ) ); diff --git a/packages/flutter/test/rendering/positioned_box_test.dart b/packages/flutter/test/rendering/positioned_box_test.dart index 399a05b71d..ad0c27da21 100644 --- a/packages/flutter/test/rendering/positioned_box_test.dart +++ b/packages/flutter/test/rendering/positioned_box_test.dart @@ -10,11 +10,11 @@ import 'rendering_tester.dart'; void main() { test('RenderPositionedBox expands', () { RenderConstrainedBox sizer = new RenderConstrainedBox( - additionalConstraints: new BoxConstraints.tight(new Size(100.0, 100.0)), - child: new RenderDecoratedBox(decoration: new BoxDecoration()) + additionalConstraints: new BoxConstraints.tight(const Size(100.0, 100.0)), + child: new RenderDecoratedBox(decoration: const BoxDecoration()) ); 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.height, equals(200.0), reason: "positioner height"); @@ -22,11 +22,11 @@ void main() { test('RenderPositionedBox shrink wraps', () { RenderConstrainedBox sizer = new RenderConstrainedBox( - additionalConstraints: new BoxConstraints.tight(new Size(100.0, 100.0)), - child: new RenderDecoratedBox(decoration: new BoxDecoration()) + additionalConstraints: new BoxConstraints.tight(const Size(100.0, 100.0)), + child: new RenderDecoratedBox(decoration: const BoxDecoration()) ); 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.height, equals(200.0), reason: "positioner height"); @@ -47,11 +47,11 @@ void main() { test('RenderPositionedBox width and height factors', () { RenderConstrainedBox sizer = new RenderConstrainedBox( - additionalConstraints: new BoxConstraints.tight(new Size(100.0, 100.0)), - child: new RenderDecoratedBox(decoration: new BoxDecoration()) + additionalConstraints: new BoxConstraints.tight(const Size(100.0, 100.0)), + child: new RenderDecoratedBox(decoration: const BoxDecoration()) ); 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.height, equals(0.0)); diff --git a/packages/flutter/test/rendering/reattach_test.dart b/packages/flutter/test/rendering/reattach_test.dart index a3935dd793..214b268f2e 100644 --- a/packages/flutter/test/rendering/reattach_test.dart +++ b/packages/flutter/test/rendering/reattach_test.dart @@ -19,7 +19,7 @@ class TestTree { // relayout/repaint of the new parent node to satisfy the test. child: new RenderRepaintBoundary( 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 RenderCustomPaint( painter: new TestCallbackPainter( @@ -27,7 +27,7 @@ class TestTree { ), child: new RenderPositionedBox( 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 { onPaint: () { painted = true; } ), 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() { expect(testTree.child.owner, isNull); // Dirty one of the elements testTree.child.additionalConstraints = - new BoxConstraints.tightFor(height: 5.0, width: 5.0); + const BoxConstraints.tightFor(height: 5.0, width: 5.0); // Lay out again layout(testTree.root, phase: EnginePhase.layout); expect(testTree.child.size, equals(const Size(5.0, 5.0))); diff --git a/packages/flutter/test/rendering/stack_test.dart b/packages/flutter/test/rendering/stack_test.dart index 41c9b6d269..03a6b30e59 100644 --- a/packages/flutter/test/rendering/stack_test.dart +++ b/packages/flutter/test/rendering/stack_test.dart @@ -14,14 +14,14 @@ void main() { ); RenderBox red = new RenderDecoratedBox( - decoration: new BoxDecoration( + decoration: const BoxDecoration( backgroundColor: const Color(0xFFFF0000) ), child: size ); RenderBox green = new RenderDecoratedBox( - decoration: new BoxDecoration( + decoration: const BoxDecoration( backgroundColor: const Color(0xFFFF0000) ) ); diff --git a/packages/flutter/test/rendering/table_test.dart b/packages/flutter/test/rendering/table_test.dart index 3cd2d0efb0..80219bd75a 100644 --- a/packages/flutter/test/rendering/table_test.dart +++ b/packages/flutter/test/rendering/table_test.dart @@ -45,7 +45,7 @@ void main() { 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(1, 0, sizedBox(20.0, 20.0)); @@ -53,7 +53,7 @@ void main() { 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', () { diff --git a/packages/flutter/test/rendering/transform_test.dart b/packages/flutter/test/rendering/transform_test.dart index f17592c710..8b3bf58539 100644 --- a/packages/flutter/test/rendering/transform_test.dart +++ b/packages/flutter/test/rendering/transform_test.dart @@ -21,7 +21,7 @@ void main() { alignment: FractionalOffset.center, 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(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))); @@ -38,11 +38,11 @@ void main() { transform: new Matrix4.identity(), alignment: FractionalOffset.center, 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)), ), ); - 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(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))); @@ -60,7 +60,7 @@ void main() { alignment: FractionalOffset.center, 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(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))); @@ -77,11 +77,11 @@ void main() { transform: new Matrix4.translationValues(50.0, 200.0, 0.0), alignment: FractionalOffset.center, 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)), ), ); - 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(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))); @@ -99,7 +99,7 @@ void main() { alignment: FractionalOffset.center, 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(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))); @@ -116,11 +116,11 @@ void main() { transform: new Matrix4.rotationZ(math.PI), alignment: FractionalOffset.center, 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)), ), ); - 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(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))); @@ -138,7 +138,7 @@ void main() { alignment: FractionalOffset.center, 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(inner.globalToLocal(const Point(25.0, 17.0)).y, greaterThan(0.0)); @@ -155,7 +155,7 @@ void main() { alignment: FractionalOffset.center, 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 // everything should end up around the middle of the outer box. diff --git a/packages/flutter/test/rendering/viewport_test.dart b/packages/flutter/test/rendering/viewport_test.dart index c3c9c518e9..08e75d49d4 100644 --- a/packages/flutter/test/rendering/viewport_test.dart +++ b/packages/flutter/test/rendering/viewport_test.dart @@ -10,7 +10,7 @@ import 'rendering_tester.dart'; void main() { test('Should be able to hit with positive paint offset', () { RenderBox green = new RenderDecoratedBox( - decoration: new BoxDecoration( + decoration: const BoxDecoration( backgroundColor: const Color(0xFF00FF00) )); @@ -19,22 +19,22 @@ void main() { child: green); RenderBox red = new RenderDecoratedBox( - decoration: new BoxDecoration( + decoration: const BoxDecoration( backgroundColor: const Color(0xFFFF0000) ), 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); HitTestResult result; 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)); 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)); }); } diff --git a/packages/flutter/test/services/image_cache_resize_test.dart b/packages/flutter/test/services/image_cache_resize_test.dart index 74d886122b..8352be85e1 100644 --- a/packages/flutter/test/services/image_cache_resize_test.dart +++ b/packages/flutter/test/services/image_cache_resize_test.dart @@ -12,10 +12,10 @@ void main() { imageCache.maximumSize = 2; - TestImageInfo a = await extractOneFrame(new TestProvider(1, 1).resolve(ImageConfiguration.empty)); - TestImageInfo b = await extractOneFrame(new TestProvider(2, 2).resolve(ImageConfiguration.empty)); - TestImageInfo c = await extractOneFrame(new TestProvider(3, 3).resolve(ImageConfiguration.empty)); - TestImageInfo d = await extractOneFrame(new TestProvider(1, 4).resolve(ImageConfiguration.empty)); + TestImageInfo a = await extractOneFrame(const TestProvider(1, 1).resolve(ImageConfiguration.empty)); + TestImageInfo b = await extractOneFrame(const TestProvider(2, 2).resolve(ImageConfiguration.empty)); + TestImageInfo c = await extractOneFrame(const TestProvider(3, 3).resolve(ImageConfiguration.empty)); + TestImageInfo d = await extractOneFrame(const TestProvider(1, 4).resolve(ImageConfiguration.empty)); expect(a.value, equals(1)); expect(b.value, equals(2)); expect(c.value, equals(3)); @@ -23,18 +23,18 @@ void main() { 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)); - 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)); 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)); - 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)); }); diff --git a/packages/flutter/test/services/image_cache_test.dart b/packages/flutter/test/services/image_cache_test.dart index 80fb1488b3..0db074f93a 100644 --- a/packages/flutter/test/services/image_cache_test.dart +++ b/packages/flutter/test/services/image_cache_test.dart @@ -12,69 +12,69 @@ void main() { 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)); - 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)); - 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)); - 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)); - 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)); - 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, equals(a)); // 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)); // 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)); // 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)); // 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)); // 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)); // 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)); // 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)); // 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)); // 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)); // 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)); // cache has three entries: 3(14), 4(15), 1(16) diff --git a/packages/flutter/test/widgets/animated_container_test.dart b/packages/flutter/test/widgets/animated_container_test.dart index 3e12f453d7..6841c60660 100644 --- a/packages/flutter/test/widgets/animated_container_test.dart +++ b/packages/flutter/test/widgets/animated_container_test.dart @@ -10,12 +10,12 @@ void main() { testWidgets('AnimatedContainer control test', (WidgetTester tester) async { GlobalKey key = new GlobalKey(); - BoxDecoration decorationA = new BoxDecoration( - backgroundColor: new Color(0xFF00FF00) + BoxDecoration decorationA = const BoxDecoration( + backgroundColor: const Color(0xFF00FF00) ); - BoxDecoration decorationB = new BoxDecoration( - backgroundColor: new Color(0xFF0000FF) + BoxDecoration decorationB = const BoxDecoration( + backgroundColor: const Color(0xFF0000FF) ); BoxDecoration actualDecoration; @@ -54,41 +54,41 @@ void main() { await tester.pumpWidget( new AnimatedContainer( duration: const Duration(milliseconds: 200), - decoration: new BoxDecoration( - backgroundColor: new Color(0xFF00FF00) + decoration: const BoxDecoration( + backgroundColor: const Color(0xFF00FF00) ) ) ); expect(tester.binding.transientCallbackCount, 0); - await tester.pump(new Duration(seconds: 1)); + await tester.pump(const Duration(seconds: 1)); expect(tester.binding.transientCallbackCount, 0); await tester.pumpWidget( new AnimatedContainer( duration: const Duration(milliseconds: 200), - decoration: new BoxDecoration( - backgroundColor: new Color(0xFF00FF00) + decoration: const BoxDecoration( + backgroundColor: const Color(0xFF00FF00) ) ) ); expect(tester.binding.transientCallbackCount, 0); - await tester.pump(new Duration(seconds: 1)); + await tester.pump(const Duration(seconds: 1)); expect(tester.binding.transientCallbackCount, 0); await tester.pumpWidget( new AnimatedContainer( duration: const Duration(milliseconds: 200), - decoration: new BoxDecoration( - backgroundColor: new Color(0xFF0000FF) + decoration: const BoxDecoration( + backgroundColor: const Color(0xFF0000FF) ) ) ); 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); await tester.pumpWidget( new AnimatedContainer( duration: const Duration(milliseconds: 200), - decoration: new BoxDecoration( - backgroundColor: new Color(0xFF0000FF) + decoration: const BoxDecoration( + backgroundColor: const Color(0xFF0000FF) ) ) ); @@ -108,13 +108,13 @@ void main() { ); await tester.pump(); - await tester.pump(new Duration(milliseconds: 100)); + await tester.pump(const Duration(milliseconds: 100)); RenderBox text = tester.renderObject(find.text('X')); expect(text.size.width, 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( new Center( @@ -127,7 +127,7 @@ void main() { ) ); await tester.pump(); - await tester.pump(new Duration(milliseconds: 100)); + await tester.pump(const Duration(milliseconds: 100)); text = tester.renderObject(find.text('X')); expect(text.size.width, greaterThan(110.0)); @@ -135,7 +135,7 @@ void main() { expect(text.size.height, greaterThan(110.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.height, equals(200.0)); @@ -151,13 +151,13 @@ void main() { ) ); 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.height, greaterThan(110.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.height, equals(100.0)); diff --git a/packages/flutter/test/widgets/animated_cross_fade_test.dart b/packages/flutter/test/widgets/animated_cross_fade_test.dart index aac19b5b91..7b379fd16a 100644 --- a/packages/flutter/test/widgets/animated_cross_fade_test.dart +++ b/packages/flutter/test/widgets/animated_cross_fade_test.dart @@ -11,11 +11,11 @@ void main() { await tester.pumpWidget( new Center( child: new AnimatedCrossFade( - firstChild: new SizedBox( + firstChild: const SizedBox( width: 100.0, height: 100.0 ), - secondChild: new SizedBox( + secondChild: const SizedBox( width: 200.0, height: 200.0 ), @@ -33,11 +33,11 @@ void main() { await tester.pumpWidget( new Center( child: new AnimatedCrossFade( - firstChild: new SizedBox( + firstChild: const SizedBox( width: 100.0, height: 100.0 ), - secondChild: new SizedBox( + secondChild: const SizedBox( width: 200.0, height: 200.0 ), @@ -59,11 +59,11 @@ void main() { await tester.pumpWidget( new Center( child: new AnimatedCrossFade( - firstChild: new SizedBox( + firstChild: const SizedBox( width: 100.0, height: 100.0 ), - secondChild: new SizedBox( + secondChild: const SizedBox( width: 200.0, height: 200.0 ), diff --git a/packages/flutter/test/widgets/animated_size_test.dart b/packages/flutter/test/widgets/animated_size_test.dart index c0661b4533..640a587636 100644 --- a/packages/flutter/test/widgets/animated_size_test.dart +++ b/packages/flutter/test/widgets/animated_size_test.dart @@ -22,7 +22,7 @@ void main() { child: new AnimatedSize( duration: const Duration(milliseconds: 200), vsync: tester, - child: new SizedBox( + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -37,9 +37,9 @@ void main() { await tester.pumpWidget( new Center( child: new AnimatedSize( - duration: new Duration(milliseconds: 200), + duration: const Duration(milliseconds: 200), vsync: tester, - child: new SizedBox( + child: const SizedBox( width: 200.0, height: 200.0 ) @@ -64,9 +64,9 @@ void main() { await tester.pumpWidget( new Center( child: new AnimatedSize( - duration: new Duration(milliseconds: 200), + duration: const Duration(milliseconds: 200), vsync: tester, - child: new SizedBox( + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -98,7 +98,7 @@ void main() { child: new AnimatedSize( duration: const Duration(milliseconds: 200), vsync: tester, - child: new SizedBox( + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -119,7 +119,7 @@ void main() { child: new AnimatedSize( duration: const Duration(milliseconds: 200), vsync: tester, - child: new SizedBox( + child: const SizedBox( width: 200.0, height: 200.0 ) diff --git a/packages/flutter/test/widgets/aspect_ratio_test.dart b/packages/flutter/test/widgets/aspect_ratio_test.dart index 2dc6acde73..da62e2d217 100644 --- a/packages/flutter/test/widgets/aspect_ratio_test.dart +++ b/packages/flutter/test/widgets/aspect_ratio_test.dart @@ -27,8 +27,8 @@ Future _getSize(WidgetTester tester, BoxConstraints constraints, double as void main() { 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(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)), 2.0), equals(const Size(500.0, 250.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 { @@ -47,6 +47,6 @@ void main() { ) ); 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))); }); } diff --git a/packages/flutter/test/widgets/banner_test.dart b/packages/flutter/test/widgets/banner_test.dart index 417886c12d..bf56b255ea 100644 --- a/packages/flutter/test/widgets/banner_test.dart +++ b/packages/flutter/test/widgets/banner_test.dart @@ -18,14 +18,14 @@ class TestCanvas implements Canvas { void main() { test('A Banner with a location of topLeft paints in the top left', () { - BannerPainter bannerPainter = new BannerPainter( + BannerPainter bannerPainter = const BannerPainter( message:"foo", location: BannerLocation.topLeft ); 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) { return invocation.memberName == #translate; @@ -44,14 +44,14 @@ void main() { }); test('A Banner with a location of topRight paints in the top right', () { - BannerPainter bannerPainter = new BannerPainter( + BannerPainter bannerPainter = const BannerPainter( message:"foo", location: BannerLocation.topRight ); 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) { return invocation.memberName == #translate; @@ -70,14 +70,14 @@ void main() { }); test('A Banner with a location of bottomLeft paints in the bottom left', () { - BannerPainter bannerPainter = new BannerPainter( + BannerPainter bannerPainter = const BannerPainter( message:"foo", location: BannerLocation.bottomLeft ); 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) { return invocation.memberName == #translate; @@ -96,14 +96,14 @@ void main() { }); test('A Banner with a location of bottomRight paints in the bottom right', () { - BannerPainter bannerPainter = new BannerPainter( + BannerPainter bannerPainter = const BannerPainter( message:"foo", location: BannerLocation.bottomRight ); 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) { return invocation.memberName == #translate; diff --git a/packages/flutter/test/widgets/block_test.dart b/packages/flutter/test/widgets/block_test.dart index c7f075e7ab..75c5d2cf0b 100644 --- a/packages/flutter/test/widgets/block_test.dart +++ b/packages/flutter/test/widgets/block_test.dart @@ -74,8 +74,8 @@ void main() { onTap: () { ++first; }, child: new Container( height: 2000.0, // more than 600, the height of the test area - decoration: new BoxDecoration( - backgroundColor: new Color(0xFF00FF00) + decoration: const BoxDecoration( + backgroundColor: const Color(0xFF00FF00) ) ) ), @@ -83,8 +83,8 @@ void main() { onTap: () { ++second; }, child: new Container( height: 2000.0, // more than 600, the height of the test area - decoration: new BoxDecoration( - backgroundColor: new Color(0xFF0000FF) + decoration: const BoxDecoration( + backgroundColor: const Color(0xFF0000FF) ) ) ) diff --git a/packages/flutter/test/widgets/bottom_sheet_test.dart b/packages/flutter/test/widgets/bottom_sheet_test.dart index 205a98996d..3b90f23674 100644 --- a/packages/flutter/test/widgets/bottom_sheet_test.dart +++ b/packages/flutter/test/widgets/bottom_sheet_test.dart @@ -32,7 +32,7 @@ void main() { }); 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(showBottomSheetThenCalled, isFalse); @@ -40,8 +40,8 @@ void main() { await tester.tap(find.text('BottomSheet')); await tester.pump(); // bottom sheet dismiss animation starts 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(new Duration(seconds: 1)); // frame after the animation (sheet has been removed) + await tester.pump(const Duration(seconds: 1)); // last frame of animation (sheet is entirely off-screen, but still present) + await tester.pump(const Duration(seconds: 1)); // frame after the animation (sheet has been removed) expect(find.text('BottomSheet'), findsNothing); showBottomSheetThenCalled = false; @@ -53,16 +53,16 @@ void main() { showBottomSheetThenCalled = true; }); 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(showBottomSheetThenCalled, isFalse); // 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 expect(showBottomSheetThenCalled, isTrue); - await tester.pump(new Duration(seconds: 1)); // animation done - await tester.pump(new Duration(seconds: 1)); // rebuild frame + await tester.pump(const Duration(seconds: 1)); // animation done + await tester.pump(const Duration(seconds: 1)); // rebuild frame expect(find.text('BottomSheet'), findsNothing); }); @@ -82,7 +82,7 @@ void main() { scaffoldKey.currentState.showBottomSheet((BuildContext context) { return new Container( - margin: new EdgeInsets.all(40.0), + margin: const EdgeInsets.all(40.0), child: new Text('BottomSheet') ); }).closed.then((_) { @@ -97,7 +97,7 @@ void main() { expect(showBottomSheetThenCalled, isFalse); 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(find.text('BottomSheet'), findsOneWidget); @@ -113,7 +113,7 @@ void main() { expect(showBottomSheetThenCalled, isTrue); 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(find.text('BottomSheet'), findsNothing); @@ -132,19 +132,19 @@ void main() { scaffoldKey.currentState.showBottomSheet((BuildContext context) { return new Container( - margin: new EdgeInsets.all(40.0), + margin: const EdgeInsets.all(40.0), child: new Text('BottomSheet') ); }); 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); 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(); // 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); }); diff --git a/packages/flutter/test/widgets/box_decoration_test.dart b/packages/flutter/test/widgets/box_decoration_test.dart index c4818a43f1..fa30a63f22 100644 --- a/packages/flutter/test/widgets/box_decoration_test.dart +++ b/packages/flutter/test/widgets/box_decoration_test.dart @@ -10,7 +10,7 @@ void main() { testWidgets('Circles can have uniform borders', (WidgetTester tester) async { await tester.pumpWidget( new Container( - padding: new EdgeInsets.all(50.0), + padding: const EdgeInsets.all(50.0), decoration: new BoxDecoration( shape: BoxShape.circle, border: new Border.all(width: 10.0, color: const Color(0x80FF00FF)), diff --git a/packages/flutter/test/widgets/clip_test.dart b/packages/flutter/test/widgets/clip_test.dart index df7c3a7472..edc9339dcb 100644 --- a/packages/flutter/test/widgets/clip_test.dart +++ b/packages/flutter/test/widgets/clip_test.dart @@ -49,11 +49,11 @@ void main() { ); expect(log, equals(['getClip'])); - await tester.tapAt(new Point(10.0, 10.0)); + await tester.tapAt(const Point(10.0, 10.0)); expect(log, equals(['getClip'])); log.clear(); - await tester.tapAt(new Point(100.0, 100.0)); + await tester.tapAt(const Point(100.0, 100.0)); expect(log, equals(['tap'])); log.clear(); }); @@ -69,11 +69,11 @@ void main() { ); expect(log, equals([])); - await tester.tapAt(new Point(10.0, 10.0)); + await tester.tapAt(const Point(10.0, 10.0)); expect(log, equals([])); log.clear(); - await tester.tapAt(new Point(400.0, 300.0)); + await tester.tapAt(const Point(400.0, 300.0)); expect(log, equals(['tap'])); log.clear(); }); @@ -92,11 +92,11 @@ void main() { ); expect(log, equals([])); - await tester.tapAt(new Point(10.0, 10.0)); + await tester.tapAt(const Point(10.0, 10.0)); expect(log, equals([])); log.clear(); - await tester.tapAt(new Point(400.0, 300.0)); + await tester.tapAt(const Point(400.0, 300.0)); expect(log, equals(['tap'])); log.clear(); }); @@ -120,10 +120,10 @@ void main() { ); expect(log, equals(['a'])); - await tester.tapAt(new Point(10.0, 10.0)); + await tester.tapAt(const Point(10.0, 10.0)); expect(log, equals(['a', 'tap'])); - await tester.tapAt(new Point(100.0, 100.0)); + await tester.tapAt(const Point(100.0, 100.0)); expect(log, equals(['a', 'tap'])); await tester.pumpWidget( @@ -216,10 +216,10 @@ void main() { ); expect(log, equals(['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(['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(['a', 'tap', 'a', 'b', 'c', 'tap'])); }); diff --git a/packages/flutter/test/widgets/custom_multi_child_layout_test.dart b/packages/flutter/test/widgets/custom_multi_child_layout_test.dart index 1eacc22548..32b177cd5e 100644 --- a/packages/flutter/test/widgets/custom_multi_child_layout_test.dart +++ b/packages/flutter/test/widgets/custom_multi_child_layout_test.dart @@ -13,7 +13,7 @@ class TestMultiChildLayoutDelegate extends MultiChildLayoutDelegate { Size getSize(BoxConstraints constraints) { if (!RenderObject.debugCheckingIntrinsics) getSizeConstraints = constraints; - return new Size(200.0, 300.0); + return const Size(200.0, 300.0); } Size performLayoutSize; @@ -143,7 +143,7 @@ void main() { await tester.pumpWidget(new Center( child: new CustomMultiChildLayout( 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() { await tester.pumpWidget(new Center( child: new CustomMultiChildLayout( key: key, - delegate: new PreferredSizeDelegate(preferredSize: new Size(350.0, 250.0)) + delegate: new PreferredSizeDelegate(preferredSize: const Size(350.0, 250.0)) ) )); diff --git a/packages/flutter/test/widgets/custom_one_child_layout_test.dart b/packages/flutter/test/widgets/custom_one_child_layout_test.dart index 2f2ad60aab..b666d47578 100644 --- a/packages/flutter/test/widgets/custom_one_child_layout_test.dart +++ b/packages/flutter/test/widgets/custom_one_child_layout_test.dart @@ -16,14 +16,14 @@ class TestSingleChildLayoutDelegate extends SingleChildLayoutDelegate { Size getSize(BoxConstraints constraints) { if (!RenderObject.debugCheckingIntrinsics) constraintsFromGetSize = constraints; - return new Size(200.0, 300.0); + return const Size(200.0, 300.0); } @override BoxConstraints getConstraintsForChild(BoxConstraints constraints) { assert(!RenderObject.debugCheckingIntrinsics); constraintsFromGetConstraintsForChild = constraints; - return new BoxConstraints( + return const BoxConstraints( minWidth: 100.0, maxWidth: 150.0, minHeight: 200.0, diff --git a/packages/flutter/test/widgets/dismissable_test.dart b/packages/flutter/test/widgets/dismissable_test.dart index fec2aa8a11..b3d367c46c 100644 --- a/packages/flutter/test/widgets/dismissable_test.dart +++ b/packages/flutter/test/widgets/dismissable_test.dart @@ -243,7 +243,7 @@ void main() { await tester.pumpWidget(widgetBuilder()); 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); await gesture.moveBy(offset); await tester.pumpWidget(widgetBuilder()); @@ -279,12 +279,12 @@ void main() { expect(find.text('2'), findsOneWidget); await dismissElement(tester, find.text('2'), gestureDirection: DismissDirection.startToEnd); 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('2'), findsNothing); await dismissElement(tester, find.text('1'), gestureDirection: DismissDirection.startToEnd); 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('2'), findsNothing); }); diff --git a/packages/flutter/test/widgets/draggable_test.dart b/packages/flutter/test/widgets/draggable_test.dart index 31f12db29d..cbcf02ce86 100644 --- a/packages/flutter/test/widgets/draggable_test.dart +++ b/packages/flutter/test/widgets/draggable_test.dart @@ -690,7 +690,7 @@ void main() { expect(onDraggableCanceledCalled, isFalse); 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(); expect(accepted, isEmpty); @@ -700,7 +700,7 @@ void main() { expect(onDraggableCanceledCalled, isTrue); expect(onDraggableCanceledVelocity.pixelsPerSecond.dx.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 { @@ -1007,15 +1007,15 @@ void main() { }, child: new Draggable( child: new Container( - decoration: new BoxDecoration( - backgroundColor: new Color(0xFFFFFF00) + decoration: const BoxDecoration( + backgroundColor: const Color(0xFFFFFF00) ) ), feedback: new Container( width: 100.0, height: 100.0, - decoration: new BoxDecoration( - backgroundColor: new Color(0xFFFF0000) + decoration: const BoxDecoration( + backgroundColor: const Color(0xFFFF0000) ) ) ) @@ -1042,15 +1042,15 @@ void main() { onTap: () { /* registers a tap recognizer */ }, child: new Draggable( child: new Container( - decoration: new BoxDecoration( - backgroundColor: new Color(0xFFFFFF00) + decoration: const BoxDecoration( + backgroundColor: const Color(0xFFFFFF00) ) ), feedback: new Container( width: 100.0, height: 100.0, - decoration: new BoxDecoration( - backgroundColor: new Color(0xFFFF0000) + decoration: const BoxDecoration( + backgroundColor: const Color(0xFFFF0000) ) ) ) @@ -1062,7 +1062,7 @@ void main() { 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); - await firstGesture.moveBy(new Offset(100.0, 0.0)); + await firstGesture.moveBy(const Offset(100.0, 0.0)); await secondGesture.up(); }); diff --git a/packages/flutter/test/widgets/drawer_test.dart b/packages/flutter/test/widgets/drawer_test.dart index 3f02588d0a..415cb2020c 100644 --- a/packages/flutter/test/widgets/drawer_test.dart +++ b/packages/flutter/test/widgets/drawer_test.dart @@ -30,12 +30,12 @@ void main() { scaffoldKey.currentState.openDrawer(); await tester.pump(); // drawer should be starting to animate in 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); Navigator.pop(savedContext); await tester.pump(); // drawer should be starting to animate away 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); }); @@ -55,19 +55,19 @@ void main() { scaffoldKey.currentState.openDrawer(); await tester.pump(); // drawer should be starting to animate in 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); await tester.tap(find.text('drawer')); await tester.pump(); // nothing should have happened 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); await tester.tapAt(const Point(750.0, 100.0)); // on the mask await tester.pump(); - await tester.pump(new Duration(milliseconds: 10)); + await tester.pump(const Duration(milliseconds: 10)); // drawer should be starting to animate away 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); }); @@ -98,27 +98,27 @@ void main() { scaffoldKey.currentState.openDrawer(); await tester.pump(); // drawer should be starting to animate in 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); await tester.tapAt(const Point(750.0, 100.0)); // on the mask await tester.pump(); - await tester.pump(new Duration(milliseconds: 10)); + await tester.pump(const Duration(milliseconds: 10)); // drawer should be starting to animate away RenderBox textBox = tester.renderObject(find.text('drawer')); double textLeft = textBox.localToGlobal(Point.origin).x; 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. 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)); - await gesture.moveBy(new Offset(0.0, -50.0)); + await gesture.moveBy(const Offset(0.0, -50.0)); // drawer should be returning to visible 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)); await gesture.up(); @@ -163,10 +163,10 @@ void main() { expect(find.text('drawer'), findsOneWidget); // 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.pump(); - await tester.pump(new Duration(seconds: 1)); + await tester.pump(const Duration(seconds: 1)); expect(find.text('drawer'), findsNothing); // Confirm that a button in the scaffold body is still clickable. diff --git a/packages/flutter/test/widgets/fitted_box_test.dart b/packages/flutter/test/widgets/fitted_box_test.dart index 4c525bc76c..a6216d8c9c 100644 --- a/packages/flutter/test/widgets/fitted_box_test.dart +++ b/packages/flutter/test/widgets/fitted_box_test.dart @@ -35,8 +35,8 @@ void main() { expect(insideBox.size.width, 100.0); expect(insideBox.size.height, 50.0); - Point insidePoint = insideBox.localToGlobal(new Point(100.0, 50.0)); - Point outsidePoint = outsideBox.localToGlobal(new Point(200.0, 100.0)); + Point insidePoint = insideBox.localToGlobal(const Point(100.0, 50.0)); + Point outsidePoint = outsideBox.localToGlobal(const Point(200.0, 100.0)); expect(outsidePoint, equals(const Point(500.0, 350.0))); expect(insidePoint, equals(outsidePoint)); @@ -71,8 +71,8 @@ void main() { expect(insideBox.size.width, 100.0); expect(insideBox.size.height, 50.0); - Point insidePoint = insideBox.localToGlobal(new Point(100.0, 0.0)); - Point outsidePoint = outsideBox.localToGlobal(new Point(200.0, 50.0)); + Point insidePoint = insideBox.localToGlobal(const Point(100.0, 0.0)); + Point outsidePoint = outsideBox.localToGlobal(const Point(200.0, 50.0)); expect(insidePoint, equals(outsidePoint)); }); @@ -107,8 +107,8 @@ void main() { expect(insideBox.size.width, 100.0); expect(insideBox.size.height, 50.0); - Point insidePoint = insideBox.localToGlobal(new Point(50.0, 25.0)); - Point outsidePoint = outsideBox.localToGlobal(new Point(100.0, 100.0)); + Point insidePoint = insideBox.localToGlobal(const Point(50.0, 25.0)); + Point outsidePoint = outsideBox.localToGlobal(const Point(100.0, 100.0)); expect(insidePoint, equals(outsidePoint)); }); diff --git a/packages/flutter/test/widgets/flow_test.dart b/packages/flutter/test/widgets/flow_test.dart index ded41402b1..d70de731c2 100644 --- a/packages/flutter/test/widgets/flow_test.dart +++ b/packages/flutter/test/widgets/flow_test.dart @@ -76,14 +76,14 @@ void main() { expect(log, equals([0, 1, 2])); log.clear(); - await tester.tapAt(new Point(20.0, 90.0)); + await tester.tapAt(const Point(20.0, 90.0)); expect(log, equals([1])); startOffset.value = 50.0; await tester.pump(); log.clear(); - await tester.tapAt(new Point(20.0, 90.0)); + await tester.tapAt(const Point(20.0, 90.0)); expect(log, equals([0])); }); } diff --git a/packages/flutter/test/widgets/gesture_detector_test.dart b/packages/flutter/test/widgets/gesture_detector_test.dart index 0a8e0061ca..48ea1fbf47 100644 --- a/packages/flutter/test/widgets/gesture_detector_test.dart +++ b/packages/flutter/test/widgets/gesture_detector_test.dart @@ -33,14 +33,14 @@ void main() { expect(updatedDragDelta, isNull); 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); expect(didStartDrag, isTrue); didStartDrag = false; expect(updatedDragDelta, isNull); expect(didEndDrag, isFalse); - Point secondLocation = new Point(10.0, 9.0); + Point secondLocation = const Point(10.0, 9.0); await gesture.moveTo(secondLocation); expect(didStartDrag, isFalse); expect(updatedDragDelta, -1.0); @@ -60,8 +60,8 @@ void main() { int gestureCount = 0; double dragDistance = 0.0; - Point downLocation = new Point(10.0, 10.0); - Point upLocation = new Point(10.0, 20.0); + Point downLocation = const Point(10.0, 10.0); + Point upLocation = const Point(10.0, 20.0); Widget widget = new GestureDetector( onVerticalDragUpdate: (DragUpdateDetails details) { dragDistance += details.primaryDelta; }, @@ -118,7 +118,7 @@ void main() { expect(panDelta, isNull); 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(panDelta.dx, 20.0); @@ -164,28 +164,28 @@ void main() { didReceivePointerDown = false; didTap = false; 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(didTap, isTrue); didReceivePointerDown = false; didTap = false; 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(didTap, isFalse); didReceivePointerDown = false; didTap = false; 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(didTap, isTrue); didReceivePointerDown = false; didTap = false; 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(didTap, isTrue); @@ -203,7 +203,7 @@ void main() { ) ); expect(didTap, isFalse); - await tester.tapAt(new Point(10.0, 10.0)); + await tester.tapAt(const Point(10.0, 10.0)); expect(didTap, isTrue); }); @@ -220,7 +220,7 @@ void main() { ) ); expect(didTap, isFalse); - await tester.tapAt(new Point(10.0, 10.0)); + await tester.tapAt(const Point(10.0, 10.0)); expect(didTap, isFalse); }); } diff --git a/packages/flutter/test/widgets/heroes_test.dart b/packages/flutter/test/widgets/heroes_test.dart index 819ff8887f..25fff3d684 100644 --- a/packages/flutter/test/widgets/heroes_test.dart +++ b/packages/flutter/test/widgets/heroes_test.dart @@ -91,7 +91,7 @@ void main() { expect(find.byKey(secondKey), isOnstage); 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 // fact). The hero should now be in the new page, onstage. The original @@ -139,7 +139,7 @@ void main() { expect(find.byKey(thirdKey), isOnstage); 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 // fact). The hero should now be in the new page, onstage. @@ -170,12 +170,12 @@ void main() { )); await tester.tap(find.text('two')); - await tester.pump(new Duration(milliseconds: 10)); + await tester.pump(const Duration(milliseconds: 10)); route.markNeedsBuild(); - await tester.pump(new Duration(milliseconds: 10)); - await tester.pump(new Duration(seconds: 1)); + await tester.pump(const Duration(milliseconds: 10)); + await tester.pump(const Duration(seconds: 1)); }); testWidgets('Heroes animation is fastOutSlowIn', (WidgetTester tester) async { @@ -271,18 +271,18 @@ void main() { await tester.tap(find.text('foo', skipOffstage: false)); 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)); expect(log, isEmpty); await tester.tap(find.text('bar', skipOffstage: false)); expect(log, isEmpty); - await tester.pump(new Duration(milliseconds: 10)); + await tester.pump(const Duration(milliseconds: 10)); expect(find.text('foo'), findsNothing); await tester.tap(find.text('bar', skipOffstage: false)); expect(log, isEmpty); - await tester.pump(new Duration(seconds: 1)); + await tester.pump(const Duration(seconds: 1)); expect(find.text('foo'), findsNothing); await tester.tap(find.text('bar')); expect(log, equals(['bar'])); diff --git a/packages/flutter/test/widgets/hyperlink_test.dart b/packages/flutter/test/widgets/hyperlink_test.dart index b5f0467cda..613a8b276c 100644 --- a/packages/flutter/test/widgets/hyperlink_test.dart +++ b/packages/flutter/test/widgets/hyperlink_test.dart @@ -32,7 +32,7 @@ void main() { text: 'xxxxxxxx', recognizer: tapLeft ), - new TextSpan(text: 'yyyyyyyy'), + const TextSpan(text: 'yyyyyyyy'), new TextSpan( text: 'zzzzzzzzz', recognizer: tapRight @@ -48,21 +48,21 @@ void main() { expect(didTapLeft, 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(didTapRight, isFalse); 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(didTapRight, isFalse); 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(didTapRight, isTrue); diff --git a/packages/flutter/test/widgets/image_test.dart b/packages/flutter/test/widgets/image_test.dart index aa3c96141c..0c569df051 100644 --- a/packages/flutter/test/widgets/image_test.dart +++ b/packages/flutter/test/widgets/image_test.dart @@ -175,13 +175,13 @@ void main() { await tester.pumpWidget( new MediaQuery( key: mediaQueryKey1, - data: new MediaQueryData( + data: const MediaQueryData( devicePixelRatio: 10.0, padding: EdgeInsets.zero, ), child: new MediaQuery( key: mediaQueryKey2, - data: new MediaQueryData( + data: const MediaQueryData( devicePixelRatio: 5.0, padding: EdgeInsets.zero, ), @@ -201,13 +201,13 @@ void main() { await tester.pumpWidget( new MediaQuery( key: mediaQueryKey2, - data: new MediaQueryData( + data: const MediaQueryData( devicePixelRatio: 5.0, padding: EdgeInsets.zero, ), child: new MediaQuery( key: mediaQueryKey1, - data: new MediaQueryData( + data: const MediaQueryData( devicePixelRatio: 10.0, padding: EdgeInsets.zero, ), @@ -235,7 +235,7 @@ void main() { children: [ new MediaQuery( key: mediaQueryKey2, - data: new MediaQueryData( + data: const MediaQueryData( devicePixelRatio: 5.0, padding: EdgeInsets.zero, ), @@ -246,7 +246,7 @@ void main() { ), new MediaQuery( key: mediaQueryKey1, - data: new MediaQueryData( + data: const MediaQueryData( devicePixelRatio: 10.0, padding: EdgeInsets.zero, ), @@ -263,7 +263,7 @@ void main() { children: [ new MediaQuery( key: mediaQueryKey2, - data: new MediaQueryData( + data: const MediaQueryData( devicePixelRatio: 5.0, padding: EdgeInsets.zero, ), @@ -271,7 +271,7 @@ void main() { ), new MediaQuery( key: mediaQueryKey1, - data: new MediaQueryData( + data: const MediaQueryData( devicePixelRatio: 10.0, padding: EdgeInsets.zero, ), diff --git a/packages/flutter/test/widgets/implicit_animations_test.dart b/packages/flutter/test/widgets/implicit_animations_test.dart index 7f40489af0..8bd051002e 100644 --- a/packages/flutter/test/widgets/implicit_animations_test.dart +++ b/packages/flutter/test/widgets/implicit_animations_test.dart @@ -8,8 +8,8 @@ import 'package:flutter/widgets.dart'; void main() { testWidgets('BoxConstraintsTween control test', (WidgetTester tester) async { BoxConstraintsTween tween = new BoxConstraintsTween( - begin: new BoxConstraints.tight(new Size(20.0, 50.0)), - end: new BoxConstraints.tight(new Size(10.0, 30.0)) + begin: new BoxConstraints.tight(const Size(20.0, 50.0)), + end: new BoxConstraints.tight(const Size(10.0, 30.0)) ); BoxConstraints result = tween.lerp(0.25); expect(result.minWidth, 17.5); @@ -20,17 +20,17 @@ void main() { testWidgets('DecorationTween control test', (WidgetTester tester) async { DecorationTween tween = new DecorationTween( - begin: new BoxDecoration(backgroundColor: new Color(0xFF00FF00)), - end: new BoxDecoration(backgroundColor: new Color(0xFFFFFF00)) + begin: const BoxDecoration(backgroundColor: const Color(0xFF00FF00)), + end: const BoxDecoration(backgroundColor: const Color(0xFFFFFF00)) ); 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 { EdgeInsetsTween tween = new EdgeInsetsTween( - begin: new EdgeInsets.symmetric(vertical: 50.0), - end: new EdgeInsets.only(top: 10.0, bottom: 30.0) + begin: const EdgeInsets.symmetric(vertical: 50.0), + end: const EdgeInsets.only(top: 10.0, bottom: 30.0) ); EdgeInsets result = tween.lerp(0.25); expect(result.left, 0.0); diff --git a/packages/flutter/test/widgets/independent_widget_layout_test.dart b/packages/flutter/test/widgets/independent_widget_layout_test.dart index 5afc0d4ea2..a5252a2369 100644 --- a/packages/flutter/test/widgets/independent_widget_layout_test.dart +++ b/packages/flutter/test/widgets/independent_widget_layout_test.dart @@ -9,7 +9,7 @@ import 'package:flutter/rendering.dart'; const Size _kTestViewSize = const Size(800.0, 600.0); class OffscreenRenderView extends RenderView { - OffscreenRenderView() : super(configuration: new ViewConfiguration(size: _kTestViewSize)); + OffscreenRenderView() : super(configuration: const ViewConfiguration(size: _kTestViewSize)); @override void compositeFrame() { diff --git a/packages/flutter/test/widgets/input_test.dart b/packages/flutter/test/widgets/input_test.dart index 6df133e328..ed5f1fa9e1 100644 --- a/packages/flutter/test/widgets/input_test.dart +++ b/packages/flutter/test/widgets/input_test.dart @@ -80,7 +80,7 @@ void main() { List endpoints = renderEditable.getEndpointsForSelection( new TextSelection.collapsed(offset: offset)); 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 { @@ -164,7 +164,7 @@ void main() { await checkCursorToggle(); // Try the test again with a nonempty EditableText. - updateEditingState(new TextEditingState( + updateEditingState(const TextEditingState( text: 'X', selectionBase: 1, selectionExtent: 1, @@ -191,7 +191,7 @@ void main() { await showKeyboard(tester); const String testValue = 'ABC'; - updateEditingState(new TextEditingState( + updateEditingState(const TextEditingState( text: testValue, selectionBase: testValue.length, selectionExtent: testValue.length, @@ -298,7 +298,7 @@ void main() { // Drag the right handle 2 letters to the right. // Note: use a small offset because the endpoint is on the very corner // 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); gesture = await tester.startGesture(handlePos, pointer: 7); await tester.pump(); @@ -311,7 +311,7 @@ void main() { expect(inputValue.selection.extentOffset, selection.extentOffset+2); // 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); gesture = await tester.startGesture(handlePos, pointer: 7); await tester.pump(); @@ -362,7 +362,7 @@ void main() { RenderEditable renderEditable = findRenderEditable(tester); List 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()); // SELECT ALL should select all the text. @@ -381,7 +381,7 @@ void main() { await tester.pumpWidget(builder()); renderEditable = findRenderEditable(tester); 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()); // PASTE right before the 'e'. @@ -428,7 +428,7 @@ void main() { RenderEditable renderEditable = findRenderEditable(tester); List 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()); // Toolbar should fade in. Starting at 0% opacity. @@ -563,7 +563,7 @@ void main() { expect(endpoints.length, 2); // 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); gesture = await tester.startGesture(handlePos, pointer: 7); await tester.pump(); @@ -576,7 +576,7 @@ void main() { expect(inputValue.selection.extentOffset, 108); // 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); gesture = await tester.startGesture(handlePos, pointer: 7); await tester.pump(); @@ -642,11 +642,11 @@ void main() { TestGesture gesture = await tester.startGesture(firstPos, pointer: 7); 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)); // 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.) - 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 gesture.up(); await tester.pump(); @@ -674,11 +674,11 @@ void main() { expect(endpoints.length, 2); // 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); gesture = await tester.startGesture(handlePos, pointer: 7); 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 gesture.up(); await tester.pump(); diff --git a/packages/flutter/test/widgets/layout_builder_mutations_test.dart b/packages/flutter/test/widgets/layout_builder_mutations_test.dart index 48e4dca4e1..2c92fc41c0 100644 --- a/packages/flutter/test/widgets/layout_builder_mutations_test.dart +++ b/packages/flutter/test/widgets/layout_builder_mutations_test.dart @@ -28,7 +28,7 @@ void main() { await tester.pumpWidget(new Row(children: [ new Wrapper( child: new LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) { - return new SizedBox(); + return const SizedBox(); }), ), new Wrapper( @@ -53,7 +53,7 @@ void main() { new Wrapper( child: new Wrapper( child: new LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) { - return new SizedBox(); + return const SizedBox(); }) ) ), diff --git a/packages/flutter/test/widgets/layout_builder_test.dart b/packages/flutter/test/widgets/layout_builder_test.dart index b61545b080..f6b141cd2a 100644 --- a/packages/flutter/test/widgets/layout_builder_test.dart +++ b/packages/flutter/test/widgets/layout_builder_test.dart @@ -140,13 +140,13 @@ void main() { expect(built, 0); 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 )); expect(built, 1); 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 )); expect(built, 1); @@ -164,13 +164,13 @@ void main() { expect(built, 0); 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 )); expect(built, 1); 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 )); expect(built, 2); diff --git a/packages/flutter/test/widgets/lazy_block_viewport_test.dart b/packages/flutter/test/widgets/lazy_block_viewport_test.dart index 021944313c..5e5c815ccd 100644 --- a/packages/flutter/test/widgets/lazy_block_viewport_test.dart +++ b/packages/flutter/test/widgets/lazy_block_viewport_test.dart @@ -255,14 +255,14 @@ void main() { await tester.pumpWidget( 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) ) ); RenderBox firstBox = tester.renderObject(find.text('0')); 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)); }); diff --git a/packages/flutter/test/widgets/navigator_test.dart b/packages/flutter/test/widgets/navigator_test.dart index 28c5fce399..e108659d31 100644 --- a/packages/flutter/test/widgets/navigator_test.dart +++ b/packages/flutter/test/widgets/navigator_test.dart @@ -13,8 +13,8 @@ class FirstWidget extends StatelessWidget { Navigator.pushNamed(context, '/second'); }, child: new Container( - decoration: new BoxDecoration( - backgroundColor: new Color(0xFFFFFF00) + decoration: const BoxDecoration( + backgroundColor: const Color(0xFFFFFF00) ), child: new Text('X') ) @@ -33,8 +33,8 @@ class SecondWidgetState extends State { return new GestureDetector( onTap: () => Navigator.pop(context), child: new Container( - decoration: new BoxDecoration( - backgroundColor: new Color(0xFFFF00FF) + decoration: const BoxDecoration( + backgroundColor: const Color(0xFFFF00FF) ), child: new Text('Y') ) @@ -127,7 +127,7 @@ void main() { ); await tester.pumpWidget(widget); await tester.tap(find.byKey(targetKey)); - expect(exception, new isInstanceOf()); + expect(exception, const isInstanceOf()); expect('$exception', startsWith('Navigator operation requested with a context')); }); diff --git a/packages/flutter/test/widgets/page_transitions_test.dart b/packages/flutter/test/widgets/page_transitions_test.dart index d654e7fa5f..bd53c501d3 100644 --- a/packages/flutter/test/widgets/page_transitions_test.dart +++ b/packages/flutter/test/widgets/page_transitions_test.dart @@ -149,8 +149,8 @@ void main() { expect(find.text('Settings'), isOnstage); // Drag from left edge to invoke the gesture. - TestGesture gesture = await tester.startGesture(new Point(5.0, 100.0)); - await gesture.moveBy(new Offset(50.0, 0.0)); + TestGesture gesture = await tester.startGesture(const Point(5.0, 100.0)); + await gesture.moveBy(const Offset(50.0, 0.0)); await tester.pump(); // Home is now visible. @@ -180,8 +180,8 @@ void main() { expect(find.text('Settings'), isOnstage); // Drag from left edge to invoke the gesture. - TestGesture gesture = await tester.startGesture(new Point(5.0, 100.0)); - await gesture.moveBy(new Offset(50.0, 0.0)); + TestGesture gesture = await tester.startGesture(const Point(5.0, 100.0)); + await gesture.moveBy(const Offset(50.0, 0.0)); await tester.pump(); expect(find.text('Home'), findsNothing); @@ -255,7 +255,7 @@ void main() { '/': (_) => new Scaffold( key: containerKey1, body: new Container( - decoration: new BoxDecoration(backgroundColor: const Color(0xff00ffff)), + decoration: const BoxDecoration(backgroundColor: const Color(0xff00ffff)), child: new Hero( tag: kHeroTag, child: new Text('Home') @@ -266,7 +266,7 @@ void main() { key: containerKey2, body: new Container( padding: const EdgeInsets.all(100.0), - decoration: new BoxDecoration(backgroundColor: const Color(0xffff00ff)), + decoration: const BoxDecoration(backgroundColor: const Color(0xffff00ff)), child: new Hero( tag: kHeroTag, child: new Text('Settings') @@ -300,8 +300,8 @@ void main() { expect(find.text('Settings'), isOnstage); // Drag from left edge to invoke the gesture. - TestGesture gesture = await tester.startGesture(new Point(5.0, 100.0)); - await gesture.moveBy(new Offset(50.0, 0.0)); + TestGesture gesture = await tester.startGesture(const Point(5.0, 100.0)); + await gesture.moveBy(const Offset(50.0, 0.0)); await tester.pump(); // Home is now visible. @@ -343,8 +343,8 @@ void main() { // Drag from left edge to invoke the gesture. (near bottom so we grab // the Settings page as it comes up). - TestGesture gesture = await tester.startGesture(new Point(5.0, 550.0)); - await gesture.moveBy(new Offset(500.0, 0.0)); + TestGesture gesture = await tester.startGesture(const Point(5.0, 550.0)); + await gesture.moveBy(const Offset(500.0, 0.0)); await gesture.up(); await tester.pump(); await tester.pump(const Duration(milliseconds: 1000)); @@ -355,8 +355,8 @@ void main() { expect(find.text('Settings'), isOnstage); // Try again now that we're settled. - gesture = await tester.startGesture(new Point(5.0, 550.0)); - await gesture.moveBy(new Offset(500.0, 0.0)); + gesture = await tester.startGesture(const Point(5.0, 550.0)); + await gesture.moveBy(const Offset(500.0, 0.0)); await gesture.up(); await tester.pump(); await tester.pump(const Duration(milliseconds: 1000)); @@ -394,8 +394,8 @@ void main() { await tester.pump(const Duration(seconds: 1)); // Drag from left edge to invoke the gesture. - TestGesture gesture = await tester.startGesture(new Point(5.0, 100.0)); - await gesture.moveBy(new Offset(500.0, 0.0)); + TestGesture gesture = await tester.startGesture(const Point(5.0, 100.0)); + await gesture.moveBy(const Offset(500.0, 0.0)); await gesture.up(); await tester.pump(); await tester.pump(const Duration(seconds: 1)); @@ -416,7 +416,7 @@ void main() { await tester.pumpWidget(new MaterialApp(routes: routes)); PageRoute route = new MaterialPageRoute( - settings: new RouteSettings(name: '/page'), + settings: const RouteSettings(name: '/page'), builder: (BuildContext context) => new Center(child: new Text('page')), ); diff --git a/packages/flutter/test/widgets/pageable_list_test.dart b/packages/flutter/test/widgets/pageable_list_test.dart index 122af47d5a..2bd1d642d0 100644 --- a/packages/flutter/test/widgets/pageable_list_test.dart +++ b/packages/flutter/test/widgets/pageable_list_test.dart @@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; -Size pageSize = new Size(600.0, 300.0); +Size pageSize = const Size(600.0, 300.0); const List defaultPages = const [0, 1, 2, 3, 4, 5]; final List globalKeys = defaultPages.map((_) => new GlobalKey()).toList(); int currentPage; diff --git a/packages/flutter/test/widgets/remember_scroll_position_test.dart b/packages/flutter/test/widgets/remember_scroll_position_test.dart index 6c64127bfc..08fb6da409 100644 --- a/packages/flutter/test/widgets/remember_scroll_position_test.dart +++ b/packages/flutter/test/widgets/remember_scroll_position_test.dart @@ -62,7 +62,7 @@ Future performTest(WidgetTester tester, bool maintainState) async { Completer completer = new Completer(); tester.state/**/(find.byType(Scrollable)).scrollTo(1000.0).whenComplete(completer.complete); expect(completer.isCompleted, isFalse); - await tester.pump(new Duration(seconds: 1)); + await tester.pump(const Duration(seconds: 1)); expect(completer.isCompleted, isTrue); // we're 600 pixels high, each item is 100 pixels high, scroll position is @@ -82,7 +82,7 @@ Future performTest(WidgetTester tester, bool maintainState) async { navigatorKey.currentState.pushNamed('/second'); 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 expect(find.text('10000'), findsOneWidget); @@ -103,7 +103,7 @@ Future performTest(WidgetTester tester, bool maintainState) async { LazyListViewport viewport = tester.firstWidget(find.byType(LazyListViewport)); 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 // 1000, so we should have exactly 6 items, 10..15. diff --git a/packages/flutter/test/widgets/render_object_widget_test.dart b/packages/flutter/test/widgets/render_object_widget_test.dart index 0b73b995ab..115aadf70f 100644 --- a/packages/flutter/test/widgets/render_object_widget_test.dart +++ b/packages/flutter/test/widgets/render_object_widget_test.dart @@ -6,9 +6,9 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; -final BoxDecoration kBoxDecorationA = new BoxDecoration(); -final BoxDecoration kBoxDecorationB = new BoxDecoration(); -final BoxDecoration kBoxDecorationC = new BoxDecoration(); +final BoxDecoration kBoxDecorationA = new BoxDecoration(); // ignore: prefer_const_constructor +final BoxDecoration kBoxDecorationB = new BoxDecoration(); // ignore: prefer_const_constructor +final BoxDecoration kBoxDecorationC = new BoxDecoration(); // ignore: prefer_const_constructor class TestWidget extends StatelessWidget { const TestWidget({ this.child }); @@ -26,9 +26,9 @@ class TestOrientedBox extends SingleChildRenderObjectWidget { Orientation orientation = MediaQuery.of(context).orientation; switch (orientation) { case Orientation.landscape: - return new BoxDecoration(backgroundColor: const Color(0xFF00FF00)); + return const BoxDecoration(backgroundColor: const Color(0xFF00FF00)); case Orientation.portrait: - return new BoxDecoration(backgroundColor: const Color(0xFF0000FF)); + return const BoxDecoration(backgroundColor: const Color(0xFF0000FF)); } assert(orientation != null); return null; @@ -194,20 +194,20 @@ void main() { TestOrientedBox box = new TestOrientedBox(key: boxKey); 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 )); RenderDecoratedBox renderBox = tester.renderObject(find.byKey(boxKey)); BoxDecoration decoration = renderBox.decoration; - expect(decoration.backgroundColor, equals(new Color(0xFF00FF00))); + expect(decoration.backgroundColor, equals(const Color(0xFF00FF00))); 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 )); decoration = renderBox.decoration; - expect(decoration.backgroundColor, equals(new Color(0xFF0000FF))); + expect(decoration.backgroundColor, equals(const Color(0xFF0000FF))); }); } diff --git a/packages/flutter/test/widgets/rotated_box_test.dart b/packages/flutter/test/widgets/rotated_box_test.dart index c95ab3d5da..fe77899f55 100644 --- a/packages/flutter/test/widgets/rotated_box_test.dart +++ b/packages/flutter/test/widgets/rotated_box_test.dart @@ -44,11 +44,11 @@ void main() { expect(box.size.width, equals(65.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(['left'])); log.clear(); - await tester.tapAt(new Point(380.0, 320.0)); + await tester.tapAt(const Point(380.0, 320.0)); expect(log, equals(['right'])); log.clear(); }); diff --git a/packages/flutter/test/widgets/scroll_behavior_test.dart b/packages/flutter/test/widgets/scroll_behavior_test.dart index 3eb1e4cadf..cad8139300 100644 --- a/packages/flutter/test/widgets/scroll_behavior_test.dart +++ b/packages/flutter/test/widgets/scroll_behavior_test.dart @@ -80,7 +80,7 @@ void main() { expect(delegate, isNotNull); expect(delegate.flag, isTrue); - expect(behavior, new isInstanceOf()); + expect(behavior, const isInstanceOf()); expect(behavior.contentExtent, equals(1000.0)); expect(behavior.containerExtent, equals(600.0)); @@ -103,7 +103,7 @@ void main() { expect(delegate, isNotNull); expect(delegate.flag, isFalse); - expect(behavior, new isInstanceOf()); + expect(behavior, const isInstanceOf()); // Regression test for https://github.com/flutter/flutter/issues/5856 expect(behavior.contentExtent, equals(1000.0)); expect(behavior.containerExtent, equals(600.0)); diff --git a/packages/flutter/test/widgets/scroll_events_test.dart b/packages/flutter/test/widgets/scroll_events_test.dart index 8951981871..e5e4f86202 100644 --- a/packages/flutter/test/widgets/scroll_events_test.dart +++ b/packages/flutter/test/widgets/scroll_events_test.dart @@ -37,11 +37,11 @@ void main() { await tester.pumpWidget(_buildScroller(log: log)); expect(log, equals([])); - 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(['scrollstart'])); await tester.pump(const Duration(seconds: 1)); expect(log, equals(['scrollstart'])); - await gesture.moveBy(new Offset(-10.0, -10.0)); + await gesture.moveBy(const Offset(-10.0, -10.0)); expect(log, equals(['scrollstart', 'scroll'])); await tester.pump(const Duration(seconds: 1)); expect(log, equals(['scrollstart', 'scroll'])); @@ -138,15 +138,15 @@ void main() { await tester.pumpWidget(_buildScroller(key: scrollKey, log: log)); expect(log, equals([])); - await tester.flingFrom(new Point(100.0, 100.0), new Offset(-50.0, -50.0), 500.0); - await tester.pump(new Duration(seconds: 1)); + await tester.flingFrom(const Point(100.0, 100.0), const Offset(-50.0, -50.0), 500.0); + await tester.pump(const Duration(seconds: 1)); log.removeWhere((String value) => value == 'scroll'); expect(log, equals(['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'); expect(log, equals(['scrollstart', 'scrollend', 'scrollstart'])); - await tester.pump(new Duration(seconds: 1)); - await tester.pump(new Duration(seconds: 1)); + await tester.pump(const Duration(seconds: 1)); + await tester.pump(const Duration(seconds: 1)); log.removeWhere((String value) => value == 'scroll'); expect(log, equals(['scrollstart', 'scrollend', 'scrollstart', 'scrollend'])); }); @@ -157,10 +157,10 @@ void main() { await tester.pumpWidget(_buildScroller(key: scrollKey, log: log)); expect(log, equals([])); - await tester.flingFrom(new Point(100.0, 100.0), new Offset(50.0, 50.0), 500.0); - await tester.pump(new Duration(seconds: 1)); - await tester.pump(new Duration(seconds: 1)); - await tester.pump(new Duration(seconds: 1)); + await tester.flingFrom(const Point(100.0, 100.0), const Offset(50.0, 50.0), 500.0); + await tester.pump(const Duration(seconds: 1)); + await tester.pump(const Duration(seconds: 1)); + await tester.pump(const Duration(seconds: 1)); expect(log.first, equals('scrollstart')); expect(log.last, equals('scrollend')); log.removeWhere((String value) => value == 'scroll'); diff --git a/packages/flutter/test/widgets/scroll_interaction_test.dart b/packages/flutter/test/widgets/scroll_interaction_test.dart index 3cf884823b..35b594579e 100644 --- a/packages/flutter/test/widgets/scroll_interaction_test.dart +++ b/packages/flutter/test/widgets/scroll_interaction_test.dart @@ -18,7 +18,7 @@ void main() { 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(const Duration(seconds: 5)); @@ -26,7 +26,7 @@ void main() { 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(const Duration(seconds: 5)); diff --git a/packages/flutter/test/widgets/scroll_notification_test.dart b/packages/flutter/test/widgets/scroll_notification_test.dart index dd64e93ed2..3d9152933d 100644 --- a/packages/flutter/test/widgets/scroll_notification_test.dart +++ b/packages/flutter/test/widgets/scroll_notification_test.dart @@ -15,27 +15,27 @@ void main() { return false; }, 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)); expect(notification.kind, equals(ScrollNotificationKind.started)); expect(notification.depth, equals(0)); 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.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)); expect(notification.kind, equals(ScrollNotificationKind.updated)); expect(notification.depth, equals(0)); expect(notification.dragStartDetails, isNull); expect(notification.dragUpdateDetails, isNotNull); - expect(notification.dragUpdateDetails.globalPosition, equals(new Point(90.0, 90.0))); - expect(notification.dragUpdateDetails.delta, equals(new Offset(0.0, -10.0))); + expect(notification.dragUpdateDetails.globalPosition, equals(const Point(90.0, 90.0))); + expect(notification.dragUpdateDetails.delta, equals(const Offset(0.0, -10.0))); expect(notification.dragEndDetails, isNull); await gesture.up(); @@ -71,16 +71,16 @@ void main() { }, child: new Container( 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 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 gesture.up(); await tester.pump(const Duration(seconds: 1)); diff --git a/packages/flutter/test/widgets/scrollable_dispose_test.dart b/packages/flutter/test/widgets/scrollable_dispose_test.dart index a9d457d470..3b8738710c 100644 --- a/packages/flutter/test/widgets/scrollable_dispose_test.dart +++ b/packages/flutter/test/widgets/scrollable_dispose_test.dart @@ -17,10 +17,10 @@ void main() { 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(); tester.state/**/(find.byType(FlipWidget)).flip(); - await tester.pump(new Duration(hours: 5)); + await tester.pump(const Duration(hours: 5)); }); } diff --git a/packages/flutter/test/widgets/scrollable_fling_test.dart b/packages/flutter/test/widgets/scrollable_fling_test.dart index 941e808383..db1db8a38a 100644 --- a/packages/flutter/test/widgets/scrollable_fling_test.dart +++ b/packages/flutter/test/widgets/scrollable_fling_test.dart @@ -73,7 +73,7 @@ void main() { await tester.tap(find.byType(Scrollable)); await tester.pump(const Duration(milliseconds: 50)); expect(log, equals(['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)); expect(log, equals(['tap 18'])); await tester.tap(find.byType(Scrollable)); @@ -96,7 +96,7 @@ void main() { await tester.tap(find.byType(Scrollable)); await tester.pump(const Duration(milliseconds: 50)); expect(log, equals(['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)); expect(log, equals(['tap 18'])); await tester.pump(const Duration(seconds: 50)); diff --git a/packages/flutter/test/widgets/scrollable_grid_test.dart b/packages/flutter/test/widgets/scrollable_grid_test.dart index 7c7463884e..85a8773d7a 100644 --- a/packages/flutter/test/widgets/scrollable_grid_test.dart +++ b/packages/flutter/test/widgets/scrollable_grid_test.dart @@ -16,7 +16,7 @@ void main() { // Tests https://github.com/flutter/flutter/issues/5522 testWidgets('ScrollableGrid displays correct children with nonzero padding', (WidgetTester tester) async { GlobalKey scrollableKey = new GlobalKey(); - 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( child: new SizedBox( diff --git a/packages/flutter/test/widgets/scrollable_list_hit_testing_test.dart b/packages/flutter/test/widgets/scrollable_list_hit_testing_test.dart index f1341a5c26..2cf3ddbba3 100644 --- a/packages/flutter/test/widgets/scrollable_list_hit_testing_test.dart +++ b/packages/flutter/test/widgets/scrollable_list_hit_testing_test.dart @@ -94,7 +94,7 @@ void main() { new ScrollableList( key: new GlobalKey(), 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) { return new Container( child: new GestureDetector( @@ -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([])); - await tester.tapAt(new Point(200.0, 21.0)); + await tester.tapAt(const Point(200.0, 21.0)); expect(tapped, equals([0])); - await tester.tapAt(new Point(4.0, 400.0)); + await tester.tapAt(const Point(4.0, 400.0)); expect(tapped, equals([0])); - await tester.tapAt(new Point(6.0, 400.0)); + await tester.tapAt(const Point(6.0, 400.0)); expect(tapped, equals([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([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([0, 1, 1])); }); @@ -127,7 +127,7 @@ void main() { key: new GlobalKey(), itemExtent: 290.0, 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) { return new Container( child: new GestureDetector( @@ -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([])); - 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([5])); - await tester.tapAt(new Point(4.0, 200.0)); + await tester.tapAt(const Point(4.0, 200.0)); expect(tapped, equals([5])); - await tester.tapAt(new Point(6.0, 200.0)); + await tester.tapAt(const Point(6.0, 200.0)); expect(tapped, equals([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([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([5, 4, 4])); }); @@ -179,7 +179,7 @@ void main() { expect(scrollableKey.currentState.scrollOffset, equals(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([0])); }); } diff --git a/packages/flutter/test/widgets/scrollable_list_vertical_test.dart b/packages/flutter/test/widgets/scrollable_list_vertical_test.dart index d37abdf73b..a6d20840c2 100644 --- a/packages/flutter/test/widgets/scrollable_list_vertical_test.dart +++ b/packages/flutter/test/widgets/scrollable_list_vertical_test.dart @@ -67,7 +67,7 @@ void main() { await tester.pumpWidget( new ScrollableList( itemExtent: 290.0, - padding: new EdgeInsets.only(top: 250.0), + padding: const EdgeInsets.only(top: 250.0), scrollDirection: Axis.vertical, children: items.map((int item) { return new Container( diff --git a/packages/flutter/test/widgets/size_changed_layout_notification_test.dart b/packages/flutter/test/widgets/size_changed_layout_notification_test.dart index 4ce737c20d..0aa744897c 100644 --- a/packages/flutter/test/widgets/size_changed_layout_notification_test.dart +++ b/packages/flutter/test/widgets/size_changed_layout_notification_test.dart @@ -24,7 +24,7 @@ void main() { return true; }, child: new SizeChangedLayoutNotifier( - child: new SizedBox( + child: const SizedBox( width: 100.0, height: 100.0 ) @@ -39,7 +39,7 @@ void main() { return true; }, child: new SizeChangedLayoutNotifier( - child: new SizedBox( + child: const SizedBox( width: 200.0, height: 100.0 ) diff --git a/packages/flutter/test/widgets/stack_test.dart b/packages/flutter/test/widgets/stack_test.dart index 9a9c244e69..dd1bddf8bd 100644 --- a/packages/flutter/test/widgets/stack_test.dart +++ b/packages/flutter/test/widgets/stack_test.dart @@ -199,8 +199,8 @@ void main() { testWidgets('Can set width and height', (WidgetTester tester) async { Key key = new Key('container'); - BoxDecoration kBoxDecoration = new BoxDecoration( - backgroundColor: new Color(0xFF00FF00) + BoxDecoration kBoxDecoration = const BoxDecoration( + backgroundColor: const Color(0xFF00FF00) ); await tester.pumpWidget( @@ -273,7 +273,7 @@ void main() { new GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { print("HELLO"); tapped = true; }, - child: new SizedBox( + child: const SizedBox( width: 200.0, height: 200.0, ), diff --git a/packages/flutter/test/widgets/state_setting_in_scrollables_test.dart b/packages/flutter/test/widgets/state_setting_in_scrollables_test.dart index 114a659080..3dfb7ed405 100644 --- a/packages/flutter/test/widgets/state_setting_in_scrollables_test.dart +++ b/packages/flutter/test/widgets/state_setting_in_scrollables_test.dart @@ -30,39 +30,39 @@ class FooState extends State { scrollableKey.currentState.scrollBy(200.0, duration: const Duration(milliseconds: 500)); }, child: new DecoratedBox( - decoration: new BoxDecoration(backgroundColor: const Color(0)), - child: new SizedBox( + decoration: const BoxDecoration(backgroundColor: const Color(0)), + child: const SizedBox( height: 200.0, ), ) ), new DecoratedBox( - decoration: new BoxDecoration(backgroundColor: const Color(0)), - child: new SizedBox( + decoration: const BoxDecoration(backgroundColor: const Color(0)), + child: const SizedBox( height: 200.0, ), ), new DecoratedBox( - decoration: new BoxDecoration(backgroundColor: const Color(0)), - child: new SizedBox( + decoration: const BoxDecoration(backgroundColor: const Color(0)), + child: const SizedBox( height: 200.0, ), ), new DecoratedBox( - decoration: new BoxDecoration(backgroundColor: const Color(0)), - child: new SizedBox( + decoration: const BoxDecoration(backgroundColor: const Color(0)), + child: const SizedBox( height: 200.0, ), ), new DecoratedBox( - decoration: new BoxDecoration(backgroundColor: const Color(0)), - child: new SizedBox( + decoration: const BoxDecoration(backgroundColor: const Color(0)), + child: const SizedBox( height: 200.0, ), ), new DecoratedBox( - decoration: new BoxDecoration(backgroundColor: const Color(0)), - child: new SizedBox( + decoration: const BoxDecoration(backgroundColor: const Color(0)), + child: const SizedBox( height: 200.0, ), ), diff --git a/packages/flutter/test/widgets/table_test.dart b/packages/flutter/test/widgets/table_test.dart index bdf0bb6339..48e6362b36 100644 --- a/packages/flutter/test/widgets/table_test.dart +++ b/packages/flutter/test/widgets/table_test.dart @@ -288,7 +288,7 @@ void main() { new Table( children: [ new TableRow( - key: new ValueKey(1), + key: const ValueKey(1), children: [ new StatefulBuilder( builder: (BuildContext context, StateSetter setState) { @@ -315,7 +315,7 @@ void main() { ] ), new TableRow( - key: new ValueKey(1), + key: const ValueKey(1), children: [ new StatefulBuilder( builder: (BuildContext context, StateSetter setState) { diff --git a/packages/flutter/test/widgets/test_widgets.dart b/packages/flutter/test/widgets/test_widgets.dart index 91ba96b22f..d42afaeb66 100644 --- a/packages/flutter/test/widgets/test_widgets.dart +++ b/packages/flutter/test/widgets/test_widgets.dart @@ -5,15 +5,15 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/widgets.dart'; -final BoxDecoration kBoxDecorationA = new BoxDecoration( +final BoxDecoration kBoxDecorationA = const BoxDecoration( backgroundColor: const Color(0xFFFF0000) ); -final BoxDecoration kBoxDecorationB = new BoxDecoration( +final BoxDecoration kBoxDecorationB = const BoxDecoration( backgroundColor: const Color(0xFF00FF00) ); -final BoxDecoration kBoxDecorationC = new BoxDecoration( +final BoxDecoration kBoxDecorationC = const BoxDecoration( backgroundColor: const Color(0xFF0000FF) ); diff --git a/packages/flutter/test/widgets/text_test.dart b/packages/flutter/test/widgets/text_test.dart index e674ac59a1..cce76557ad 100644 --- a/packages/flutter/test/widgets/text_test.dart +++ b/packages/flutter/test/widgets/text_test.dart @@ -8,7 +8,7 @@ import 'package:flutter/widgets.dart'; void main() { testWidgets('Text respects media query', (WidgetTester tester) async { await tester.pumpWidget(new MediaQuery( - data: new MediaQueryData(textScaleFactor: 1.5), + data: const MediaQueryData(textScaleFactor: 1.5), child: new Center( child: new Text('Hello') ) diff --git a/packages/flutter/test/widgets/transform_test.dart b/packages/flutter/test/widgets/transform_test.dart index b066cb6bb6..06976e5eea 100644 --- a/packages/flutter/test/widgets/transform_test.dart +++ b/packages/flutter/test/widgets/transform_test.dart @@ -19,8 +19,8 @@ void main() { child: new Container( width: 100.0, height: 100.0, - decoration: new BoxDecoration( - backgroundColor: new Color(0xFF0000FF), + decoration: const BoxDecoration( + backgroundColor: const Color(0xFF0000FF), ), ), ), @@ -32,14 +32,14 @@ void main() { height: 100.0, child: new Transform( 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( onTap: () { didReceiveTap = true; }, child: new Container( - decoration: new BoxDecoration( - backgroundColor: new Color(0xFF00FFFF), + decoration: const BoxDecoration( + backgroundColor: const Color(0xFF00FFFF), ), ), ), @@ -51,9 +51,9 @@ void main() { ); expect(didReceiveTap, isFalse); - await tester.tapAt(new Point(110.0, 110.0)); + await tester.tapAt(const Point(110.0, 110.0)); expect(didReceiveTap, isFalse); - await tester.tapAt(new Point(190.0, 150.0)); + await tester.tapAt(const Point(190.0, 150.0)); expect(didReceiveTap, isTrue); }); @@ -68,8 +68,8 @@ void main() { child: new Container( width: 100.0, height: 100.0, - decoration: new BoxDecoration( - backgroundColor: new Color(0xFF0000FF), + decoration: const BoxDecoration( + backgroundColor: const Color(0xFF0000FF), ), ), ), @@ -81,14 +81,14 @@ void main() { height: 100.0, child: new Transform( 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( onTap: () { didReceiveTap = true; }, child: new Container( - decoration: new BoxDecoration( - backgroundColor: new Color(0xFF00FFFF), + decoration: const BoxDecoration( + backgroundColor: const Color(0xFF00FFFF), ), ), ), @@ -100,9 +100,9 @@ void main() { ); expect(didReceiveTap, isFalse); - await tester.tapAt(new Point(110.0, 110.0)); + await tester.tapAt(const Point(110.0, 110.0)); expect(didReceiveTap, isFalse); - await tester.tapAt(new Point(190.0, 150.0)); + await tester.tapAt(const Point(190.0, 150.0)); expect(didReceiveTap, isTrue); }); @@ -116,8 +116,8 @@ void main() { child: new Container( width: 100.0, height: 100.0, - decoration: new BoxDecoration( - backgroundColor: new Color(0xFF0000FF), + decoration: const BoxDecoration( + backgroundColor: const Color(0xFF0000FF), ), ), ), @@ -129,15 +129,15 @@ void main() { height: 100.0, child: new Transform( transform: new Matrix4.diagonal3Values(0.5, 0.5, 1.0), - origin: new Offset(100.0, 0.0), - alignment: new FractionalOffset(0.0, 0.5), + origin: const Offset(100.0, 0.0), + alignment: const FractionalOffset(0.0, 0.5), child: new GestureDetector( onTap: () { didReceiveTap = true; }, child: new Container( - decoration: new BoxDecoration( - backgroundColor: new Color(0xFF00FFFF), + decoration: const BoxDecoration( + backgroundColor: const Color(0xFF00FFFF), ), ), ), @@ -148,9 +148,9 @@ void main() { )); expect(didReceiveTap, isFalse); - await tester.tapAt(new Point(110.0, 110.0)); + await tester.tapAt(const Point(110.0, 110.0)); expect(didReceiveTap, isFalse); - await tester.tapAt(new Point(190.0, 150.0)); + await tester.tapAt(const Point(190.0, 150.0)); expect(didReceiveTap, isTrue); }); @@ -166,7 +166,7 @@ void main() { child: new Opacity( opacity: 0.9, child: new Container( - decoration: new BoxDecoration( + decoration: const BoxDecoration( backgroundColor: const Color(0xFF00FF00), ), ),