From 9dab22684a7e7b66561b24af9cafbefe21603f9f Mon Sep 17 00:00:00 2001 From: Jacob Richman Date: Thu, 29 Jun 2017 18:57:21 -0700 Subject: [PATCH] More toStringDeep and toString tests. (#11028) --- .../test/painting/box_painter_test.dart | 41 ++++++ .../test/painting/flutter_logo_test.dart | 15 ++ .../test/painting/text_style_test.dart | 24 ++++ .../flutter/test/rendering/image_test.dart | 23 ++- .../test/rendering/paragraph_test.dart | 5 +- .../flutter/test/rendering/slivers_test.dart | 132 +++++++++++++++++- .../flutter/test/rendering/table_test.dart | 17 +++ .../flutter/test/rendering/wrap_test.dart | 28 ++++ packages/flutter/test/widgets/focus_test.dart | 19 +++ .../flutter/test/widgets/overlay_test.dart | 109 ++++++++++++++- .../widgets/sliver_fill_viewport_test.dart | 3 +- 11 files changed, 405 insertions(+), 11 deletions(-) create mode 100644 packages/flutter/test/rendering/wrap_test.dart diff --git a/packages/flutter/test/painting/box_painter_test.dart b/packages/flutter/test/painting/box_painter_test.dart index 4373036d3a..672f0333be 100644 --- a/packages/flutter/test/painting/box_painter_test.dart +++ b/packages/flutter/test/painting/box_painter_test.dart @@ -39,6 +39,18 @@ void main() { expect(interpolated.color, equals(side2.color.withOpacity(0.2))); }); + test('BorderSide toString test', () { + final BorderSide side1 = const BorderSide(); + final BorderSide side2 = side1.copyWith( + color: const Color(0xFF00FFFF), + width: 2.0, + style: BorderStyle.solid, + ); + + expect(side1.toString(), equals('BorderSide(Color(0xff000000), 1.0, BorderStyle.solid)')); + expect(side2.toString(), equals('BorderSide(Color(0xff00ffff), 2.0, BorderStyle.solid)')); + }); + test('Border control test', () { final Border border1 = new Border.all(width: 4.0); final Border border2 = Border.lerp(null, border1, 0.25); @@ -54,6 +66,15 @@ void main() { expect(border4.left.width, equals(2.0)); }); + test('Border toString test', () { + expect( + new Border.all(width: 4.0).toString(), + equals( + 'Border(BorderSide(Color(0xff000000), 4.0, BorderStyle.solid), BorderSide(Color(0xff000000), 4.0, BorderStyle.solid), BorderSide(Color(0xff000000), 4.0, BorderStyle.solid), BorderSide(Color(0xff000000), 4.0, BorderStyle.solid))', + ), + ); + }); + test('BoxShadow control test', () { final BoxShadow shadow1 = const BoxShadow(blurRadius: 4.0); final BoxShadow shadow2 = BoxShadow.lerp(null, shadow1, 0.25); @@ -77,6 +98,10 @@ void main() { expect(shadowList, equals([shadow4, shadow1.scale(0.5)])); }); + test('BoxShadow toString test', () { + expect(const BoxShadow(blurRadius: 4.0).toString(), equals('BoxShadow(Color(0xff000000), Offset(0.0, 0.0), 4.0, 0.0)')); + }); + test('LinearGradient scale test', () { final LinearGradient testGradient = const LinearGradient( begin: FractionalOffset.bottomRight, @@ -130,4 +155,20 @@ void main() { ], )); }); + + test('LinearGradient toString', () { + expect( + const LinearGradient( + begin: FractionalOffset.topLeft, + end: FractionalOffset.bottomLeft, + colors: const [ + const Color(0x33333333), + const Color(0x66666666), + ], + ).toString(), + equals( + 'LinearGradient(FractionalOffset(0.0, 0.0), FractionalOffset(0.0, 1.0), [Color(0x33333333), Color(0x66666666)], null, TileMode.clamp)', + ), + ); + }); } diff --git a/packages/flutter/test/painting/flutter_logo_test.dart b/packages/flutter/test/painting/flutter_logo_test.dart index b0189498e9..5e7b68e3af 100644 --- a/packages/flutter/test/painting/flutter_logo_test.dart +++ b/packages/flutter/test/painting/flutter_logo_test.dart @@ -63,4 +63,19 @@ void main() { logo = FlutterLogoDecoration.lerp(start, end, 0.5); expect(logo.style, end.style); }); + + test('FlutterLogoDecoration toString', () { + expect( + start.toString(), + equals( + 'FlutterLogoDecoration(Color(0xff000000)/Color(0xffffffff) on Color(0xffd4f144), FlutterLogoStyle.stacked)' + ), + ); + expect( + FlutterLogoDecoration.lerp(null, end, 0.5).toString(), + equals( + 'FlutterLogoDecoration(Color(0xffffffff)/Color(0xff000000) on Color(0xff81d4fa), FlutterLogoStyle.stacked, transition -1.0:0.5)', + ), + ); + }); } diff --git a/packages/flutter/test/painting/text_style_test.dart b/packages/flutter/test/painting/text_style_test.dart index 6e62cc1bab..9e43ac9cc2 100644 --- a/packages/flutter/test/painting/text_style_test.dart +++ b/packages/flutter/test/painting/text_style_test.dart @@ -9,6 +9,11 @@ import 'package:test/test.dart'; void main() { test("TextStyle control test", () { + expect(const TextStyle(inherit: false).toString(), equals( + 'inherit: false')); + expect(const TextStyle(inherit: true).toString(), equals( + 'inherit: true')); + final TextStyle s1 = const TextStyle( fontSize: 10.0, fontWeight: FontWeight.w800, @@ -20,6 +25,15 @@ void main() { expect(s1.fontWeight, FontWeight.w800); expect(s1.height, 123.0); expect(s1, equals(s1)); + expect( + s1.toString(), + equals( + 'inherit: true\n' + 'size: 10.0\n' + 'weight: 800\n' + 'height: 123.0x', + ), + ); final TextStyle s2 = s1.copyWith(color: const Color(0xFF00FF00), height: 100.0); expect(s1.fontFamily, isNull); @@ -33,6 +47,16 @@ void main() { expect(s2.height, 100.0); expect(s2.color, const Color(0xFF00FF00)); expect(s2, isNot(equals(s1))); + expect( + s2.toString(), + equals( + 'inherit: true\n' + 'color: Color(0xff00ff00)\n' + 'size: 10.0\n' + 'weight: 800\n' + 'height: 100.0x', + ), + ); final TextStyle s3 = s1.apply(fontSizeFactor: 2.0, fontSizeDelta: -2.0, fontWeightDelta: -4); expect(s1.fontFamily, isNull); diff --git a/packages/flutter/test/rendering/image_test.dart b/packages/flutter/test/rendering/image_test.dart index afe17994cb..23918f6ed8 100644 --- a/packages/flutter/test/rendering/image_test.dart +++ b/packages/flutter/test/rendering/image_test.dart @@ -5,7 +5,7 @@ import 'dart:ui' as ui show Image; import 'package:flutter/rendering.dart'; -import 'package:test/test.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'rendering_tester.dart'; @@ -16,6 +16,9 @@ class SquareImage implements ui.Image { @override int get height => 10; + @override + String toString() => '[$width\u00D7$height]'; + @override void dispose() { } } @@ -27,6 +30,9 @@ class WideImage implements ui.Image { @override int get height => 10; + @override + String toString() => '[$width\u00D7$height]'; + @override void dispose() { } } @@ -38,6 +44,9 @@ class TallImage implements ui.Image { @override int get height => 20; + @override + String toString() => '[$width\u00D7$height]'; + @override void dispose() { } } @@ -56,6 +65,18 @@ void main() { expect(image.size.width, equals(25.0)); expect(image.size.height, equals(25.0)); + expect(image, hasAGoodToStringDeep); + expect( + image.toStringDeep(), + equalsIgnoringHashCodes( + 'RenderImage#00000 relayoutBoundary=up2 NEEDS-PAINT\n' + ' parentData: (can use size)\n' + ' constraints: BoxConstraints(25.0<=w<=100.0, 25.0<=h<=100.0)\n' + ' size: Size(25.0, 25.0)\n' + ' image: [10×10]\n' + ), + ); + image = new RenderImage(image: new WideImage()); layout(image, constraints: const BoxConstraints( diff --git a/packages/flutter/test/rendering/paragraph_test.dart b/packages/flutter/test/rendering/paragraph_test.dart index 391360f858..e90d7f28d5 100644 --- a/packages/flutter/test/rendering/paragraph_test.dart +++ b/packages/flutter/test/rendering/paragraph_test.dart @@ -181,10 +181,7 @@ void main() { final RenderParagraph paragraph = new RenderParagraph( const TextSpan(text: _kText), ); - // TODO(jacobr): the toStringDeep method for RenderParagraph needs to be - // fixed to not emit a spurious line of trailing whitespace and fixed so - // that the \n within the TextSpan content does not interfere with the box - // border. + // TODO(jacobr): fix handling of text spans with line breaks. expect(paragraph, isNot(hasAGoodToStringDeep)); expect( paragraph.toStringDeep(), diff --git a/packages/flutter/test/rendering/slivers_test.dart b/packages/flutter/test/rendering/slivers_test.dart index 89215d18fd..cbd2f2bd48 100644 --- a/packages/flutter/test/rendering/slivers_test.dart +++ b/packages/flutter/test/rendering/slivers_test.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/rendering.dart'; -import 'package:test/test.dart'; +import 'package:flutter_test/flutter_test.dart'; import 'package:vector_math/vector_math_64.dart'; import 'rendering_tester.dart'; @@ -13,8 +13,39 @@ void main() { final RenderViewport root = new RenderViewport( offset: new ViewportOffset.zero(), ); + // TODO(jacobr): remove extra trailing line break. + expect(root, isNot(hasAGoodToStringDeep)); + expect( + root.toStringDeep(), + equalsIgnoringHashCodes( + 'RenderViewport#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n' + ' │ parentData: null\n' + ' │ constraints: null\n' + ' │ size: MISSING\n' + ' │ AxisDirection.down\n' + ' │ offset: _FixedViewportOffset#da23b(offset: 0.0)\n' + ' │ anchor: 0.0\n' + '\n' + ), + ); layout(root); root.offset = new ViewportOffset.fixed(900.0); + // TODO(jacobr): remove extra trailing line break. + expect(root, isNot(hasAGoodToStringDeep)); + expect( + root.toStringDeep(), + equalsIgnoringHashCodes( + 'RenderViewport#00000 NEEDS-LAYOUT NEEDS-PAINT\n' + ' │ parentData: \n' + ' │ constraints: BoxConstraints(w=800.0, h=600.0)\n' + ' │ size: Size(800.0, 600.0)\n' + ' │ AxisDirection.down\n' + ' │ offset: _FixedViewportOffset#00000(offset: 900.0)\n' + ' │ anchor: 0.0\n' + '\n', + ), + ); + pumpFrame(); }); @@ -30,11 +61,95 @@ void main() { new RenderSliverToBoxAdapter(child: e = new RenderSizedBox(const Size(100.0, 400.0))), ], ); + expect(root, hasAGoodToStringDeep); layout(root); expect(root.size.width, equals(800.0)); expect(root.size.height, equals(600.0)); + expect(root, hasAGoodToStringDeep); + expect( + root.toStringDeep(), + equalsIgnoringHashCodes( + 'RenderViewport#00000 NEEDS-PAINT\n' + ' │ parentData: \n' + ' │ constraints: BoxConstraints(w=800.0, h=600.0)\n' + ' │ size: Size(800.0, 600.0)\n' + ' │ AxisDirection.down\n' + ' │ offset: _FixedViewportOffset#00000(offset: 0.0)\n' + ' │ anchor: 0.0\n' + ' │\n' + ' ├─center child: RenderSliverToBoxAdapter#00000 relayoutBoundary=up1 NEEDS-PAINT\n' + ' │ │ parentData: paintOffset=Offset(0.0, 0.0) (can use size)\n' + ' │ │ constraints: SliverConstraints(AxisDirection.down,\n' + ' │ │ GrowthDirection.forward, ScrollDirection.idle, scrollOffset:\n' + ' │ │ 0.0, remainingPaintExtent: 600.0, crossAxisExtent: 800.0,\n' + ' │ │ viewportMainAxisExtent: 600.0)\n' + ' │ │ geometry: SliverGeometry(scrollExtent: 400.0, paintExtent: 400.0,\n' + ' │ │ maxPaintExtent: 400.0, )\n' + ' │ │\n' + ' │ └─child: RenderSizedBox#00000 NEEDS-PAINT\n' + ' │ parentData: paintOffset=Offset(0.0, -0.0) (can use size)\n' + ' │ constraints: BoxConstraints(w=800.0, 0.0<=h<=Infinity)\n' + ' │ size: Size(800.0, 400.0)\n' + ' │\n' + ' ├─child 1: RenderSliverToBoxAdapter#00000 relayoutBoundary=up1 NEEDS-PAINT\n' + ' │ │ parentData: paintOffset=Offset(0.0, 400.0) (can use size)\n' + ' │ │ constraints: SliverConstraints(AxisDirection.down,\n' + ' │ │ GrowthDirection.forward, ScrollDirection.idle, scrollOffset:\n' + ' │ │ 0.0, remainingPaintExtent: 200.0, crossAxisExtent: 800.0,\n' + ' │ │ viewportMainAxisExtent: 600.0)\n' + ' │ │ geometry: SliverGeometry(scrollExtent: 400.0, paintExtent: 200.0,\n' + ' │ │ maxPaintExtent: 400.0, hasVisualOverflow: true, )\n' + ' │ │\n' + ' │ └─child: RenderSizedBox#00000 NEEDS-PAINT\n' + ' │ parentData: paintOffset=Offset(0.0, -0.0) (can use size)\n' + ' │ constraints: BoxConstraints(w=800.0, 0.0<=h<=Infinity)\n' + ' │ size: Size(800.0, 400.0)\n' + ' │\n' + ' ├─child 2: RenderSliverToBoxAdapter#00000 relayoutBoundary=up1 NEEDS-PAINT\n' + ' │ │ parentData: paintOffset=Offset(0.0, 600.0) (can use size)\n' + ' │ │ constraints: SliverConstraints(AxisDirection.down,\n' + ' │ │ GrowthDirection.forward, ScrollDirection.idle, scrollOffset:\n' + ' │ │ 0.0, remainingPaintExtent: 0.0, crossAxisExtent: 800.0,\n' + ' │ │ viewportMainAxisExtent: 600.0)\n' + ' │ │ geometry: SliverGeometry(scrollExtent: 400.0, hidden,\n' + ' │ │ maxPaintExtent: 400.0, hasVisualOverflow: true, )\n' + ' │ │\n' + ' │ └─child: RenderSizedBox#00000 NEEDS-PAINT\n' + ' │ parentData: paintOffset=Offset(0.0, -0.0) (can use size)\n' + ' │ constraints: BoxConstraints(w=800.0, 0.0<=h<=Infinity)\n' + ' │ size: Size(800.0, 400.0)\n' + ' │\n' + ' ├─child 3: RenderSliverToBoxAdapter#00000 relayoutBoundary=up1 NEEDS-PAINT\n' + ' │ │ parentData: paintOffset=Offset(0.0, 600.0) (can use size)\n' + ' │ │ constraints: SliverConstraints(AxisDirection.down,\n' + ' │ │ GrowthDirection.forward, ScrollDirection.idle, scrollOffset:\n' + ' │ │ 0.0, remainingPaintExtent: 0.0, crossAxisExtent: 800.0,\n' + ' │ │ viewportMainAxisExtent: 600.0)\n' + ' │ │ geometry: SliverGeometry(scrollExtent: 400.0, hidden,\n' + ' │ │ maxPaintExtent: 400.0, hasVisualOverflow: true, )\n' + ' │ │\n' + ' │ └─child: RenderSizedBox#00000 NEEDS-PAINT\n' + ' │ parentData: paintOffset=Offset(0.0, -0.0) (can use size)\n' + ' │ constraints: BoxConstraints(w=800.0, 0.0<=h<=Infinity)\n' + ' │ size: Size(800.0, 400.0)\n' + ' │\n' + ' └─child 4: RenderSliverToBoxAdapter#00000 relayoutBoundary=up1 NEEDS-PAINT\n' + ' │ parentData: paintOffset=Offset(0.0, 600.0) (can use size)\n' + ' │ constraints: SliverConstraints(AxisDirection.down,\n' + ' │ GrowthDirection.forward, ScrollDirection.idle, scrollOffset:\n' + ' │ 0.0, remainingPaintExtent: 0.0, crossAxisExtent: 800.0,\n' + ' │ viewportMainAxisExtent: 600.0)\n' + ' │ geometry: SliverGeometry(scrollExtent: 400.0, hidden,\n' + ' │ maxPaintExtent: 400.0, hasVisualOverflow: true, )\n' + ' │\n' + ' └─child: RenderSizedBox#00000 NEEDS-PAINT\n' + ' parentData: paintOffset=Offset(0.0, -0.0) (can use size)\n' + ' constraints: BoxConstraints(w=800.0, 0.0<=h<=Infinity)\n' + ' size: Size(800.0, 400.0)\n', + ), + ); expect(a.localToGlobal(const Offset(0.0, 0.0)), const Offset(0.0, 0.0)); expect(b.localToGlobal(const Offset(0.0, 0.0)), const Offset(0.0, 400.0)); expect(c.localToGlobal(const Offset(0.0, 0.0)), const Offset(0.0, 600.0)); @@ -278,6 +393,8 @@ void main() { final RenderShrinkWrappingViewport root = new RenderShrinkWrappingViewport( offset: new ViewportOffset.zero(), ); + // TODO(jacobr): remove extra trailing line break. + expect(root, isNot(hasAGoodToStringDeep)); layout(root); root.offset = new ViewportOffset.fixed(900.0); pumpFrame(); @@ -538,4 +655,17 @@ void main() { expect(child.size.width, equals(450.0)); expect(child.size.height, equals(600.0)); }); + + test('SliverGeometry toString', () { + // TODO(jacobr): cleanup the spurious trailing commas from the toString for + // SliverGeometry. + expect( + const SliverGeometry().toString(), + equals('SliverGeometry(scrollExtent: 0.0, hidden, maxPaintExtent: 0.0, )')); + expect( + const SliverGeometry(scrollExtent: 100.0, paintExtent: 50.0, layoutExtent: 20.0, visible: true).toString(), + equals('SliverGeometry(scrollExtent: 100.0, paintExtent: 50.0, layoutExtent: 20.0, maxPaintExtent: 0.0, )')); + expect(const SliverGeometry(scrollExtent: 100.0, paintExtent: 0.0, layoutExtent: 20.0).toString(), + equals('SliverGeometry(scrollExtent: 100.0, hidden, layoutExtent: 20.0, maxPaintExtent: 0.0, )')); + }); } diff --git a/packages/flutter/test/rendering/table_test.dart b/packages/flutter/test/rendering/table_test.dart index 8019950f98..4c253ce288 100644 --- a/packages/flutter/test/rendering/table_test.dart +++ b/packages/flutter/test/rendering/table_test.dart @@ -20,6 +20,23 @@ void main() { expect(table.size.width, equals(800.0)); expect(table.size.height, equals(600.0)); + + expect(table, hasAGoodToStringDeep); + expect( + table.toStringDeep(), + equalsIgnoringHashCodes( + 'RenderTable#00000 NEEDS-PAINT\n' + ' │ parentData: \n' + ' │ constraints: BoxConstraints(w=800.0, h=600.0)\n' + ' │ size: Size(800.0, 600.0)\n' + ' │ default column width: FlexColumnWidth(1.0)\n' + ' │ table size: 0×0\n' + ' │ column offsets: unknown\n' + ' │ row offsets: []\n' + ' │\n' + ' └─table is empty\n', + ), + ); }); test('Table control test; loose', () { diff --git a/packages/flutter/test/rendering/wrap_test.dart b/packages/flutter/test/rendering/wrap_test.dart new file mode 100644 index 0000000000..14fb745ee8 --- /dev/null +++ b/packages/flutter/test/rendering/wrap_test.dart @@ -0,0 +1,28 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/rendering.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + test('Wrap test; toStringDeep', () { + final RenderWrap renderWrap = new RenderWrap(); + expect(renderWrap, hasAGoodToStringDeep); + expect( + renderWrap.toStringDeep(), + equalsIgnoringHashCodes( + 'RenderWrap#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED\n' + ' parentData: null\n' + ' constraints: null\n' + ' size: MISSING\n' + ' direction: Axis.horizontal\n' + ' alignment: WrapAlignment.start\n' + ' spacing: 0.0\n' + ' runAlignment: WrapAlignment.start\n' + ' runSpacing: 0.0\n' + ' crossAxisAlignment: 0.0\n' + ), + ); + }); +} diff --git a/packages/flutter/test/widgets/focus_test.dart b/packages/flutter/test/widgets/focus_test.dart index a80a519dec..8ec6ca6838 100644 --- a/packages/flutter/test/widgets/focus_test.dart +++ b/packages/flutter/test/widgets/focus_test.dart @@ -167,6 +167,25 @@ void main() { expect(find.text('a'), findsNothing); expect(find.text('A FOCUSED'), findsOneWidget); + expect(parentFocusScope, hasAGoodToStringDeep); + expect( + parentFocusScope.toStringDeep(), + equalsIgnoringHashCodes( + 'FocusScopeNode#00000\n' + ' focus: FocusNode#00000(FOCUSED)\n' + ), + ); + + expect(WidgetsBinding.instance.focusManager.rootScope, hasAGoodToStringDeep); + expect( + WidgetsBinding.instance.focusManager.rootScope.toStringDeep(), + equalsIgnoringHashCodes( + 'FocusScopeNode#00000\n' + ' └─child 1: FocusScopeNode#00000\n' + ' focus: FocusNode#00000(FOCUSED)\n' + ), + ); + parentFocusScope.setFirstFocus(childFocusScope); await tester.idle(); diff --git a/packages/flutter/test/widgets/overlay_test.dart b/packages/flutter/test/widgets/overlay_test.dart index a6e33f09d9..e0a8f337e5 100644 --- a/packages/flutter/test/widgets/overlay_test.dart +++ b/packages/flutter/test/widgets/overlay_test.dart @@ -21,13 +21,13 @@ void main() { expect(overlay.key, equals(overlayKey)); return new Container(); }, - ) + ), ], )); expect(didBuild, isTrue); final RenderObject theater = overlayKey.currentContext.findRenderObject(); - // TODO(jacobr): toStringDeep output is missing a trailing line break. + // TODO(jacobr): toStringDeep is missing a trailing \n on the last line. expect(theater, isNot(hasAGoodToStringDeep)); expect( theater.toStringDeep(), @@ -71,7 +71,110 @@ void main() { ' └╌no offstage children', ), ); + }); - // TODO(jacobr): add a test with offstage children. + testWidgets('Offstage overlay', (WidgetTester tester) async { + final GlobalKey overlayKey = new GlobalKey(); + await tester.pumpWidget(new Overlay( + key: overlayKey, + initialEntries: [ + new OverlayEntry( + opaque: true, + maintainState: true, + builder: (BuildContext context) => new Container(), + ), + new OverlayEntry( + opaque: true, + maintainState: true, + builder: (BuildContext context) => new Container(), + ), + new OverlayEntry( + opaque: true, + maintainState: true, + builder: (BuildContext context) => new Container(), + ), + ], + )); + final RenderObject theater = overlayKey.currentContext.findRenderObject(); + + expect(theater, hasAGoodToStringDeep); + expect( + theater.toStringDeep(), + equalsIgnoringHashCodes( + '_RenderTheatre#00000\n' + ' │ creator: _Theatre ← Overlay-[GlobalKey#00000] ← [root]\n' + ' │ parentData: \n' + ' │ constraints: BoxConstraints(w=800.0, h=600.0)\n' + ' │ size: Size(800.0, 600.0)\n' + ' │\n' + ' ├─onstage: RenderStack#00000\n' + ' ╎ │ creator: Stack ← _Theatre ← Overlay-[GlobalKey#00000] ← [root]\n' + ' ╎ │ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n' + ' ╎ │ size)\n' + ' ╎ │ constraints: BoxConstraints(w=800.0, h=600.0)\n' + ' ╎ │ size: Size(800.0, 600.0)\n' + ' ╎ │ alignment: FractionalOffset(0.0, 0.0)\n' + ' ╎ │ fit: StackFit.expand\n' + ' ╎ │ overflow: Overflow.clip\n' + ' ╎ │\n' + ' ╎ └─child 1: RenderLimitedBox#00000\n' + ' ╎ │ creator: LimitedBox ← Container ←\n' + ' ╎ │ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n' + ' ╎ │ Stack ← _Theatre ← Overlay-[GlobalKey#00000] ← [root]\n' + ' ╎ │ parentData: not positioned; offset=Offset(0.0, 0.0) (can use\n' + ' ╎ │ size)\n' + ' ╎ │ constraints: BoxConstraints(w=800.0, h=600.0)\n' + ' ╎ │ size: Size(800.0, 600.0)\n' + ' ╎ │ maxWidth: 0.0\n' + ' ╎ │ maxHeight: 0.0\n' + ' ╎ │\n' + ' ╎ └─child: RenderConstrainedBox#00000\n' + ' ╎ creator: ConstrainedBox ← LimitedBox ← Container ←\n' + ' ╎ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n' + ' ╎ Stack ← _Theatre ← Overlay-[GlobalKey#00000] ← [root]\n' + ' ╎ parentData: (can use size)\n' + ' ╎ constraints: BoxConstraints(w=800.0, h=600.0)\n' + ' ╎ size: Size(800.0, 600.0)\n' + ' ╎ additionalConstraints: BoxConstraints(biggest)\n' + ' ╎\n' + ' ╎╌offstage 1: RenderLimitedBox#00000 NEEDS-LAYOUT NEEDS-PAINT\n' + ' ╎ │ creator: LimitedBox ← Container ←\n' + ' ╎ │ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n' + ' ╎ │ TickerMode ← _Theatre ← Overlay-[GlobalKey#00000] ← [root]\n' + ' ╎ │ parentData: not positioned; offset=Offset(0.0, 0.0)\n' + ' ╎ │ constraints: null\n' + ' ╎ │ size: MISSING\n' + ' ╎ │ maxWidth: 0.0\n' + ' ╎ │ maxHeight: 0.0\n' + ' ╎ │\n' + ' ╎ └─child: RenderConstrainedBox#00000 NEEDS-LAYOUT NEEDS-PAINT\n' + ' ╎ creator: ConstrainedBox ← LimitedBox ← Container ←\n' + ' ╎ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n' + ' ╎ TickerMode ← _Theatre ← Overlay-[GlobalKey#00000] ← [root]\n' + ' ╎ parentData: \n' + ' ╎ constraints: null\n' + ' ╎ size: MISSING\n' + ' ╎ additionalConstraints: BoxConstraints(biggest)\n' + ' ╎\n' + ' └╌offstage 2: RenderLimitedBox#00000 NEEDS-LAYOUT NEEDS-PAINT\n' + ' │ creator: LimitedBox ← Container ←\n' + ' │ _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n' + ' │ TickerMode ← _Theatre ← Overlay-[GlobalKey#00000] ← [root]\n' + ' │ parentData: not positioned; offset=Offset(0.0, 0.0)\n' + ' │ constraints: null\n' + ' │ size: MISSING\n' + ' │ maxWidth: 0.0\n' + ' │ maxHeight: 0.0\n' + ' │\n' + ' └─child: RenderConstrainedBox#00000 NEEDS-LAYOUT NEEDS-PAINT\n' + ' creator: ConstrainedBox ← LimitedBox ← Container ←\n' + ' _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#00000] ←\n' + ' TickerMode ← _Theatre ← Overlay-[GlobalKey#00000] ← [root]\n' + ' parentData: \n' + ' constraints: null\n' + ' size: MISSING\n' + ' additionalConstraints: BoxConstraints(biggest)\n' + ), + ); }); } diff --git a/packages/flutter/test/widgets/sliver_fill_viewport_test.dart b/packages/flutter/test/widgets/sliver_fill_viewport_test.dart index dbd8c50336..518633d93f 100644 --- a/packages/flutter/test/widgets/sliver_fill_viewport_test.dart +++ b/packages/flutter/test/widgets/sliver_fill_viewport_test.dart @@ -57,8 +57,7 @@ void main() { expect(find.text('3'), findsNothing); final RenderObject viewport = tester.renderObject(find.byType(SliverFillViewport).first); - // Unfortunately this toStringDeep method currently has an extra line break - // at the end. + // TODO(jacobr): toStringDeep has an extra trailing \n. expect(viewport, isNot(hasAGoodToStringDeep)); expect( viewport.toStringDeep(),