Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
9dab2268
Commit
9dab2268
authored
Jun 30, 2017
by
Jacob Richman
Committed by
GitHub
Jun 30, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More toStringDeep and toString tests. (#11028)
parent
6841ab22
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
405 additions
and
11 deletions
+405
-11
box_painter_test.dart
packages/flutter/test/painting/box_painter_test.dart
+41
-0
flutter_logo_test.dart
packages/flutter/test/painting/flutter_logo_test.dart
+15
-0
text_style_test.dart
packages/flutter/test/painting/text_style_test.dart
+24
-0
image_test.dart
packages/flutter/test/rendering/image_test.dart
+22
-1
paragraph_test.dart
packages/flutter/test/rendering/paragraph_test.dart
+1
-4
slivers_test.dart
packages/flutter/test/rendering/slivers_test.dart
+131
-1
table_test.dart
packages/flutter/test/rendering/table_test.dart
+17
-0
wrap_test.dart
packages/flutter/test/rendering/wrap_test.dart
+28
-0
focus_test.dart
packages/flutter/test/widgets/focus_test.dart
+19
-0
overlay_test.dart
packages/flutter/test/widgets/overlay_test.dart
+106
-3
sliver_fill_viewport_test.dart
packages/flutter/test/widgets/sliver_fill_viewport_test.dart
+1
-2
No files found.
packages/flutter/test/painting/box_painter_test.dart
View file @
9dab2268
...
...
@@ -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
(<
BoxShadow
>[
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
<
Color
>[
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)'
,
),
);
});
}
packages/flutter/test/painting/flutter_logo_test.dart
View file @
9dab2268
...
...
@@ -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)'
,
),
);
});
}
packages/flutter/test/painting/text_style_test.dart
View file @
9dab2268
...
...
@@ -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
);
...
...
packages/flutter/test/rendering/image_test.dart
View file @
9dab2268
...
...
@@ -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: <none> (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
(
...
...
packages/flutter/test/rendering/paragraph_test.dart
View file @
9dab2268
...
...
@@ -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
(),
...
...
packages/flutter/test/rendering/slivers_test.dart
View file @
9dab2268
...
...
@@ -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: <none>
\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: <none>
\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, )'
));
});
}
packages/flutter/test/rendering/table_test.dart
View file @
9dab2268
...
...
@@ -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: <none>
\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'
,
()
{
...
...
packages/flutter/test/rendering/wrap_test.dart
0 → 100644
View file @
9dab2268
// 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
'
),
);
});
}
packages/flutter/test/widgets/focus_test.dart
View file @
9dab2268
...
...
@@ -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
();
...
...
packages/flutter/test/widgets/overlay_test.dart
View file @
9dab2268
...
...
@@ -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:
<
OverlayEntry
>[
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: <none>
\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: <none> (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: <none>
\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: <none>
\n
'
' constraints: null
\n
'
' size: MISSING
\n
'
' additionalConstraints: BoxConstraints(biggest)
\n
'
),
);
});
}
packages/flutter/test/widgets/sliver_fill_viewport_test.dart
View file @
9dab2268
...
...
@@ -57,8 +57,7 @@ void main() {
expect
(
find
.
text
(
'3'
),
findsNothing
);
final
RenderObject
viewport
=
tester
.
renderObject
<
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
(),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment