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
59fc9216
Unverified
Commit
59fc9216
authored
Apr 23, 2021
by
Alexandre Ardhuin
Committed by
GitHub
Apr 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add missing trailing commas (#81065)
parent
84bc2382
Changes
39
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
757 additions
and
546 deletions
+757
-546
aspect_ratio_test.dart
packages/flutter/test/rendering/aspect_ratio_test.dart
+3
-2
box_test.dart
packages/flutter/test/rendering/box_test.dart
+23
-21
constraints_test.dart
packages/flutter/test/rendering/constraints_test.dart
+4
-4
debug_test.dart
packages/flutter/test/rendering/debug_test.dart
+24
-8
dynamic_intrinsics_test.dart
packages/flutter/test/rendering/dynamic_intrinsics_test.dart
+15
-12
editable_test.dart
packages/flutter/test/rendering/editable_test.dart
+7
-5
error_test.dart
packages/flutter/test/rendering/error_test.dart
+30
-12
flex_test.dart
packages/flutter/test/rendering/flex_test.dart
+33
-15
image_test.dart
packages/flutter/test/rendering/image_test.dart
+79
-79
independent_layout_test.dart
packages/flutter/test/rendering/independent_layout_test.dart
+1
-1
intrinsic_width_test.dart
packages/flutter/test/rendering/intrinsic_width_test.dart
+92
-26
layer_annotations_test.dart
packages/flutter/test/rendering/layer_annotations_test.dart
+255
-211
layers_test.dart
packages/flutter/test/rendering/layers_test.dart
+11
-3
limited_box_test.dart
packages/flutter/test/rendering/limited_box_test.dart
+3
-3
mock_canvas.dart
packages/flutter/test/rendering/mock_canvas.dart
+23
-7
mouse_tracker_cursor_test.dart
...ges/flutter/test/rendering/mouse_tracker_cursor_test.dart
+8
-16
mouse_tracker_test.dart
packages/flutter/test/rendering/mouse_tracker_test.dart
+13
-13
object_test.dart
packages/flutter/test/rendering/object_test.dart
+2
-2
paint_error_test.dart
packages/flutter/test/rendering/paint_error_test.dart
+3
-3
paragraph_test.dart
packages/flutter/test/rendering/paragraph_test.dart
+14
-14
platform_view_test.dart
packages/flutter/test/rendering/platform_view_test.dart
+1
-1
proxy_box_test.dart
packages/flutter/test/rendering/proxy_box_test.dart
+15
-11
proxy_sliver_test.dart
packages/flutter/test/rendering/proxy_sliver_test.dart
+8
-8
reattach_test.dart
packages/flutter/test/rendering/reattach_test.dart
+5
-5
recording_canvas.dart
packages/flutter/test/rendering/recording_canvas.dart
+1
-1
rendering_tester.dart
packages/flutter/test/rendering/rendering_tester.dart
+1
-2
repaint_boundary_test.dart
packages/flutter/test/rendering/repaint_boundary_test.dart
+2
-2
simple_semantics_test.dart
packages/flutter/test/rendering/simple_semantics_test.dart
+3
-3
size_test.dart
packages/flutter/test/rendering/size_test.dart
+2
-1
sliver_fixed_extent_layout_test.dart
...utter/test/rendering/sliver_fixed_extent_layout_test.dart
+14
-9
sliver_persistent_header_test.dart
...flutter/test/rendering/sliver_persistent_header_test.dart
+2
-2
slivers_test.dart
packages/flutter/test/rendering/slivers_test.dart
+2
-2
stack_test.dart
packages/flutter/test/rendering/stack_test.dart
+7
-7
table_border_test.dart
packages/flutter/test/rendering/table_border_test.dart
+4
-2
table_test.dart
packages/flutter/test/rendering/table_test.dart
+1
-1
transform_test.dart
packages/flutter/test/rendering/transform_test.dart
+4
-2
viewport_caching_test.dart
packages/flutter/test/rendering/viewport_caching_test.dart
+3
-2
viewport_test.dart
packages/flutter/test/rendering/viewport_test.dart
+37
-26
wrap_test.dart
packages/flutter/test/rendering/wrap_test.dart
+2
-2
No files found.
packages/flutter/test/rendering/aspect_ratio_test.dart
View file @
59fc9216
...
@@ -114,13 +114,14 @@ void main() {
...
@@ -114,13 +114,14 @@ void main() {
});
});
expect
(
errors
,
hasLength
(
2
));
expect
(
errors
,
hasLength
(
2
));
expect
(
errors
.
first
.
exception
,
isFlutterError
);
expect
(
errors
.
first
.
exception
,
isFlutterError
);
expect
((
errors
.
first
.
exception
as
FlutterError
).
toStringDeep
(),
expect
(
(
errors
.
first
.
exception
as
FlutterError
).
toStringDeep
(),
'FlutterError
\n
'
'FlutterError
\n
'
' RenderAspectRatio has unbounded constraints.
\n
'
' RenderAspectRatio has unbounded constraints.
\n
'
' This RenderAspectRatio was given an aspect ratio of 0.5 but was
\n
'
' This RenderAspectRatio was given an aspect ratio of 0.5 but was
\n
'
' given both unbounded width and unbounded height constraints.
\n
'
' given both unbounded width and unbounded height constraints.
\n
'
' Because both constraints were unbounded, this render object
\n
'
' Because both constraints were unbounded, this render object
\n
'
" doesn't know how much size to consume.
\n
"
" doesn't know how much size to consume.
\n
"
,
);
);
// The second error message is a generic message generated by the Dart VM. Not worth testing.
// The second error message is a generic message generated by the Dart VM. Not worth testing.
});
});
...
...
packages/flutter/test/rendering/box_test.dart
View file @
59fc9216
...
@@ -69,7 +69,7 @@ void main() {
...
@@ -69,7 +69,7 @@ void main() {
' MissingPerformLayoutRenderBox did not implement performLayout().
\n
'
' MissingPerformLayoutRenderBox did not implement performLayout().
\n
'
' RenderBox subclasses need to either override performLayout() to
\n
'
' RenderBox subclasses need to either override performLayout() to
\n
'
' set a size and lay out any children, or, set sizedByParent to
\n
'
' set a size and lay out any children, or, set sizedByParent to
\n
'
' true so that performResize() sizes the render object.
\n
'
' true so that performResize() sizes the render object.
\n
'
,
),
),
);
);
expect
(
expect
(
...
@@ -123,7 +123,7 @@ void main() {
...
@@ -123,7 +123,7 @@ void main() {
' use that ParentData class for its children, it must provide an
\n
'
' use that ParentData class for its children, it must provide an
\n
'
' implementation of applyPaintTransform that supports the specific
\n
'
' implementation of applyPaintTransform that supports the specific
\n
'
' ParentData subclass used by its children (which apparently is
\n
'
' ParentData subclass used by its children (which apparently is
\n
'
' ParentData).
\n
'
' ParentData).
\n
'
,
),
),
);
);
...
@@ -165,7 +165,7 @@ void main() {
...
@@ -165,7 +165,7 @@ void main() {
' performResize() nor performLayout() were being run for this
\n
'
' performResize() nor performLayout() were being run for this
\n
'
' object).
\n
'
' object).
\n
'
' Because this RenderBox has sizedByParent set to false, it must
\n
'
' Because this RenderBox has sizedByParent set to false, it must
\n
'
' set its size in performLayout().
\n
'
' set its size in performLayout().
\n
'
,
),
),
);
);
expect
(
result
.
diagnostics
.
where
((
DiagnosticsNode
node
)
=>
node
.
level
==
DiagnosticLevel
.
hint
),
isEmpty
);
expect
(
result
.
diagnostics
.
where
((
DiagnosticsNode
node
)
=>
node
.
level
==
DiagnosticLevel
.
hint
),
isEmpty
);
...
@@ -206,7 +206,7 @@ void main() {
...
@@ -206,7 +206,7 @@ void main() {
' entirely different part of the render tree, then there is no way
\n
'
' entirely different part of the render tree, then there is no way
\n
'
' to be notified when the size changes and therefore attempts to
\n
'
' to be notified when the size changes and therefore attempts to
\n
'
' read that size are almost certainly a source of bugs. A different
\n
'
' read that size are almost certainly a source of bugs. A different
\n
'
' approach should be used.
\n
'
' approach should be used.
\n
'
,
),
),
);
);
expect
(
result
.
diagnostics
.
where
((
DiagnosticsNode
node
)
=>
node
.
level
==
DiagnosticLevel
.
hint
).
length
,
2
);
expect
(
result
.
diagnostics
.
where
((
DiagnosticsNode
node
)
=>
node
.
level
==
DiagnosticLevel
.
hint
).
length
,
2
);
...
@@ -260,15 +260,16 @@ void main() {
...
@@ -260,15 +260,16 @@ void main() {
expect
(
coloredBox
,
hasAGoodToStringDeep
);
expect
(
coloredBox
,
hasAGoodToStringDeep
);
expect
(
expect
(
coloredBox
.
toStringDeep
(
minLevel:
DiagnosticLevel
.
info
),
coloredBox
.
toStringDeep
(
minLevel:
DiagnosticLevel
.
info
),
equalsIgnoringHashCodes
(
equalsIgnoringHashCodes
(
'RenderDecoratedBox#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED
\n
'
'RenderDecoratedBox#00000 NEEDS-LAYOUT NEEDS-PAINT DETACHED
\n
'
' parentData: MISSING
\n
'
' parentData: MISSING
\n
'
' constraints: MISSING
\n
'
' constraints: MISSING
\n
'
' size: MISSING
\n
'
' size: MISSING
\n
'
' decoration: BoxDecoration:
\n
'
' decoration: BoxDecoration:
\n
'
' <no decorations specified>
\n
'
' <no decorations specified>
\n
'
' configuration: ImageConfiguration()
\n
'
),
' configuration: ImageConfiguration()
\n
'
,
),
);
);
final
RenderBox
paddingBox
=
RenderPadding
(
final
RenderBox
paddingBox
=
RenderPadding
(
...
@@ -471,7 +472,7 @@ void main() {
...
@@ -471,7 +472,7 @@ void main() {
' null.
\n
'
' null.
\n
'
' If you perform computations on another height before passing it
\n
'
' If you perform computations on another height before passing it
\n
'
' to getMinIntrinsicWidth, consider using math.max() or
\n
'
' to getMinIntrinsicWidth, consider using math.max() or
\n
'
' double.clamp() to force the value into the valid range.
\n
'
' double.clamp() to force the value into the valid range.
\n
'
,
),
),
);
);
expect
(
expect
(
...
@@ -499,7 +500,7 @@ void main() {
...
@@ -499,7 +500,7 @@ void main() {
' null.
\n
'
' null.
\n
'
' If you perform computations on another width before passing it to
\n
'
' If you perform computations on another width before passing it to
\n
'
' getMinIntrinsicHeight, consider using math.max() or
\n
'
' getMinIntrinsicHeight, consider using math.max() or
\n
'
' double.clamp() to force the value into the valid range.
\n
'
' double.clamp() to force the value into the valid range.
\n
'
,
),
),
);
);
expect
(
expect
(
...
@@ -527,7 +528,7 @@ void main() {
...
@@ -527,7 +528,7 @@ void main() {
' null.
\n
'
' null.
\n
'
' If you perform computations on another height before passing it
\n
'
' If you perform computations on another height before passing it
\n
'
' to getMaxIntrinsicWidth, consider using math.max() or
\n
'
' to getMaxIntrinsicWidth, consider using math.max() or
\n
'
' double.clamp() to force the value into the valid range.
\n
'
' double.clamp() to force the value into the valid range.
\n
'
,
),
),
);
);
expect
(
expect
(
...
@@ -555,7 +556,7 @@ void main() {
...
@@ -555,7 +556,7 @@ void main() {
' null.
\n
'
' null.
\n
'
' If you perform computations on another width before passing it to
\n
'
' If you perform computations on another width before passing it to
\n
'
' getMaxIntrinsicHeight, consider using math.max() or
\n
'
' getMaxIntrinsicHeight, consider using math.max() or
\n
'
' double.clamp() to force the value into the valid range.
\n
'
' double.clamp() to force the value into the valid range.
\n
'
,
),
),
);
);
expect
(
expect
(
...
@@ -583,7 +584,8 @@ void main() {
...
@@ -583,7 +584,8 @@ void main() {
' constraints: MISSING
\n
'
' constraints: MISSING
\n
'
' size: MISSING
\n
'
' size: MISSING
\n
'
' alignment: Alignment.center
\n
'
' alignment: Alignment.center
\n
'
' textDirection: ltr
\n
'
),
' textDirection: ltr
\n
'
,
),
);
);
});
});
...
@@ -1021,7 +1023,7 @@ void main() {
...
@@ -1021,7 +1023,7 @@ void main() {
' If you are trying to perform a hit test during the layout phase
\n
'
' If you are trying to perform a hit test during the layout phase
\n
'
' itself, make sure you only hit test nodes that have completed
\n
'
' itself, make sure you only hit test nodes that have completed
\n
'
" layout (e.g. the node's children, after their layout() method has
\n
"
" layout (e.g. the node's children, after their layout() method has
\n
"
' been called).
\n
'
' been called).
\n
'
,
),
),
);
);
expect
(
expect
(
...
@@ -1058,7 +1060,7 @@ void main() {
...
@@ -1058,7 +1060,7 @@ void main() {
' not set.
\n
'
' not set.
\n
'
' A RenderBox object must have an explicit size before it can be
\n
'
' A RenderBox object must have an explicit size before it can be
\n
'
' hit-tested. Make sure that the RenderBox in question sets its
\n
'
' hit-tested. Make sure that the RenderBox in question sets its
\n
'
' size during layout.
\n
'
' size during layout.
\n
'
,
),
),
);
);
expect
(
expect
(
...
@@ -1105,7 +1107,7 @@ void main() {
...
@@ -1105,7 +1107,7 @@ void main() {
'The following assertion was thrown during performLayout():
\n
'
'The following assertion was thrown during performLayout():
\n
'
'RenderBox did not set its size during layout.
\n
'
'RenderBox did not set its size during layout.
\n
'
'Because this RenderBox has sizedByParent set to false, it must
\n
'
'Because this RenderBox has sizedByParent set to false, it must
\n
'
'set its size in performLayout().'
'set its size in performLayout().'
,
),
),
);
);
});
});
...
...
packages/flutter/test/rendering/constraints_test.dart
View file @
59fc9216
...
@@ -17,7 +17,7 @@ void main() {
...
@@ -17,7 +17,7 @@ void main() {
widthFactor:
2.0
,
widthFactor:
2.0
,
heightFactor:
0.5
,
heightFactor:
0.5
,
child:
leaf
=
RenderConstrainedBox
(
child:
leaf
=
RenderConstrainedBox
(
additionalConstraints:
const
BoxConstraints
.
expand
()
additionalConstraints:
const
BoxConstraints
.
expand
()
,
),
),
),
),
),
),
...
@@ -44,7 +44,7 @@ void main() {
...
@@ -44,7 +44,7 @@ void main() {
expect
(
result
,
equals
(
expect
(
result
,
equals
(
'BoxConstraints has NaN values in minWidth, maxWidth, and maxHeight.
\n
'
'BoxConstraints has NaN values in minWidth, maxWidth, and maxHeight.
\n
'
'The offending constraints were:
\n
'
'The offending constraints were:
\n
'
' BoxConstraints(NaN<=w<=NaN, 2.0<=h<=NaN; NOT NORMALIZED)'
' BoxConstraints(NaN<=w<=NaN, 2.0<=h<=NaN; NOT NORMALIZED)'
,
));
));
result
=
'no exception'
;
result
=
'no exception'
;
...
@@ -57,7 +57,7 @@ void main() {
...
@@ -57,7 +57,7 @@ void main() {
expect
(
result
,
equals
(
expect
(
result
,
equals
(
'BoxConstraints has a NaN value in minHeight.
\n
'
'BoxConstraints has a NaN value in minHeight.
\n
'
'The offending constraints were:
\n
'
'The offending constraints were:
\n
'
' BoxConstraints(0.0<=w<=Infinity, NaN<=h<=Infinity; NOT NORMALIZED)'
' BoxConstraints(0.0<=w<=Infinity, NaN<=h<=Infinity; NOT NORMALIZED)'
,
));
));
result
=
'no exception'
;
result
=
'no exception'
;
...
@@ -70,7 +70,7 @@ void main() {
...
@@ -70,7 +70,7 @@ void main() {
expect
(
result
,
equals
(
expect
(
result
,
equals
(
'BoxConstraints has NaN values in maxWidth and minHeight.
\n
'
'BoxConstraints has NaN values in maxWidth and minHeight.
\n
'
'The offending constraints were:
\n
'
'The offending constraints were:
\n
'
' BoxConstraints(0.0<=w<=NaN, NaN<=h<=Infinity; NOT NORMALIZED)'
' BoxConstraints(0.0<=w<=NaN, NaN<=h<=Infinity; NOT NORMALIZED)'
,
));
));
});
});
}
}
packages/flutter/test/rendering/debug_test.dart
View file @
59fc9216
...
@@ -95,8 +95,16 @@ void main() {
...
@@ -95,8 +95,16 @@ void main() {
layout
(
root
);
layout
(
root
);
expect
(
b
.
debugPaint
,
paints
..
rect
(
color:
const
Color
(
0xFF00FFFF
))..
rect
(
color:
const
Color
(
0x90909090
)));
expect
(
b
.
debugPaint
,
paints
..
rect
(
color:
const
Color
(
0xFF00FFFF
))..
rect
(
color:
const
Color
(
0x90909090
)));
expect
(
b
.
debugPaint
,
isNot
(
paints
..
path
()));
expect
(
b
.
debugPaint
,
isNot
(
paints
..
path
()));
expect
(
s
.
debugPaint
,
paints
..
circle
(
hasMaskFilter:
true
)..
line
(
hasMaskFilter:
true
)..
path
(
hasMaskFilter:
true
)..
path
(
hasMaskFilter:
true
)
expect
(
..
path
(
color:
const
Color
(
0x900090FF
))..
path
(
color:
const
Color
(
0xFF0090FF
)));
s
.
debugPaint
,
paints
..
circle
(
hasMaskFilter:
true
)
..
line
(
hasMaskFilter:
true
)
..
path
(
hasMaskFilter:
true
)
..
path
(
hasMaskFilter:
true
)
..
path
(
color:
const
Color
(
0x900090FF
))
..
path
(
color:
const
Color
(
0xFF0090FF
)),
);
expect
(
s
.
debugPaint
,
isNot
(
paints
..
rect
()));
expect
(
s
.
debugPaint
,
isNot
(
paints
..
rect
()));
debugPaintSizeEnabled
=
false
;
debugPaintSizeEnabled
=
false
;
});
});
...
@@ -118,8 +126,18 @@ void main() {
...
@@ -118,8 +126,18 @@ void main() {
);
);
layout
(
b
);
layout
(
b
);
expect
(
s
.
debugPaint
,
paints
..
rect
(
color:
const
Color
(
0x90909090
)));
expect
(
s
.
debugPaint
,
paints
..
rect
(
color:
const
Color
(
0x90909090
)));
expect
(
s
.
debugPaint
,
isNot
(
paints
..
circle
(
hasMaskFilter:
true
)..
line
(
hasMaskFilter:
true
)..
path
(
hasMaskFilter:
true
)..
path
(
hasMaskFilter:
true
)
expect
(
..
path
(
color:
const
Color
(
0x900090FF
))..
path
(
color:
const
Color
(
0xFF0090FF
))));
s
.
debugPaint
,
isNot
(
paints
..
circle
(
hasMaskFilter:
true
)
..
line
(
hasMaskFilter:
true
)
..
path
(
hasMaskFilter:
true
)
..
path
(
hasMaskFilter:
true
)
..
path
(
color:
const
Color
(
0x900090FF
))
..
path
(
color:
const
Color
(
0xFF0090FF
)),
),
);
expect
(
b
.
debugPaint
,
paints
..
rect
(
color:
const
Color
(
0xFF00FFFF
))..
path
(
color:
const
Color
(
0x900090FF
))..
path
(
color:
const
Color
(
0xFF0090FF
)));
expect
(
b
.
debugPaint
,
paints
..
rect
(
color:
const
Color
(
0xFF00FFFF
))..
path
(
color:
const
Color
(
0x900090FF
))..
path
(
color:
const
Color
(
0xFF0090FF
)));
expect
(
b
.
debugPaint
,
isNot
(
paints
..
rect
(
color:
const
Color
(
0x90909090
))));
expect
(
b
.
debugPaint
,
isNot
(
paints
..
rect
(
color:
const
Color
(
0x90909090
))));
debugPaintSizeEnabled
=
false
;
debugPaintSizeEnabled
=
false
;
...
@@ -147,8 +165,7 @@ void main() {
...
@@ -147,8 +165,7 @@ void main() {
dynamic
error
;
dynamic
error
;
try
{
try
{
s
.
debugPaint
(
s
.
debugPaint
(
PaintingContext
(
PaintingContext
(
ContainerLayer
(),
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
600.0
)),
ContainerLayer
(),
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
600.0
)),
const
Offset
(
0.0
,
500
),
const
Offset
(
0.0
,
500
),
);
);
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -180,8 +197,7 @@ void main() {
...
@@ -180,8 +197,7 @@ void main() {
dynamic
error
;
dynamic
error
;
try
{
try
{
s
.
debugPaint
(
s
.
debugPaint
(
PaintingContext
(
PaintingContext
(
ContainerLayer
(),
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
600.0
)),
ContainerLayer
(),
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
600.0
)),
const
Offset
(
0.0
,
500
),
const
Offset
(
0.0
,
500
),
);
);
}
catch
(
e
)
{
}
catch
(
e
)
{
...
...
packages/flutter/test/rendering/dynamic_intrinsics_test.dart
View file @
59fc9216
...
@@ -82,8 +82,8 @@ void main() {
...
@@ -82,8 +82,8 @@ void main() {
layout
(
layout
(
root
=
RenderIntrinsicSize
(
root
=
RenderIntrinsicSize
(
child:
RenderParentSize
(
child:
RenderParentSize
(
child:
inner
=
RenderFixedSize
()
child:
inner
=
RenderFixedSize
()
,
)
)
,
),
),
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
0.0
,
minWidth:
0.0
,
...
@@ -106,8 +106,8 @@ void main() {
...
@@ -106,8 +106,8 @@ void main() {
layout
(
layout
(
RenderIntrinsicSize
(
RenderIntrinsicSize
(
child:
parent
=
RenderParentSize
(
child:
parent
=
RenderParentSize
(
child:
inner
=
RenderFixedSize
()
child:
inner
=
RenderFixedSize
()
,
)
)
,
),
),
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
0.0
,
minWidth:
0.0
,
...
@@ -127,15 +127,18 @@ void main() {
...
@@ -127,15 +127,18 @@ void main() {
test
(
'Intrinsic checks are turned on'
,
()
async
{
test
(
'Intrinsic checks are turned on'
,
()
async
{
final
List
<
FlutterErrorDetails
>
errorDetails
=
<
FlutterErrorDetails
>[];
final
List
<
FlutterErrorDetails
>
errorDetails
=
<
FlutterErrorDetails
>[];
layout
(
RenderInvalidIntrinsics
(),
layout
(
constraints:
const
BoxConstraints
(
RenderInvalidIntrinsics
(),
minWidth:
0.0
,
constraints:
const
BoxConstraints
(
minHeight:
0.0
,
minWidth:
0.0
,
maxWidth:
1000.0
,
minHeight:
0.0
,
maxHeight:
1000.0
,
maxWidth:
1000.0
,
),
onErrors:
()
{
maxHeight:
1000.0
,
),
onErrors:
()
{
errorDetails
.
addAll
(
renderer
.
takeAllFlutterErrorDetails
());
errorDetails
.
addAll
(
renderer
.
takeAllFlutterErrorDetails
());
});
},
);
expect
(
errorDetails
,
isNotEmpty
);
expect
(
errorDetails
,
isNotEmpty
);
expect
(
expect
(
...
...
packages/flutter/test/rendering/editable_test.dart
View file @
59fc9216
...
@@ -111,7 +111,7 @@ void main() {
...
@@ -111,7 +111,7 @@ void main() {
' ║ size: 10.0
\n
'
' ║ size: 10.0
\n
'
' ║ height: 1.0x
\n
'
' ║ height: 1.0x
\n
'
' ║ "12345"
\n
'
' ║ "12345"
\n
'
' ╚═══════════
\n
'
' ╚═══════════
\n
'
,
),
),
);
);
});
});
...
@@ -3015,7 +3015,8 @@ void main() {
...
@@ -3015,7 +3015,8 @@ void main() {
);
);
editable
.
layout
(
BoxConstraints
.
loose
(
const
Size
(
100
,
100
)));
editable
.
layout
(
BoxConstraints
.
loose
(
const
Size
(
100
,
100
)));
final
List
<
TextSelectionPoint
>
endpoints
=
editable
.
getEndpointsForSelection
(
final
List
<
TextSelectionPoint
>
endpoints
=
editable
.
getEndpointsForSelection
(
const
TextSelection
(
baseOffset:
0
,
extentOffset:
1
));
const
TextSelection
(
baseOffset:
0
,
extentOffset:
1
),
);
expect
(
endpoints
[
0
].
point
.
dx
,
0
);
expect
(
endpoints
[
0
].
point
.
dx
,
0
);
});
});
...
@@ -3095,7 +3096,8 @@ void main() {
...
@@ -3095,7 +3096,8 @@ void main() {
expect
(
expect
(
editable
.
getRectForComposingRange
(
const
TextRange
(
start:
0
,
end:
1
)),
editable
.
getRectForComposingRange
(
const
TextRange
(
start:
0
,
end:
1
)),
// On web this evaluates to a zero-width Rect.
// On web this evaluates to a zero-width Rect.
anyOf
(
isNull
,
(
Rect
rect
)
=>
rect
.
width
==
0
));
anyOf
(
isNull
,
(
Rect
rect
)
=>
rect
.
width
==
0
),
);
});
});
test
(
'more than 1 run on the same line'
,
()
{
test
(
'more than 1 run on the same line'
,
()
{
...
@@ -3105,7 +3107,7 @@ void main() {
...
@@ -3105,7 +3107,7 @@ void main() {
children:
<
TextSpan
>[
children:
<
TextSpan
>[
const
TextSpan
(
text:
'A'
,
style:
tinyText
),
const
TextSpan
(
text:
'A'
,
style:
tinyText
),
TextSpan
(
text:
'A'
*
20
,
style:
normalText
),
TextSpan
(
text:
'A'
*
20
,
style:
normalText
),
const
TextSpan
(
text:
'A'
,
style:
tinyText
)
const
TextSpan
(
text:
'A'
,
style:
tinyText
)
,
],
],
);
);
// Give it a width that forces the editable to wrap.
// Give it a width that forces the editable to wrap.
...
@@ -3370,7 +3372,7 @@ void main() {
...
@@ -3370,7 +3372,7 @@ void main() {
(
Canvas
canvas
)
=>
editable
.
paint
(
TestRecordingPaintingContext
(
canvas
),
Offset
.
zero
),
(
Canvas
canvas
)
=>
editable
.
paint
(
TestRecordingPaintingContext
(
canvas
),
Offset
.
zero
),
paints
paints
..
rect
(
rect:
const
Rect
.
fromLTRB
(
1
,
1
,
1
,
1
),
color:
const
Color
(
0x12345678
))
..
rect
(
rect:
const
Rect
.
fromLTRB
(
1
,
1
,
1
,
1
),
color:
const
Color
(
0x12345678
))
..
paragraph
()
..
paragraph
()
,
);
);
});
});
});
});
...
...
packages/flutter/test/rendering/error_test.dart
View file @
59fc9216
...
@@ -14,45 +14,63 @@ void main() {
...
@@ -14,45 +14,63 @@ void main() {
testWidgets
(
'test draw error paragraph'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'test draw error paragraph'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
ErrorWidget
(
Exception
(
errorMessage
)));
await
tester
.
pumpWidget
(
ErrorWidget
(
Exception
(
errorMessage
)));
expect
(
find
.
byType
(
ErrorWidget
),
paints
expect
(
find
.
byType
(
ErrorWidget
),
paints
..
rect
(
rect:
const
Rect
.
fromLTWH
(
0.0
,
0.0
,
800.0
,
600.0
))
..
rect
(
rect:
const
Rect
.
fromLTWH
(
0.0
,
0.0
,
800.0
,
600.0
))
..
paragraph
(
offset:
const
Offset
(
64.0
,
96.0
)));
..
paragraph
(
offset:
const
Offset
(
64.0
,
96.0
)),
);
final
Widget
_error
=
Builder
(
builder:
(
BuildContext
context
)
=>
throw
'pillow'
);
final
Widget
_error
=
Builder
(
builder:
(
BuildContext
context
)
=>
throw
'pillow'
);
await
tester
.
pumpWidget
(
Center
(
child:
SizedBox
(
width:
100.0
,
child:
_error
)));
await
tester
.
pumpWidget
(
Center
(
child:
SizedBox
(
width:
100.0
,
child:
_error
)));
expect
(
tester
.
takeException
(),
'pillow'
);
expect
(
tester
.
takeException
(),
'pillow'
);
expect
(
find
.
byType
(
ErrorWidget
),
paints
expect
(
find
.
byType
(
ErrorWidget
),
paints
..
rect
(
rect:
const
Rect
.
fromLTWH
(
0.0
,
0.0
,
100.0
,
600.0
))
..
rect
(
rect:
const
Rect
.
fromLTWH
(
0.0
,
0.0
,
100.0
,
600.0
))
..
paragraph
(
offset:
const
Offset
(
0.0
,
96.0
)));
..
paragraph
(
offset:
const
Offset
(
0.0
,
96.0
)),
);
await
tester
.
pumpWidget
(
Center
(
child:
SizedBox
(
height:
100.0
,
child:
_error
)));
await
tester
.
pumpWidget
(
Center
(
child:
SizedBox
(
height:
100.0
,
child:
_error
)));
expect
(
tester
.
takeException
(),
null
);
expect
(
tester
.
takeException
(),
null
);
await
tester
.
pumpWidget
(
Center
(
child:
SizedBox
(
key:
UniqueKey
(),
height:
100.0
,
child:
_error
)));
await
tester
.
pumpWidget
(
Center
(
child:
SizedBox
(
key:
UniqueKey
(),
height:
100.0
,
child:
_error
)));
expect
(
tester
.
takeException
(),
'pillow'
);
expect
(
tester
.
takeException
(),
'pillow'
);
expect
(
find
.
byType
(
ErrorWidget
),
paints
expect
(
find
.
byType
(
ErrorWidget
),
paints
..
rect
(
rect:
const
Rect
.
fromLTWH
(
0.0
,
0.0
,
800.0
,
100.0
))
..
rect
(
rect:
const
Rect
.
fromLTWH
(
0.0
,
0.0
,
800.0
,
100.0
))
..
paragraph
(
offset:
const
Offset
(
64.0
,
0.0
)));
..
paragraph
(
offset:
const
Offset
(
64.0
,
0.0
)),
);
RenderErrorBox
.
minimumWidth
=
800.0
;
RenderErrorBox
.
minimumWidth
=
800.0
;
await
tester
.
pumpWidget
(
Center
(
child:
_error
));
await
tester
.
pumpWidget
(
Center
(
child:
_error
));
expect
(
tester
.
takeException
(),
'pillow'
);
expect
(
tester
.
takeException
(),
'pillow'
);
expect
(
find
.
byType
(
ErrorWidget
),
paints
expect
(
find
.
byType
(
ErrorWidget
),
paints
..
rect
(
rect:
const
Rect
.
fromLTWH
(
0.0
,
0.0
,
800.0
,
600.0
))
..
rect
(
rect:
const
Rect
.
fromLTWH
(
0.0
,
0.0
,
800.0
,
600.0
))
..
paragraph
(
offset:
const
Offset
(
0.0
,
96.0
)));
..
paragraph
(
offset:
const
Offset
(
0.0
,
96.0
)),
);
await
tester
.
pumpWidget
(
Center
(
child:
_error
));
await
tester
.
pumpWidget
(
Center
(
child:
_error
));
expect
(
tester
.
takeException
(),
null
);
expect
(
tester
.
takeException
(),
null
);
expect
(
find
.
byType
(
ErrorWidget
),
paints
expect
(
find
.
byType
(
ErrorWidget
),
paints
..
rect
(
color:
const
Color
(
0xF0900000
))
..
rect
(
color:
const
Color
(
0xF0900000
))
..
paragraph
());
..
paragraph
(),
);
RenderErrorBox
.
backgroundColor
=
const
Color
(
0xFF112233
);
RenderErrorBox
.
backgroundColor
=
const
Color
(
0xFF112233
);
await
tester
.
pumpWidget
(
Center
(
child:
_error
));
await
tester
.
pumpWidget
(
Center
(
child:
_error
));
expect
(
tester
.
takeException
(),
null
);
expect
(
tester
.
takeException
(),
null
);
expect
(
find
.
byType
(
ErrorWidget
),
paints
expect
(
find
.
byType
(
ErrorWidget
),
paints
..
rect
(
color:
const
Color
(
0xFF112233
))
..
rect
(
color:
const
Color
(
0xFF112233
))
..
paragraph
());
..
paragraph
(),
);
});
});
}
}
packages/flutter/test/rendering/flex_test.dart
View file @
59fc9216
...
@@ -13,8 +13,11 @@ void main() {
...
@@ -13,8 +13,11 @@ void main() {
final
RenderDecoratedBox
box
=
RenderDecoratedBox
(
decoration:
const
BoxDecoration
());
final
RenderDecoratedBox
box
=
RenderDecoratedBox
(
decoration:
const
BoxDecoration
());
final
RenderFlex
flex
=
RenderFlex
(
textDirection:
TextDirection
.
ltr
,
children:
<
RenderBox
>[
box
]);
final
RenderFlex
flex
=
RenderFlex
(
textDirection:
TextDirection
.
ltr
,
children:
<
RenderBox
>[
box
]);
layout
(
flex
,
constraints:
const
BoxConstraints
(
layout
(
flex
,
constraints:
const
BoxConstraints
(
minWidth:
200.0
,
maxWidth:
200.0
,
minHeight:
200.0
,
maxHeight:
200.0
),
minWidth:
200.0
,
);
maxWidth:
200.0
,
minHeight:
200.0
,
maxHeight:
200.0
,
));
expect
(
flex
.
size
.
width
,
equals
(
200.0
),
reason:
'flex width'
);
expect
(
flex
.
size
.
width
,
equals
(
200.0
),
reason:
'flex width'
);
expect
(
flex
.
size
.
height
,
equals
(
200.0
),
reason:
'flex height'
);
expect
(
flex
.
size
.
height
,
equals
(
200.0
),
reason:
'flex height'
);
...
@@ -72,7 +75,7 @@ void main() {
...
@@ -72,7 +75,7 @@ void main() {
test
(
'Vertical Overflow'
,
()
{
test
(
'Vertical Overflow'
,
()
{
final
RenderConstrainedBox
flexible
=
RenderConstrainedBox
(
final
RenderConstrainedBox
flexible
=
RenderConstrainedBox
(
additionalConstraints:
const
BoxConstraints
.
expand
()
additionalConstraints:
const
BoxConstraints
.
expand
()
,
);
);
final
RenderFlex
flex
=
RenderFlex
(
final
RenderFlex
flex
=
RenderFlex
(
direction:
Axis
.
vertical
,
direction:
Axis
.
vertical
,
...
@@ -95,7 +98,7 @@ void main() {
...
@@ -95,7 +98,7 @@ void main() {
test
(
'Horizontal Overflow'
,
()
{
test
(
'Horizontal Overflow'
,
()
{
final
RenderConstrainedBox
flexible
=
RenderConstrainedBox
(
final
RenderConstrainedBox
flexible
=
RenderConstrainedBox
(
additionalConstraints:
const
BoxConstraints
.
expand
()
additionalConstraints:
const
BoxConstraints
.
expand
()
,
);
);
final
RenderFlex
flex
=
RenderFlex
(
final
RenderFlex
flex
=
RenderFlex
(
direction:
Axis
.
horizontal
,
direction:
Axis
.
horizontal
,
...
@@ -148,7 +151,7 @@ void main() {
...
@@ -148,7 +151,7 @@ void main() {
' mainAxisAlignment: start
\n
'
' mainAxisAlignment: start
\n
'
' mainAxisSize: max
\n
'
' mainAxisSize: max
\n
'
' crossAxisAlignment: center
\n
'
' crossAxisAlignment: center
\n
'
' verticalDirection: down
\n
'
' verticalDirection: down
\n
'
,
),
),
);
);
});
});
...
@@ -158,8 +161,11 @@ void main() {
...
@@ -158,8 +161,11 @@ void main() {
final
RenderDecoratedBox
box2
=
RenderDecoratedBox
(
decoration:
const
BoxDecoration
());
final
RenderDecoratedBox
box2
=
RenderDecoratedBox
(
decoration:
const
BoxDecoration
());
final
RenderFlex
flex
=
RenderFlex
(
textDirection:
TextDirection
.
ltr
,
children:
<
RenderBox
>[
box1
,
box2
]);
final
RenderFlex
flex
=
RenderFlex
(
textDirection:
TextDirection
.
ltr
,
children:
<
RenderBox
>[
box1
,
box2
]);
layout
(
flex
,
constraints:
const
BoxConstraints
(
layout
(
flex
,
constraints:
const
BoxConstraints
(
minWidth:
0.0
,
maxWidth:
100.0
,
minHeight:
0.0
,
maxHeight:
100.0
),
minWidth:
0.0
,
);
maxWidth:
100.0
,
minHeight:
0.0
,
maxHeight:
100.0
,
));
expect
(
box1
.
size
.
width
,
equals
(
0.0
));
expect
(
box1
.
size
.
width
,
equals
(
0.0
));
expect
(
box1
.
size
.
height
,
equals
(
0.0
));
expect
(
box1
.
size
.
height
,
equals
(
0.0
));
expect
(
box2
.
size
.
width
,
equals
(
0.0
));
expect
(
box2
.
size
.
width
,
equals
(
0.0
));
...
@@ -184,8 +190,11 @@ void main() {
...
@@ -184,8 +190,11 @@ void main() {
box2ParentData
.
flex
=
2
;
box2ParentData
.
flex
=
2
;
flex
.
addAll
(<
RenderBox
>[
box1
,
box2
]);
flex
.
addAll
(<
RenderBox
>[
box1
,
box2
]);
layout
(
flex
,
constraints:
const
BoxConstraints
(
layout
(
flex
,
constraints:
const
BoxConstraints
(
minWidth:
0.0
,
maxWidth:
100.0
,
minHeight:
0.0
,
maxHeight:
100.0
),
minWidth:
0.0
,
);
maxWidth:
100.0
,
minHeight:
0.0
,
maxHeight:
100.0
,
));
expect
(
box1
.
size
.
width
,
equals
(
0.0
));
expect
(
box1
.
size
.
width
,
equals
(
0.0
));
expect
(
box1
.
size
.
height
,
equals
(
0.0
));
expect
(
box1
.
size
.
height
,
equals
(
0.0
));
expect
(
box2
.
size
.
width
,
equals
(
100.0
));
expect
(
box2
.
size
.
width
,
equals
(
100.0
));
...
@@ -213,8 +222,11 @@ void main() {
...
@@ -213,8 +222,11 @@ void main() {
final
RenderFlex
flex
=
RenderFlex
(
textDirection:
TextDirection
.
ltr
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
);
final
RenderFlex
flex
=
RenderFlex
(
textDirection:
TextDirection
.
ltr
,
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
);
flex
.
addAll
(<
RenderBox
>[
box1
,
box2
,
box3
]);
flex
.
addAll
(<
RenderBox
>[
box1
,
box2
,
box3
]);
layout
(
flex
,
constraints:
const
BoxConstraints
(
layout
(
flex
,
constraints:
const
BoxConstraints
(
minWidth:
0.0
,
maxWidth:
500.0
,
minHeight:
0.0
,
maxHeight:
400.0
),
minWidth:
0.0
,
);
maxWidth:
500.0
,
minHeight:
0.0
,
maxHeight:
400.0
,
));
Offset
getOffset
(
RenderBox
box
)
{
Offset
getOffset
(
RenderBox
box
)
{
final
FlexParentData
parentData
=
box
.
parentData
!
as
FlexParentData
;
final
FlexParentData
parentData
=
box
.
parentData
!
as
FlexParentData
;
return
parentData
.
offset
;
return
parentData
.
offset
;
...
@@ -243,8 +255,11 @@ void main() {
...
@@ -243,8 +255,11 @@ void main() {
final
RenderFlex
flex
=
RenderFlex
(
textDirection:
TextDirection
.
ltr
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
);
final
RenderFlex
flex
=
RenderFlex
(
textDirection:
TextDirection
.
ltr
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
);
flex
.
addAll
(<
RenderBox
>[
box1
,
box2
,
box3
]);
flex
.
addAll
(<
RenderBox
>[
box1
,
box2
,
box3
]);
layout
(
flex
,
constraints:
const
BoxConstraints
(
layout
(
flex
,
constraints:
const
BoxConstraints
(
minWidth:
0.0
,
maxWidth:
500.0
,
minHeight:
0.0
,
maxHeight:
400.0
),
minWidth:
0.0
,
);
maxWidth:
500.0
,
minHeight:
0.0
,
maxHeight:
400.0
,
));
Offset
getOffset
(
RenderBox
box
)
{
Offset
getOffset
(
RenderBox
box
)
{
final
FlexParentData
parentData
=
box
.
parentData
!
as
FlexParentData
;
final
FlexParentData
parentData
=
box
.
parentData
!
as
FlexParentData
;
return
parentData
.
offset
;
return
parentData
.
offset
;
...
@@ -295,8 +310,11 @@ void main() {
...
@@ -295,8 +310,11 @@ void main() {
);
);
flex
.
addAll
(<
RenderBox
>[
box1
,
box2
,
box3
]);
flex
.
addAll
(<
RenderBox
>[
box1
,
box2
,
box3
]);
layout
(
flex
,
constraints:
const
BoxConstraints
(
layout
(
flex
,
constraints:
const
BoxConstraints
(
minWidth:
0.0
,
maxWidth:
500.0
,
minHeight:
0.0
,
maxHeight:
400.0
),
minWidth:
0.0
,
);
maxWidth:
500.0
,
minHeight:
0.0
,
maxHeight:
400.0
,
));
Offset
getOffset
(
RenderBox
box
)
{
Offset
getOffset
(
RenderBox
box
)
{
final
FlexParentData
parentData
=
box
.
parentData
!
as
FlexParentData
;
final
FlexParentData
parentData
=
box
.
parentData
!
as
FlexParentData
;
return
parentData
.
offset
;
return
parentData
.
offset
;
...
...
packages/flutter/test/rendering/image_test.dart
View file @
59fc9216
...
@@ -18,12 +18,12 @@ Future<void> main() async {
...
@@ -18,12 +18,12 @@ Future<void> main() async {
RenderImage
image
;
RenderImage
image
;
image
=
RenderImage
(
image:
squareImage
);
image
=
RenderImage
(
image:
squareImage
);
layout
(
image
,
layout
(
image
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
25.0
,
minWidth
:
25.0
,
minHeight
:
25.0
,
minHeight:
25
.0
,
maxWidth:
100
.0
,
maxWidth
:
100.0
,
maxHeight
:
100.0
,
maxHeight:
100.0
));
));
expect
(
image
.
size
.
width
,
equals
(
25.0
));
expect
(
image
.
size
.
width
,
equals
(
25.0
));
expect
(
image
.
size
.
height
,
equals
(
25.0
));
expect
(
image
.
size
.
height
,
equals
(
25.0
));
...
@@ -39,87 +39,87 @@ Future<void> main() async {
...
@@ -39,87 +39,87 @@ Future<void> main() async {
' image:
$squareImage
\n
'
' image:
$squareImage
\n
'
' alignment: Alignment.center
\n
'
' alignment: Alignment.center
\n
'
' invertColors: false
\n
'
' invertColors: false
\n
'
' filterQuality: low
\n
'
' filterQuality: low
\n
'
,
),
),
);
);
image
=
RenderImage
(
image:
wideImage
);
image
=
RenderImage
(
image:
wideImage
);
layout
(
image
,
layout
(
image
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
5.0
,
minWidth:
5
.0
,
minHeight:
30
.0
,
minHeight:
3
0.0
,
maxWidth:
10
0.0
,
maxWidth
:
100.0
,
maxHeight
:
100.0
,
maxHeight:
100.0
));
));
expect
(
image
.
size
.
width
,
equals
(
60.0
));
expect
(
image
.
size
.
width
,
equals
(
60.0
));
expect
(
image
.
size
.
height
,
equals
(
30.0
));
expect
(
image
.
size
.
height
,
equals
(
30.0
));
image
=
RenderImage
(
image:
tallImage
);
image
=
RenderImage
(
image:
tallImage
);
layout
(
image
,
layout
(
image
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
50.0
,
minWidth:
50
.0
,
minHeight:
5
.0
,
minHeight:
5.0
,
maxWidth:
7
5.0
,
maxWidth
:
75.0
,
maxHeight
:
75.0
,
maxHeight:
75.0
));
));
expect
(
image
.
size
.
width
,
equals
(
50.0
));
expect
(
image
.
size
.
width
,
equals
(
50.0
));
expect
(
image
.
size
.
height
,
equals
(
75.0
));
expect
(
image
.
size
.
height
,
equals
(
75.0
));
image
=
RenderImage
(
image:
wideImage
);
image
=
RenderImage
(
image:
wideImage
);
layout
(
image
,
layout
(
image
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
5.0
,
minWidth
:
5.0
,
minHeight
:
5.0
,
minHeight:
5
.0
,
maxWidth:
100
.0
,
maxWidth
:
100.0
,
maxHeight
:
100.0
,
maxHeight:
100.0
));
));
expect
(
image
.
size
.
width
,
equals
(
20.0
));
expect
(
image
.
size
.
width
,
equals
(
20.0
));
expect
(
image
.
size
.
height
,
equals
(
10.0
));
expect
(
image
.
size
.
height
,
equals
(
10.0
));
image
=
RenderImage
(
image:
wideImage
);
image
=
RenderImage
(
image:
wideImage
);
layout
(
image
,
layout
(
image
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
5.0
,
minWidth
:
5.0
,
minHeight
:
5.0
,
minHeight:
5
.0
,
maxWidth:
16
.0
,
maxWidth
:
16.0
,
maxHeight
:
16.0
,
maxHeight:
16.0
));
));
expect
(
image
.
size
.
width
,
equals
(
16.0
));
expect
(
image
.
size
.
width
,
equals
(
16.0
));
expect
(
image
.
size
.
height
,
equals
(
8.0
));
expect
(
image
.
size
.
height
,
equals
(
8.0
));
image
=
RenderImage
(
image:
tallImage
);
image
=
RenderImage
(
image:
tallImage
);
layout
(
image
,
layout
(
image
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
5.0
,
minWidth
:
5.0
,
minHeight
:
5.0
,
minHeight:
5
.0
,
maxWidth:
16
.0
,
maxWidth
:
16.0
,
maxHeight
:
16.0
,
maxHeight:
16.0
));
));
expect
(
image
.
size
.
width
,
equals
(
8.0
));
expect
(
image
.
size
.
width
,
equals
(
8.0
));
expect
(
image
.
size
.
height
,
equals
(
16.0
));
expect
(
image
.
size
.
height
,
equals
(
16.0
));
image
=
RenderImage
(
image:
squareImage
);
image
=
RenderImage
(
image:
squareImage
);
layout
(
image
,
layout
(
image
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
4.0
,
minWidth
:
4.0
,
minHeight
:
4.0
,
minHeight:
4
.0
,
maxWidth:
8
.0
,
maxWidth
:
8.0
,
maxHeight
:
8.0
,
maxHeight:
8.0
));
));
expect
(
image
.
size
.
width
,
equals
(
8.0
));
expect
(
image
.
size
.
width
,
equals
(
8.0
));
expect
(
image
.
size
.
height
,
equals
(
8.0
));
expect
(
image
.
size
.
height
,
equals
(
8.0
));
image
=
RenderImage
(
image:
wideImage
);
image
=
RenderImage
(
image:
wideImage
);
layout
(
image
,
layout
(
image
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
20.0
,
minWidth
:
20.0
,
minHeight
:
20.0
,
minHeight:
2
0.0
,
maxWidth:
3
0.0
,
maxWidth
:
30.0
,
maxHeight
:
30.0
,
maxHeight:
30.0
));
));
expect
(
image
.
size
.
width
,
equals
(
30.0
));
expect
(
image
.
size
.
width
,
equals
(
30.0
));
expect
(
image
.
size
.
height
,
equals
(
20.0
));
expect
(
image
.
size
.
height
,
equals
(
20.0
));
image
=
RenderImage
(
image:
tallImage
);
image
=
RenderImage
(
image:
tallImage
);
layout
(
image
,
layout
(
image
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
20.0
,
minWidth
:
20.0
,
minHeight
:
20.0
,
minHeight:
2
0.0
,
maxWidth:
3
0.0
,
maxWidth
:
30.0
,
maxHeight
:
30.0
,
maxHeight:
30.0
));
));
expect
(
image
.
size
.
width
,
equals
(
20.0
));
expect
(
image
.
size
.
width
,
equals
(
20.0
));
expect
(
image
.
size
.
height
,
equals
(
30.0
));
expect
(
image
.
size
.
height
,
equals
(
30.0
));
});
});
...
@@ -128,42 +128,42 @@ Future<void> main() async {
...
@@ -128,42 +128,42 @@ Future<void> main() async {
RenderImage
image
;
RenderImage
image
;
image
=
RenderImage
();
image
=
RenderImage
();
layout
(
image
,
layout
(
image
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
25.0
,
minWidth
:
25.0
,
minHeight
:
25.0
,
minHeight:
25
.0
,
maxWidth:
100
.0
,
maxWidth
:
100.0
,
maxHeight
:
100.0
,
maxHeight:
100.0
));
));
expect
(
image
.
size
.
width
,
equals
(
25.0
));
expect
(
image
.
size
.
width
,
equals
(
25.0
));
expect
(
image
.
size
.
height
,
equals
(
25.0
));
expect
(
image
.
size
.
height
,
equals
(
25.0
));
image
=
RenderImage
(
width:
50.0
);
image
=
RenderImage
(
width:
50.0
);
layout
(
image
,
layout
(
image
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
25.0
,
minWidth
:
25.0
,
minHeight
:
25.0
,
minHeight:
25
.0
,
maxWidth:
100
.0
,
maxWidth
:
100.0
,
maxHeight
:
100.0
,
maxHeight:
100.0
));
));
expect
(
image
.
size
.
width
,
equals
(
50.0
));
expect
(
image
.
size
.
width
,
equals
(
50.0
));
expect
(
image
.
size
.
height
,
equals
(
25.0
));
expect
(
image
.
size
.
height
,
equals
(
25.0
));
image
=
RenderImage
(
height:
50.0
);
image
=
RenderImage
(
height:
50.0
);
layout
(
image
,
layout
(
image
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
25.0
,
minWidth
:
25.0
,
minHeight
:
25.0
,
minHeight:
25
.0
,
maxWidth:
100
.0
,
maxWidth
:
100.0
,
maxHeight
:
100.0
,
maxHeight:
100.0
));
));
expect
(
image
.
size
.
width
,
equals
(
25.0
));
expect
(
image
.
size
.
width
,
equals
(
25.0
));
expect
(
image
.
size
.
height
,
equals
(
50.0
));
expect
(
image
.
size
.
height
,
equals
(
50.0
));
image
=
RenderImage
(
width:
100.0
,
height:
100.0
);
image
=
RenderImage
(
width:
100.0
,
height:
100.0
);
layout
(
image
,
layout
(
image
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
25.0
,
minWidth
:
25.0
,
minHeight
:
25.0
,
minHeight:
2
5.0
,
maxWidth:
7
5.0
,
maxWidth
:
75.0
,
maxHeight
:
75.0
,
maxHeight:
75.0
));
));
expect
(
image
.
size
.
width
,
equals
(
75.0
));
expect
(
image
.
size
.
width
,
equals
(
75.0
));
expect
(
image
.
size
.
height
,
equals
(
75.0
));
expect
(
image
.
size
.
height
,
equals
(
75.0
));
});
});
...
...
packages/flutter/test/rendering/independent_layout_test.dart
View file @
59fc9216
...
@@ -17,7 +17,7 @@ class TestLayout {
...
@@ -17,7 +17,7 @@ class TestLayout {
additionalConstraints:
const
BoxConstraints
.
tightFor
(
width:
800.0
),
additionalConstraints:
const
BoxConstraints
.
tightFor
(
width:
800.0
),
child:
RenderCustomPaint
(
child:
RenderCustomPaint
(
painter:
TestCallbackPainter
(
painter:
TestCallbackPainter
(
onPaint:
()
{
painted
=
true
;
}
onPaint:
()
{
painted
=
true
;
}
,
),
),
child:
child
=
RenderConstrainedBox
(
child:
child
=
RenderConstrainedBox
(
additionalConstraints:
const
BoxConstraints
.
tightFor
(
height:
10.0
,
width:
10.0
),
additionalConstraints:
const
BoxConstraints
.
tightFor
(
height:
10.0
,
width:
10.0
),
...
...
packages/flutter/test/rendering/intrinsic_width_test.dart
View file @
59fc9216
...
@@ -38,16 +38,24 @@ class RenderTestBox extends RenderBox {
...
@@ -38,16 +38,24 @@ class RenderTestBox extends RenderBox {
@override
@override
void
performResize
()
{
void
performResize
()
{
size
=
constraints
.
constrain
(
Size
(
_intrinsicDimensions
.
minWidth
+
(
_intrinsicDimensions
.
maxWidth
-
_intrinsicDimensions
.
minWidth
)
/
2.0
,
size
=
constraints
.
constrain
(
Size
(
_intrinsicDimensions
.
minHeight
+
(
_intrinsicDimensions
.
maxHeight
-
_intrinsicDimensions
.
minHeight
)
/
2.0
));
_intrinsicDimensions
.
minWidth
+
(
_intrinsicDimensions
.
maxWidth
-
_intrinsicDimensions
.
minWidth
)
/
2.0
,
_intrinsicDimensions
.
minHeight
+
(
_intrinsicDimensions
.
maxHeight
-
_intrinsicDimensions
.
minHeight
)
/
2.0
,
));
}
}
}
}
void
main
(
)
{
void
main
(
)
{
test
(
'Shrink-wrapping width'
,
()
{
test
(
'Shrink-wrapping width'
,
()
{
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
));
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
,
));
final
RenderBox
parent
=
RenderIntrinsicWidth
(
child:
child
);
final
RenderBox
parent
=
RenderIntrinsicWidth
(
child:
child
);
layout
(
parent
,
layout
(
parent
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
5.0
,
minWidth:
5.0
,
minHeight:
8.0
,
minHeight:
8.0
,
...
@@ -83,7 +91,8 @@ void main() {
...
@@ -83,7 +91,8 @@ void main() {
test
(
'IntrinsicWidth without a child'
,
()
{
test
(
'IntrinsicWidth without a child'
,
()
{
final
RenderBox
parent
=
RenderIntrinsicWidth
();
final
RenderBox
parent
=
RenderIntrinsicWidth
();
layout
(
parent
,
layout
(
parent
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
5.0
,
minWidth:
5.0
,
minHeight:
8.0
,
minHeight:
8.0
,
...
@@ -116,9 +125,15 @@ void main() {
...
@@ -116,9 +125,15 @@ void main() {
});
});
test
(
'Shrink-wrapping width (stepped width)'
,
()
{
test
(
'Shrink-wrapping width (stepped width)'
,
()
{
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
));
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
,
));
final
RenderBox
parent
=
RenderIntrinsicWidth
(
child:
child
,
stepWidth:
47.0
);
final
RenderBox
parent
=
RenderIntrinsicWidth
(
child:
child
,
stepWidth:
47.0
);
layout
(
parent
,
layout
(
parent
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
5.0
,
minWidth:
5.0
,
minHeight:
8.0
,
minHeight:
8.0
,
...
@@ -153,9 +168,15 @@ void main() {
...
@@ -153,9 +168,15 @@ void main() {
});
});
test
(
'Shrink-wrapping width (stepped height)'
,
()
{
test
(
'Shrink-wrapping width (stepped height)'
,
()
{
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
));
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
,
));
final
RenderBox
parent
=
RenderIntrinsicWidth
(
child:
child
,
stepHeight:
47.0
);
final
RenderBox
parent
=
RenderIntrinsicWidth
(
child:
child
,
stepHeight:
47.0
);
layout
(
parent
,
layout
(
parent
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
5.0
,
minWidth:
5.0
,
minHeight:
8.0
,
minHeight:
8.0
,
...
@@ -188,9 +209,15 @@ void main() {
...
@@ -188,9 +209,15 @@ void main() {
});
});
test
(
'Shrink-wrapping width (stepped everything)'
,
()
{
test
(
'Shrink-wrapping width (stepped everything)'
,
()
{
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
));
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
,
));
final
RenderBox
parent
=
RenderIntrinsicWidth
(
child:
child
,
stepHeight:
47.0
,
stepWidth:
37.0
);
final
RenderBox
parent
=
RenderIntrinsicWidth
(
child:
child
,
stepHeight:
47.0
,
stepWidth:
37.0
);
layout
(
parent
,
layout
(
parent
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
5.0
,
minWidth:
5.0
,
minHeight:
8.0
,
minHeight:
8.0
,
...
@@ -223,9 +250,15 @@ void main() {
...
@@ -223,9 +250,15 @@ void main() {
});
});
test
(
'RenderIntrinsicWidth when parent is given loose constraints smaller than intrinsic width of child'
,
()
{
test
(
'RenderIntrinsicWidth when parent is given loose constraints smaller than intrinsic width of child'
,
()
{
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
));
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
,
));
final
RenderBox
parent
=
RenderIntrinsicWidth
(
child:
child
);
final
RenderBox
parent
=
RenderIntrinsicWidth
(
child:
child
);
layout
(
parent
,
layout
(
parent
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
50.0
,
minWidth:
50.0
,
minHeight:
8.0
,
minHeight:
8.0
,
...
@@ -240,9 +273,11 @@ void main() {
...
@@ -240,9 +273,11 @@ void main() {
});
});
test
(
'RenderIntrinsicWidth when parent is given tight constraints larger than intrinsic width of child'
,
()
{
test
(
'RenderIntrinsicWidth when parent is given tight constraints larger than intrinsic width of child'
,
()
{
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
));
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
));
final
RenderBox
parent
=
RenderIntrinsicWidth
(
child:
child
);
final
RenderBox
parent
=
RenderIntrinsicWidth
(
child:
child
);
layout
(
parent
,
layout
(
parent
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
500.0
,
minWidth:
500.0
,
minHeight:
8.0
,
minHeight:
8.0
,
...
@@ -257,9 +292,15 @@ void main() {
...
@@ -257,9 +292,15 @@ void main() {
});
});
test
(
'RenderIntrinsicWidth when parent is given tight constraints smaller than intrinsic width of child'
,
()
{
test
(
'RenderIntrinsicWidth when parent is given tight constraints smaller than intrinsic width of child'
,
()
{
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
));
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
,
));
final
RenderBox
parent
=
RenderIntrinsicWidth
(
child:
child
);
final
RenderBox
parent
=
RenderIntrinsicWidth
(
child:
child
);
layout
(
parent
,
layout
(
parent
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
50.0
,
minWidth:
50.0
,
minHeight:
8.0
,
minHeight:
8.0
,
...
@@ -274,9 +315,15 @@ void main() {
...
@@ -274,9 +315,15 @@ void main() {
});
});
test
(
'Shrink-wrapping height'
,
()
{
test
(
'Shrink-wrapping height'
,
()
{
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
));
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
,
));
final
RenderBox
parent
=
RenderIntrinsicHeight
(
child:
child
);
final
RenderBox
parent
=
RenderIntrinsicHeight
(
child:
child
);
layout
(
parent
,
layout
(
parent
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
5.0
,
minWidth:
5.0
,
minHeight:
8.0
,
minHeight:
8.0
,
...
@@ -310,7 +357,8 @@ void main() {
...
@@ -310,7 +357,8 @@ void main() {
test
(
'IntrinsicHeight without a child'
,
()
{
test
(
'IntrinsicHeight without a child'
,
()
{
final
RenderBox
parent
=
RenderIntrinsicHeight
();
final
RenderBox
parent
=
RenderIntrinsicHeight
();
layout
(
parent
,
layout
(
parent
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
5.0
,
minWidth:
5.0
,
minHeight:
8.0
,
minHeight:
8.0
,
...
@@ -343,9 +391,15 @@ void main() {
...
@@ -343,9 +391,15 @@ void main() {
});
});
test
(
'RenderIntrinsicHeight when parent is given loose constraints smaller than intrinsic height of child'
,
()
{
test
(
'RenderIntrinsicHeight when parent is given loose constraints smaller than intrinsic height of child'
,
()
{
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
));
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
,
));
final
RenderBox
parent
=
RenderIntrinsicHeight
(
child:
child
);
final
RenderBox
parent
=
RenderIntrinsicHeight
(
child:
child
);
layout
(
parent
,
layout
(
parent
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
5.0
,
minWidth:
5.0
,
minHeight:
8.0
,
minHeight:
8.0
,
...
@@ -360,9 +414,15 @@ void main() {
...
@@ -360,9 +414,15 @@ void main() {
});
});
test
(
'RenderIntrinsicHeight when parent is given tight constraints larger than intrinsic height of child'
,
()
{
test
(
'RenderIntrinsicHeight when parent is given tight constraints larger than intrinsic height of child'
,
()
{
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
));
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
,
));
final
RenderBox
parent
=
RenderIntrinsicHeight
(
child:
child
);
final
RenderBox
parent
=
RenderIntrinsicHeight
(
child:
child
);
layout
(
parent
,
layout
(
parent
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
5.0
,
minWidth:
5.0
,
minHeight:
400.0
,
minHeight:
400.0
,
...
@@ -377,9 +437,15 @@ void main() {
...
@@ -377,9 +437,15 @@ void main() {
});
});
test
(
'RenderIntrinsicHeight when parent is given tight constraints smaller than intrinsic height of child'
,
()
{
test
(
'RenderIntrinsicHeight when parent is given tight constraints smaller than intrinsic height of child'
,
()
{
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
));
final
RenderBox
child
=
RenderTestBox
(
const
BoxConstraints
(
minWidth:
10.0
,
maxWidth:
100.0
,
minHeight:
20.0
,
maxHeight:
200.0
,
));
final
RenderBox
parent
=
RenderIntrinsicHeight
(
child:
child
);
final
RenderBox
parent
=
RenderIntrinsicHeight
(
child:
child
);
layout
(
parent
,
layout
(
parent
,
constraints:
const
BoxConstraints
(
constraints:
const
BoxConstraints
(
minWidth:
5.0
,
minWidth:
5.0
,
minHeight:
80.0
,
minHeight:
80.0
,
...
...
packages/flutter/test/rendering/layer_annotations_test.dart
View file @
59fc9216
This diff is collapsed.
Click to expand it.
packages/flutter/test/rendering/layers_test.dart
View file @
59fc9216
...
@@ -294,8 +294,12 @@ void main() {
...
@@ -294,8 +294,12 @@ void main() {
test
(
'mutating PerformanceOverlayLayer fields triggers needsAddToScene'
,
()
{
test
(
'mutating PerformanceOverlayLayer fields triggers needsAddToScene'
,
()
{
final
PerformanceOverlayLayer
layer
=
PerformanceOverlayLayer
(
final
PerformanceOverlayLayer
layer
=
PerformanceOverlayLayer
(
overlayRect:
Rect
.
zero
,
optionsMask:
0
,
rasterizerThreshold:
0
,
overlayRect:
Rect
.
zero
,
checkerboardRasterCacheImages:
false
,
checkerboardOffscreenLayers:
false
);
optionsMask:
0
,
rasterizerThreshold:
0
,
checkerboardRasterCacheImages:
false
,
checkerboardOffscreenLayers:
false
,
);
checkNeedsAddToScene
(
layer
,
()
{
checkNeedsAddToScene
(
layer
,
()
{
layer
.
overlayRect
=
unitRect
;
layer
.
overlayRect
=
unitRect
;
});
});
...
@@ -383,7 +387,11 @@ void main() {
...
@@ -383,7 +387,11 @@ void main() {
test
(
'mutating PhysicalModelLayer fields triggers needsAddToScene'
,
()
{
test
(
'mutating PhysicalModelLayer fields triggers needsAddToScene'
,
()
{
final
PhysicalModelLayer
layer
=
PhysicalModelLayer
(
final
PhysicalModelLayer
layer
=
PhysicalModelLayer
(
clipPath:
Path
(),
elevation:
0
,
color:
const
Color
(
0x00000000
),
shadowColor:
const
Color
(
0x00000000
));
clipPath:
Path
(),
elevation:
0
,
color:
const
Color
(
0x00000000
),
shadowColor:
const
Color
(
0x00000000
),
);
checkNeedsAddToScene
(
layer
,
()
{
checkNeedsAddToScene
(
layer
,
()
{
final
Path
newPath
=
Path
();
final
Path
newPath
=
Path
();
newPath
.
addRect
(
unitRect
);
newPath
.
addRect
(
unitRect
);
...
...
packages/flutter/test/rendering/limited_box_test.dart
View file @
59fc9216
...
@@ -10,7 +10,7 @@ import 'rendering_tester.dart';
...
@@ -10,7 +10,7 @@ import 'rendering_tester.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'LimitedBox: parent max size is unconstrained'
,
()
{
test
(
'LimitedBox: parent max size is unconstrained'
,
()
{
final
RenderBox
child
=
RenderConstrainedBox
(
final
RenderBox
child
=
RenderConstrainedBox
(
additionalConstraints:
const
BoxConstraints
.
tightFor
(
width:
300.0
,
height:
400.0
)
additionalConstraints:
const
BoxConstraints
.
tightFor
(
width:
300.0
,
height:
400.0
)
,
);
);
final
RenderBox
parent
=
RenderConstrainedOverflowBox
(
final
RenderBox
parent
=
RenderConstrainedOverflowBox
(
minWidth:
0.0
,
minWidth:
0.0
,
...
@@ -59,7 +59,7 @@ void main() {
...
@@ -59,7 +59,7 @@ void main() {
test
(
'LimitedBox: parent maxWidth is unconstrained'
,
()
{
test
(
'LimitedBox: parent maxWidth is unconstrained'
,
()
{
final
RenderBox
child
=
RenderConstrainedBox
(
final
RenderBox
child
=
RenderConstrainedBox
(
additionalConstraints:
const
BoxConstraints
.
tightFor
(
width:
300.0
,
height:
400.0
)
additionalConstraints:
const
BoxConstraints
.
tightFor
(
width:
300.0
,
height:
400.0
)
,
);
);
final
RenderBox
parent
=
RenderConstrainedOverflowBox
(
final
RenderBox
parent
=
RenderConstrainedOverflowBox
(
minWidth:
0.0
,
minWidth:
0.0
,
...
@@ -79,7 +79,7 @@ void main() {
...
@@ -79,7 +79,7 @@ void main() {
test
(
'LimitedBox: parent maxHeight is unconstrained'
,
()
{
test
(
'LimitedBox: parent maxHeight is unconstrained'
,
()
{
final
RenderBox
child
=
RenderConstrainedBox
(
final
RenderBox
child
=
RenderConstrainedBox
(
additionalConstraints:
const
BoxConstraints
.
tightFor
(
width:
300.0
,
height:
400.0
)
additionalConstraints:
const
BoxConstraints
.
tightFor
(
width:
300.0
,
height:
400.0
)
,
);
);
final
RenderBox
parent
=
RenderConstrainedOverflowBox
(
final
RenderBox
parent
=
RenderConstrainedOverflowBox
(
minWidth:
500.0
,
minWidth:
500.0
,
...
...
packages/flutter/test/rendering/mock_canvas.dart
View file @
59fc9216
...
@@ -608,7 +608,7 @@ class _TestRecordingCanvasPaintsNothingMatcher extends _TestRecordingCanvasMatch
...
@@ -608,7 +608,7 @@ class _TestRecordingCanvasPaintsNothingMatcher extends _TestRecordingCanvasMatch
return
true
;
return
true
;
description
.
write
(
description
.
write
(
'painted something, the first call having the following stack:
\n
'
'painted something, the first call having the following stack:
\n
'
'
${paintingCalls.first.stackToString(indent: " ")}
\n
'
'
${paintingCalls.first.stackToString(indent: " ")}
\n
'
,
);
);
return
false
;
return
false
;
}
}
...
@@ -621,7 +621,7 @@ class _TestRecordingCanvasPaintsNothingMatcher extends _TestRecordingCanvasMatch
...
@@ -621,7 +621,7 @@ class _TestRecordingCanvasPaintsNothingMatcher extends _TestRecordingCanvasMatch
// Filters out canvas calls that are not painting anything.
// Filters out canvas calls that are not painting anything.
static
Iterable
<
RecordedInvocation
>
_filterCanvasCalls
(
Iterable
<
RecordedInvocation
>
canvasCalls
)
{
static
Iterable
<
RecordedInvocation
>
_filterCanvasCalls
(
Iterable
<
RecordedInvocation
>
canvasCalls
)
{
return
canvasCalls
.
where
((
RecordedInvocation
canvasCall
)
=>
return
canvasCalls
.
where
((
RecordedInvocation
canvasCall
)
=>
!
_nonPaintingOperations
.
contains
(
canvasCall
.
invocation
.
memberName
)
!
_nonPaintingOperations
.
contains
(
canvasCall
.
invocation
.
memberName
)
,
);
);
}
}
}
}
...
@@ -813,7 +813,7 @@ class _TestRecordingCanvasPatternMatcher extends _TestRecordingCanvasMatcher imp
...
@@ -813,7 +813,7 @@ class _TestRecordingCanvasPatternMatcher extends _TestRecordingCanvasMatcher imp
if
(
_predicates
.
isEmpty
)
{
if
(
_predicates
.
isEmpty
)
{
description
.
writeln
(
description
.
writeln
(
'It painted something, but you must now add a pattern to the paints matcher '
'It painted something, but you must now add a pattern to the paints matcher '
'in the test to verify that it matches the important parts of the following.'
'in the test to verify that it matches the important parts of the following.'
,
);
);
return
false
;
return
false
;
}
}
...
@@ -949,8 +949,16 @@ class _OneParameterPaintPredicate<T> extends _DrawCommandPaintPredicate {
...
@@ -949,8 +949,16 @@ class _OneParameterPaintPredicate<T> extends _DrawCommandPaintPredicate {
required
double
?
strokeWidth
,
required
double
?
strokeWidth
,
required
bool
?
hasMaskFilter
,
required
bool
?
hasMaskFilter
,
required
PaintingStyle
?
style
,
required
PaintingStyle
?
style
,
})
:
super
(
})
:
super
(
symbol
,
name
,
2
,
1
,
color:
color
,
strokeWidth:
strokeWidth
,
hasMaskFilter:
hasMaskFilter
,
style:
style
);
symbol
,
name
,
2
,
1
,
color:
color
,
strokeWidth:
strokeWidth
,
hasMaskFilter:
hasMaskFilter
,
style:
style
,
);
final
T
?
expected
;
final
T
?
expected
;
...
@@ -985,8 +993,16 @@ class _TwoParameterPaintPredicate<T1, T2> extends _DrawCommandPaintPredicate {
...
@@ -985,8 +993,16 @@ class _TwoParameterPaintPredicate<T1, T2> extends _DrawCommandPaintPredicate {
required
double
?
strokeWidth
,
required
double
?
strokeWidth
,
required
bool
?
hasMaskFilter
,
required
bool
?
hasMaskFilter
,
required
PaintingStyle
?
style
,
required
PaintingStyle
?
style
,
})
:
super
(
})
:
super
(
symbol
,
name
,
3
,
2
,
color:
color
,
strokeWidth:
strokeWidth
,
hasMaskFilter:
hasMaskFilter
,
style:
style
);
symbol
,
name
,
3
,
2
,
color:
color
,
strokeWidth:
strokeWidth
,
hasMaskFilter:
hasMaskFilter
,
style:
style
,
);
final
T1
?
expected1
;
final
T1
?
expected1
;
...
...
packages/flutter/test/rendering/mouse_tracker_cursor_test.dart
View file @
59fc9216
...
@@ -119,8 +119,7 @@ void main() {
...
@@ -119,8 +119,7 @@ void main() {
_pointerData
(
PointerChange
.
hover
,
const
Offset
(
10.0
,
0.0
)),
_pointerData
(
PointerChange
.
hover
,
const
Offset
(
10.0
,
0.0
)),
]));
]));
expect
(
logCursors
,
<
_CursorUpdateDetails
>[
expect
(
logCursors
,
<
_CursorUpdateDetails
>[]);
]);
logCursors
.
clear
();
logCursors
.
clear
();
// Pointer moves out of the annotation
// Pointer moves out of the annotation
...
@@ -139,8 +138,7 @@ void main() {
...
@@ -139,8 +138,7 @@ void main() {
_pointerData
(
PointerChange
.
remove
,
Offset
.
zero
),
_pointerData
(
PointerChange
.
remove
,
Offset
.
zero
),
]));
]));
expect
(
logCursors
,
const
<
_CursorUpdateDetails
>[
expect
(
logCursors
,
const
<
_CursorUpdateDetails
>[]);
]);
});
});
test
(
'pointer is added and removed in an annotation'
,
()
{
test
(
'pointer is added and removed in an annotation'
,
()
{
...
@@ -179,8 +177,7 @@ void main() {
...
@@ -179,8 +177,7 @@ void main() {
_pointerData
(
PointerChange
.
hover
,
const
Offset
(
10.0
,
0.0
)),
_pointerData
(
PointerChange
.
hover
,
const
Offset
(
10.0
,
0.0
)),
]));
]));
expect
(
logCursors
,
<
_CursorUpdateDetails
>[
expect
(
logCursors
,
<
_CursorUpdateDetails
>[]);
]);
logCursors
.
clear
();
logCursors
.
clear
();
// Pointer moves back into the annotation
// Pointer moves back into the annotation
...
@@ -199,8 +196,7 @@ void main() {
...
@@ -199,8 +196,7 @@ void main() {
_pointerData
(
PointerChange
.
remove
,
Offset
.
zero
),
_pointerData
(
PointerChange
.
remove
,
Offset
.
zero
),
]));
]));
expect
(
logCursors
,
<
_CursorUpdateDetails
>[
expect
(
logCursors
,
<
_CursorUpdateDetails
>[]);
]);
});
});
test
(
'pointer change caused by new frames'
,
()
{
test
(
'pointer change caused by new frames'
,
()
{
...
@@ -235,8 +231,7 @@ void main() {
...
@@ -235,8 +231,7 @@ void main() {
annotation
=
const
TestAnnotationTarget
(
cursor:
SystemMouseCursors
.
grabbing
);
annotation
=
const
TestAnnotationTarget
(
cursor:
SystemMouseCursors
.
grabbing
);
_binding
.
scheduleMouseTrackerPostFrameCheck
();
_binding
.
scheduleMouseTrackerPostFrameCheck
();
expect
(
logCursors
,
<
_CursorUpdateDetails
>[
expect
(
logCursors
,
<
_CursorUpdateDetails
>[]);
]);
logCursors
.
clear
();
logCursors
.
clear
();
// Pointer is removed outside of the annotation.
// Pointer is removed outside of the annotation.
...
@@ -244,8 +239,7 @@ void main() {
...
@@ -244,8 +239,7 @@ void main() {
_pointerData
(
PointerChange
.
remove
,
Offset
.
zero
),
_pointerData
(
PointerChange
.
remove
,
Offset
.
zero
),
]));
]));
expect
(
logCursors
,
<
_CursorUpdateDetails
>[
expect
(
logCursors
,
<
_CursorUpdateDetails
>[]);
]);
});
});
test
(
'The first annotation with non-deferring cursor is used'
,
()
{
test
(
'The first annotation with non-deferring cursor is used'
,
()
{
...
@@ -328,8 +322,7 @@ void main() {
...
@@ -328,8 +322,7 @@ void main() {
_pointerData
(
PointerChange
.
hover
,
const
Offset
(
5.0
,
0.0
)),
_pointerData
(
PointerChange
.
hover
,
const
Offset
(
5.0
,
0.0
)),
]));
]));
expect
(
logCursors
,
<
_CursorUpdateDetails
>[
expect
(
logCursors
,
<
_CursorUpdateDetails
>[]);
]);
logCursors
.
clear
();
logCursors
.
clear
();
// Pointer moved to no annotations
// Pointer moved to no annotations
...
@@ -338,8 +331,7 @@ void main() {
...
@@ -338,8 +331,7 @@ void main() {
_pointerData
(
PointerChange
.
hover
,
Offset
.
zero
),
_pointerData
(
PointerChange
.
hover
,
Offset
.
zero
),
]));
]));
expect
(
logCursors
,
<
_CursorUpdateDetails
>[
expect
(
logCursors
,
<
_CursorUpdateDetails
>[]);
]);
logCursors
.
clear
();
logCursors
.
clear
();
// Remove
// Remove
...
...
packages/flutter/test/rendering/mouse_tracker_test.dart
View file @
59fc9216
...
@@ -39,7 +39,7 @@ void main() {
...
@@ -39,7 +39,7 @@ void main() {
// This annotation also contains a cursor with a value of `testCursor`.
// This annotation also contains a cursor with a value of `testCursor`.
// The mouse tracker records the cursor requests it receives to `logCursors`.
// The mouse tracker records the cursor requests it receives to `logCursors`.
TestAnnotationTarget
_setUpWithOneAnnotation
({
TestAnnotationTarget
_setUpWithOneAnnotation
({
required
List
<
PointerEvent
>
logEvents
required
List
<
PointerEvent
>
logEvents
,
})
{
})
{
final
TestAnnotationTarget
oneAnnotation
=
TestAnnotationTarget
(
final
TestAnnotationTarget
oneAnnotation
=
TestAnnotationTarget
(
onEnter:
(
PointerEnterEvent
event
)
{
onEnter:
(
PointerEnterEvent
event
)
{
...
@@ -233,15 +233,13 @@ void main() {
...
@@ -233,15 +233,13 @@ void main() {
ui
.
window
.
onPointerDataPacket
!(
ui
.
PointerDataPacket
(
data:
<
ui
.
PointerData
>[
ui
.
window
.
onPointerDataPacket
!(
ui
.
PointerDataPacket
(
data:
<
ui
.
PointerData
>[
_pointerData
(
PointerChange
.
move
,
const
Offset
(
0.0
,
201.0
)),
_pointerData
(
PointerChange
.
move
,
const
Offset
(
0.0
,
201.0
)),
]));
]));
expect
(
events
,
_equalToEventsOnCriticalFields
(<
BaseEventMatcher
>[
expect
(
events
,
_equalToEventsOnCriticalFields
(<
BaseEventMatcher
>[]));
]));
events
.
clear
();
events
.
clear
();
ui
.
window
.
onPointerDataPacket
!(
ui
.
PointerDataPacket
(
data:
<
ui
.
PointerData
>[
ui
.
window
.
onPointerDataPacket
!(
ui
.
PointerDataPacket
(
data:
<
ui
.
PointerData
>[
_pointerData
(
PointerChange
.
up
,
const
Offset
(
0.0
,
301.0
)),
_pointerData
(
PointerChange
.
up
,
const
Offset
(
0.0
,
301.0
)),
]));
]));
expect
(
events
,
_equalToEventsOnCriticalFields
(<
BaseEventMatcher
>[
expect
(
events
,
_equalToEventsOnCriticalFields
(<
BaseEventMatcher
>[]));
]));
events
.
clear
();
events
.
clear
();
});
});
...
@@ -266,8 +264,7 @@ void main() {
...
@@ -266,8 +264,7 @@ void main() {
_pointerData
(
PointerChange
.
add
,
const
Offset
(
0.0
,
100.0
)),
_pointerData
(
PointerChange
.
add
,
const
Offset
(
0.0
,
100.0
)),
]));
]));
addTearDown
(()
=>
dispatchRemoveDevice
());
addTearDown
(()
=>
dispatchRemoveDevice
());
expect
(
events
,
_equalToEventsOnCriticalFields
(<
BaseEventMatcher
>[
expect
(
events
,
_equalToEventsOnCriticalFields
(<
BaseEventMatcher
>[]));
]));
expect
(
_mouseTracker
.
mouseIsConnected
,
isTrue
);
expect
(
_mouseTracker
.
mouseIsConnected
,
isTrue
);
events
.
clear
();
events
.
clear
();
...
@@ -445,10 +442,10 @@ void main() {
...
@@ -445,10 +442,10 @@ void main() {
bool
isInHitRegionOne
=
true
;
bool
isInHitRegionOne
=
true
;
bool
isInHitRegionTwo
=
false
;
bool
isInHitRegionTwo
=
false
;
final
TestAnnotationTarget
annotation1
=
TestAnnotationTarget
(
final
TestAnnotationTarget
annotation1
=
TestAnnotationTarget
(
onEnter:
(
PointerEnterEvent
event
)
{}
onEnter:
(
PointerEnterEvent
event
)
{}
,
);
);
final
TestAnnotationTarget
annotation2
=
TestAnnotationTarget
(
final
TestAnnotationTarget
annotation2
=
TestAnnotationTarget
(
onExit:
(
PointerExitEvent
event
)
{}
onExit:
(
PointerExitEvent
event
)
{}
,
);
);
_setUpMouseAnnotationFinder
((
Offset
position
)
sync
*
{
_setUpMouseAnnotationFinder
((
Offset
position
)
sync
*
{
if
(
isInHitRegionOne
)
if
(
isInHitRegionOne
)
...
@@ -602,8 +599,7 @@ class BaseEventMatcher extends Matcher {
...
@@ -602,8 +599,7 @@ class BaseEventMatcher extends Matcher {
final
PointerEvent
expected
;
final
PointerEvent
expected
;
bool
_matchesField
(
Map
<
dynamic
,
dynamic
>
matchState
,
String
field
,
bool
_matchesField
(
Map
<
dynamic
,
dynamic
>
matchState
,
String
field
,
dynamic
actual
,
dynamic
expected
)
{
dynamic
actual
,
dynamic
expected
)
{
if
(
actual
!=
expected
)
{
if
(
actual
!=
expected
)
{
addStateInfo
(
matchState
,
<
dynamic
,
dynamic
>{
addStateInfo
(
matchState
,
<
dynamic
,
dynamic
>{
'field'
:
field
,
'field'
:
field
,
...
@@ -746,8 +742,12 @@ class _EventListCriticalFieldsMatcher extends Matcher {
...
@@ -746,8 +742,12 @@ class _EventListCriticalFieldsMatcher extends Matcher {
.
add
(
'
\n
since it '
);
.
add
(
'
\n
since it '
);
final
Description
subDescription
=
StringDescription
();
final
Description
subDescription
=
StringDescription
();
final
Matcher
matcher
=
matchState
[
'matcher'
]
as
Matcher
;
final
Matcher
matcher
=
matchState
[
'matcher'
]
as
Matcher
;
matcher
.
describeMismatch
(
matchState
[
'actual'
],
subDescription
,
matcher
.
describeMismatch
(
matchState
[
'state'
]
as
Map
<
dynamic
,
dynamic
>,
verbose
);
matchState
[
'actual'
],
subDescription
,
matchState
[
'state'
]
as
Map
<
dynamic
,
dynamic
>,
verbose
,
);
mismatchDescription
.
add
(
subDescription
.
toString
());
mismatchDescription
.
add
(
subDescription
.
toString
());
return
mismatchDescription
;
return
mismatchDescription
;
}
}
...
...
packages/flutter/test/rendering/object_test.dart
View file @
59fc9216
...
@@ -65,7 +65,7 @@ void main() {
...
@@ -65,7 +65,7 @@ void main() {
equalsIgnoringHashCodes
(
equalsIgnoringHashCodes
(
'══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞══════════════════════
\n
'
'══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞══════════════════════
\n
'
'The following assertion was thrown during performLayout():
\n
'
'The following assertion was thrown during performLayout():
\n
'
'TestThrowingRenderObject does not support performLayout.
\n
'
'TestThrowingRenderObject does not support performLayout.
\n
'
,
),
),
);
);
...
@@ -78,7 +78,7 @@ void main() {
...
@@ -78,7 +78,7 @@ void main() {
' parentData: MISSING
\n
'
' parentData: MISSING
\n
'
' constraints: BoxConstraints(unconstrained)
\n
'
' constraints: BoxConstraints(unconstrained)
\n
'
'This RenderObject has no descendants.
\n
'
'This RenderObject has no descendants.
\n
'
'═════════════════════════════════════════════════════════════════
\n
'
'═════════════════════════════════════════════════════════════════
\n
'
,
),
),
);
);
});
});
...
...
packages/flutter/test/rendering/paint_error_test.dart
View file @
59fc9216
...
@@ -41,7 +41,7 @@ void main() {
...
@@ -41,7 +41,7 @@ void main() {
'Since this typically indicates an infinite recursion, it is
\n
'
'Since this typically indicates an infinite recursion, it is
\n
'
'disallowed.
\n
'
'disallowed.
\n
'
'
\n
'
'
\n
'
'When the exception was thrown, this was the stack:'
'When the exception was thrown, this was the stack:'
,
),
),
);
);
...
@@ -54,7 +54,7 @@ void main() {
...
@@ -54,7 +54,7 @@ void main() {
' constraints: BoxConstraints(w=800.0, h=600.0)
\n
'
' constraints: BoxConstraints(w=800.0, h=600.0)
\n
'
' size: Size(100.0, 100.0)
\n
'
' size: Size(100.0, 100.0)
\n
'
'This RenderObject has no descendants.
\n
'
'This RenderObject has no descendants.
\n
'
'═════════════════════════════════════════════════════════════════
\n
'
'═════════════════════════════════════════════════════════════════
\n
'
,
),
),
);
);
});
});
...
@@ -91,7 +91,7 @@ void main() {
...
@@ -91,7 +91,7 @@ void main() {
' A RenderObject that still has dirty compositing bits cannot be
\n
'
' A RenderObject that still has dirty compositing bits cannot be
\n
'
' painted because this indicates that the tree has not yet been
\n
'
' painted because this indicates that the tree has not yet been
\n
'
' properly configured for creating the layer tree.
\n
'
' properly configured for creating the layer tree.
\n
'
' This usually indicates an error in the Flutter framework itself.
\n
'
' This usually indicates an error in the Flutter framework itself.
\n
'
,
),
),
);
);
expect
(
expect
(
...
...
packages/flutter/test/rendering/paragraph_test.dart
View file @
59fc9216
...
@@ -112,13 +112,13 @@ void main() {
...
@@ -112,13 +112,13 @@ void main() {
layout
(
paragraph
);
layout
(
paragraph
);
List
<
ui
.
TextBox
>
boxes
=
paragraph
.
getBoxesForSelection
(
List
<
ui
.
TextBox
>
boxes
=
paragraph
.
getBoxesForSelection
(
const
TextSelection
(
baseOffset:
5
,
extentOffset:
25
)
const
TextSelection
(
baseOffset:
5
,
extentOffset:
25
),
);
);
expect
(
boxes
.
length
,
equals
(
1
));
expect
(
boxes
.
length
,
equals
(
1
));
boxes
=
paragraph
.
getBoxesForSelection
(
boxes
=
paragraph
.
getBoxesForSelection
(
const
TextSelection
(
baseOffset:
25
,
extentOffset:
50
)
const
TextSelection
(
baseOffset:
25
,
extentOffset:
50
),
);
);
expect
(
boxes
.
any
((
ui
.
TextBox
box
)
=>
box
.
left
==
250
&&
box
.
top
==
0
),
isTrue
);
expect
(
boxes
.
any
((
ui
.
TextBox
box
)
=>
box
.
left
==
250
&&
box
.
top
==
0
),
isTrue
);
...
@@ -320,7 +320,7 @@ void main() {
...
@@ -320,7 +320,7 @@ void main() {
final
List
<
ui
.
TextBox
>
boxes
=
<
ui
.
TextBox
>[
final
List
<
ui
.
TextBox
>
boxes
=
<
ui
.
TextBox
>[
for
(
int
i
=
0
;
i
<
text
.
length
;
++
i
)
for
(
int
i
=
0
;
i
<
text
.
length
;
++
i
)
...
paragraph
.
getBoxesForSelection
(
...
paragraph
.
getBoxesForSelection
(
TextSelection
(
baseOffset:
i
,
extentOffset:
i
+
1
)
TextSelection
(
baseOffset:
i
,
extentOffset:
i
+
1
)
,
),
),
];
];
expect
(
boxes
.
length
,
equals
(
4
));
expect
(
boxes
.
length
,
equals
(
4
));
...
@@ -362,7 +362,7 @@ void main() {
...
@@ -362,7 +362,7 @@ void main() {
' ║ TextSpan:
\n
'
' ║ TextSpan:
\n
'
' ║ "I polished up that handle so carefullee
\n
'
' ║ "I polished up that handle so carefullee
\n
'
' ║ That now I am the Ruler of the Queen
\'
s Navee!"
\n
'
' ║ That now I am the Ruler of the Queen
\'
s Navee!"
\n
'
' ╚═══════════
\n
'
' ╚═══════════
\n
'
,
),
),
);
);
});
});
...
@@ -408,7 +408,7 @@ void main() {
...
@@ -408,7 +408,7 @@ void main() {
layout
(
paragraph
,
constraints:
const
BoxConstraints
(
maxWidth:
100.0
));
layout
(
paragraph
,
constraints:
const
BoxConstraints
(
maxWidth:
100.0
));
final
List
<
ui
.
TextBox
>
boxes
=
paragraph
.
getBoxesForSelection
(
final
List
<
ui
.
TextBox
>
boxes
=
paragraph
.
getBoxesForSelection
(
const
TextSelection
(
baseOffset:
0
,
extentOffset:
8
)
const
TextSelection
(
baseOffset:
0
,
extentOffset:
8
),
);
);
expect
(
boxes
.
length
,
equals
(
5
));
expect
(
boxes
.
length
,
equals
(
5
));
...
@@ -429,8 +429,8 @@ void main() {
...
@@ -429,8 +429,8 @@ void main() {
RenderParagraph
paragraph
=
RenderParagraph
(
RenderParagraph
paragraph
=
RenderParagraph
(
const
TextSpan
(
const
TextSpan
(
children:
<
InlineSpan
>
[
children:
<
InlineSpan
>
[
WidgetSpan
(
child:
Text
(
sentence
))
WidgetSpan
(
child:
Text
(
sentence
))
,
]
]
,
),
),
textScaleFactor:
1.0
,
textScaleFactor:
1.0
,
children:
renderBoxes
,
children:
renderBoxes
,
...
@@ -447,8 +447,8 @@ void main() {
...
@@ -447,8 +447,8 @@ void main() {
paragraph
=
RenderParagraph
(
paragraph
=
RenderParagraph
(
const
TextSpan
(
const
TextSpan
(
children:
<
InlineSpan
>
[
children:
<
InlineSpan
>
[
WidgetSpan
(
child:
Text
(
sentence
))
WidgetSpan
(
child:
Text
(
sentence
))
,
]
]
,
),
),
textScaleFactor:
2.0
,
textScaleFactor:
2.0
,
children:
renderBoxes
,
children:
renderBoxes
,
...
@@ -474,8 +474,8 @@ void main() {
...
@@ -474,8 +474,8 @@ void main() {
RenderParagraph
paragraph
=
RenderParagraph
(
RenderParagraph
paragraph
=
RenderParagraph
(
const
TextSpan
(
const
TextSpan
(
children:
<
InlineSpan
>
[
children:
<
InlineSpan
>
[
WidgetSpan
(
child:
Text
(
sentence
))
WidgetSpan
(
child:
Text
(
sentence
))
,
]
]
,
),
),
textScaleFactor:
1.0
,
textScaleFactor:
1.0
,
children:
renderBoxes
,
children:
renderBoxes
,
...
@@ -492,8 +492,8 @@ void main() {
...
@@ -492,8 +492,8 @@ void main() {
paragraph
=
RenderParagraph
(
paragraph
=
RenderParagraph
(
const
TextSpan
(
const
TextSpan
(
children:
<
InlineSpan
>
[
children:
<
InlineSpan
>
[
WidgetSpan
(
child:
Text
(
sentence
))
WidgetSpan
(
child:
Text
(
sentence
))
,
]
]
,
),
),
textScaleFactor:
2.0
,
textScaleFactor:
2.0
,
children:
renderBoxes
,
children:
renderBoxes
,
...
@@ -541,7 +541,7 @@ void main() {
...
@@ -541,7 +541,7 @@ void main() {
layout
(
paragraph
,
constraints:
const
BoxConstraints
(
maxWidth:
50.0
));
layout
(
paragraph
,
constraints:
const
BoxConstraints
(
maxWidth:
50.0
));
final
List
<
ui
.
TextBox
>
boxes
=
paragraph
.
getBoxesForSelection
(
final
List
<
ui
.
TextBox
>
boxes
=
paragraph
.
getBoxesForSelection
(
const
TextSelection
(
baseOffset:
0
,
extentOffset:
12
)
const
TextSelection
(
baseOffset:
0
,
extentOffset:
12
),
);
);
expect
(
boxes
.
length
,
equals
(
9
));
expect
(
boxes
.
length
,
equals
(
9
));
...
...
packages/flutter/test/rendering/platform_view_test.dart
View file @
59fc9216
...
@@ -47,7 +47,7 @@ void main() {
...
@@ -47,7 +47,7 @@ void main() {
final
SemanticsHandle
semanticsHandle
=
renderer
.
pipelineOwner
.
ensureSemantics
(
final
SemanticsHandle
semanticsHandle
=
renderer
.
pipelineOwner
.
ensureSemantics
(
listener:
()
{
listener:
()
{
++
semanticsUpdateCount
;
++
semanticsUpdateCount
;
}
}
,
);
);
layout
(
tree
,
phase:
EnginePhase
.
flushSemantics
);
layout
(
tree
,
phase:
EnginePhase
.
flushSemantics
);
// Initial semantics update
// Initial semantics update
...
...
packages/flutter/test/rendering/proxy_box_test.dart
View file @
59fc9216
...
@@ -196,18 +196,22 @@ void main() {
...
@@ -196,18 +196,22 @@ void main() {
boundary
=
RenderRepaintBoundary
();
boundary
=
RenderRepaintBoundary
();
final
RenderStack
stack
=
RenderStack
()..
alignment
=
Alignment
.
topLeft
;
final
RenderStack
stack
=
RenderStack
()..
alignment
=
Alignment
.
topLeft
;
final
RenderDecoratedBox
blackBox
=
RenderDecoratedBox
(
final
RenderDecoratedBox
blackBox
=
RenderDecoratedBox
(
decoration:
const
BoxDecoration
(
color:
Color
(
0xff000000
)),
decoration:
const
BoxDecoration
(
color:
Color
(
0xff000000
)),
child:
RenderConstrainedBox
(
child:
RenderConstrainedBox
(
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
.
square
(
20.0
)),
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
.
square
(
20.0
)),
));
),
stack
.
add
(
RenderOpacity
()
);
..
opacity
=
0.5
stack
.
add
(
..
child
=
blackBox
);
RenderOpacity
()
..
opacity
=
0.5
..
child
=
blackBox
,
);
final
RenderDecoratedBox
whiteBox
=
RenderDecoratedBox
(
final
RenderDecoratedBox
whiteBox
=
RenderDecoratedBox
(
decoration:
const
BoxDecoration
(
color:
Color
(
0xffffffff
)),
decoration:
const
BoxDecoration
(
color:
Color
(
0xffffffff
)),
child:
RenderConstrainedBox
(
child:
RenderConstrainedBox
(
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
.
square
(
10.0
)),
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
.
square
(
10.0
)),
));
),
);
final
RenderPositionedBox
positioned
=
RenderPositionedBox
(
final
RenderPositionedBox
positioned
=
RenderPositionedBox
(
widthFactor:
2.0
,
widthFactor:
2.0
,
heightFactor:
2.0
,
heightFactor:
2.0
,
...
...
packages/flutter/test/rendering/proxy_sliver_test.dart
View file @
59fc9216
...
@@ -14,7 +14,7 @@ void main() {
...
@@ -14,7 +14,7 @@ void main() {
opacity:
0.0
,
opacity:
0.0
,
sliver:
RenderSliverToBoxAdapter
(
sliver:
RenderSliverToBoxAdapter
(
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
)
)
,
);
);
final
RenderViewport
root
=
RenderViewport
(
final
RenderViewport
root
=
RenderViewport
(
...
@@ -34,7 +34,7 @@ void main() {
...
@@ -34,7 +34,7 @@ void main() {
opacity:
1.0
,
opacity:
1.0
,
sliver:
RenderSliverToBoxAdapter
(
sliver:
RenderSliverToBoxAdapter
(
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
)
)
,
);
);
final
RenderViewport
root
=
RenderViewport
(
final
RenderViewport
root
=
RenderViewport
(
...
@@ -53,7 +53,7 @@ void main() {
...
@@ -53,7 +53,7 @@ void main() {
opacity:
0.5
,
opacity:
0.5
,
sliver:
RenderSliverToBoxAdapter
(
sliver:
RenderSliverToBoxAdapter
(
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
)
)
,
);
);
final
RenderViewport
root
=
RenderViewport
(
final
RenderViewport
root
=
RenderViewport
(
...
@@ -61,7 +61,7 @@ void main() {
...
@@ -61,7 +61,7 @@ void main() {
crossAxisDirection:
AxisDirection
.
right
,
crossAxisDirection:
AxisDirection
.
right
,
offset:
ViewportOffset
.
zero
(),
offset:
ViewportOffset
.
zero
(),
cacheExtent:
250.0
,
cacheExtent:
250.0
,
children:
<
RenderSliver
>[
renderSliverOpacity
]
children:
<
RenderSliver
>[
renderSliverOpacity
]
,
);
);
expect
(
renderSliverOpacity
.
debugLayer
,
null
);
expect
(
renderSliverOpacity
.
debugLayer
,
null
);
...
@@ -87,7 +87,7 @@ void main() {
...
@@ -87,7 +87,7 @@ void main() {
opacity:
opacityAnimation
,
opacity:
opacityAnimation
,
sliver:
RenderSliverToBoxAdapter
(
sliver:
RenderSliverToBoxAdapter
(
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
)
)
,
);
);
final
RenderViewport
root
=
RenderViewport
(
final
RenderViewport
root
=
RenderViewport
(
...
@@ -112,7 +112,7 @@ void main() {
...
@@ -112,7 +112,7 @@ void main() {
opacity:
opacityAnimation
,
opacity:
opacityAnimation
,
sliver:
RenderSliverToBoxAdapter
(
sliver:
RenderSliverToBoxAdapter
(
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
)
)
,
);
);
final
RenderViewport
root
=
RenderViewport
(
final
RenderViewport
root
=
RenderViewport
(
...
@@ -136,7 +136,7 @@ void main() {
...
@@ -136,7 +136,7 @@ void main() {
opacity:
opacityAnimation
,
opacity:
opacityAnimation
,
sliver:
RenderSliverToBoxAdapter
(
sliver:
RenderSliverToBoxAdapter
(
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
child:
RenderSizedBox
(
const
Size
(
1.0
,
1.0
)),
// size doesn't matter
)
)
,
);
);
final
RenderViewport
root
=
RenderViewport
(
final
RenderViewport
root
=
RenderViewport
(
...
@@ -144,7 +144,7 @@ void main() {
...
@@ -144,7 +144,7 @@ void main() {
crossAxisDirection:
AxisDirection
.
right
,
crossAxisDirection:
AxisDirection
.
right
,
offset:
ViewportOffset
.
zero
(),
offset:
ViewportOffset
.
zero
(),
cacheExtent:
250.0
,
cacheExtent:
250.0
,
children:
<
RenderSliver
>[
renderSliverAnimatedOpacity
]
children:
<
RenderSliver
>[
renderSliverAnimatedOpacity
]
,
);
);
expect
(
renderSliverAnimatedOpacity
.
debugLayer
,
null
);
expect
(
renderSliverAnimatedOpacity
.
debugLayer
,
null
);
...
...
packages/flutter/test/rendering/reattach_test.dart
View file @
59fc9216
...
@@ -66,7 +66,7 @@ class TestCompositingBitsTree {
...
@@ -66,7 +66,7 @@ class TestCompositingBitsTree {
onPaint:
()
{
painted
=
true
;
},
onPaint:
()
{
painted
=
true
;
},
),
),
child:
child
=
RenderConstrainedBox
(
child:
child
=
RenderConstrainedBox
(
additionalConstraints:
const
BoxConstraints
.
tightFor
(
height:
20.0
,
width:
20.0
)
additionalConstraints:
const
BoxConstraints
.
tightFor
(
height:
20.0
,
width:
20.0
)
,
),
),
),
),
),
),
...
@@ -133,7 +133,7 @@ void main() {
...
@@ -133,7 +133,7 @@ void main() {
final
SemanticsHandle
semanticsHandle
=
renderer
.
pipelineOwner
.
ensureSemantics
(
final
SemanticsHandle
semanticsHandle
=
renderer
.
pipelineOwner
.
ensureSemantics
(
listener:
()
{
listener:
()
{
++
semanticsUpdateCount
;
++
semanticsUpdateCount
;
}
}
,
);
);
// Lay out, composite, paint, and update semantics
// Lay out, composite, paint, and update semantics
layout
(
testTree
.
root
,
phase:
EnginePhase
.
flushSemantics
);
layout
(
testTree
.
root
,
phase:
EnginePhase
.
flushSemantics
);
...
@@ -154,9 +154,9 @@ void main() {
...
@@ -154,9 +154,9 @@ void main() {
final
TestTree
testTree
=
TestTree
();
final
TestTree
testTree
=
TestTree
();
int
semanticsUpdateCount
=
0
;
int
semanticsUpdateCount
=
0
;
final
SemanticsHandle
semanticsHandle
=
renderer
.
pipelineOwner
.
ensureSemantics
(
final
SemanticsHandle
semanticsHandle
=
renderer
.
pipelineOwner
.
ensureSemantics
(
listener:
()
{
listener:
()
{
++
semanticsUpdateCount
;
++
semanticsUpdateCount
;
}
},
);
);
// Lay out, composite, paint, and update semantics
// Lay out, composite, paint, and update semantics
layout
(
testTree
.
root
,
phase:
EnginePhase
.
flushSemantics
);
layout
(
testTree
.
root
,
phase:
EnginePhase
.
flushSemantics
);
...
...
packages/flutter/test/rendering/recording_canvas.dart
View file @
59fc9216
...
@@ -30,7 +30,7 @@ class RecordedInvocation {
...
@@ -30,7 +30,7 @@ class RecordedInvocation {
String
stackToString
({
String
indent
=
''
})
{
String
stackToString
({
String
indent
=
''
})
{
assert
(
indent
!=
null
);
assert
(
indent
!=
null
);
return
indent
+
FlutterError
.
defaultStackFilter
(
return
indent
+
FlutterError
.
defaultStackFilter
(
stack
.
toString
().
trimRight
().
split
(
'
\n
'
)
stack
.
toString
().
trimRight
().
split
(
'
\n
'
)
,
).
join
(
'
\n
$indent
'
);
).
join
(
'
\n
$indent
'
);
}
}
}
}
...
...
packages/flutter/test/rendering/rendering_tester.dart
View file @
59fc9216
...
@@ -105,8 +105,7 @@ class TestRenderingFlutterBinding extends BindingBase with SchedulerBinding, Ser
...
@@ -105,8 +105,7 @@ class TestRenderingFlutterBinding extends BindingBase with SchedulerBinding, Ser
pipelineOwner
.
flushSemantics
();
pipelineOwner
.
flushSemantics
();
if
(
phase
==
EnginePhase
.
flushSemantics
)
if
(
phase
==
EnginePhase
.
flushSemantics
)
return
;
return
;
assert
(
phase
==
EnginePhase
.
flushSemantics
||
assert
(
phase
==
EnginePhase
.
flushSemantics
||
phase
==
EnginePhase
.
sendSemanticsUpdate
);
phase
==
EnginePhase
.
sendSemanticsUpdate
);
}
finally
{
}
finally
{
FlutterError
.
onError
=
oldErrorHandler
;
FlutterError
.
onError
=
oldErrorHandler
;
if
(
_errors
.
isNotEmpty
)
{
if
(
_errors
.
isNotEmpty
)
{
...
...
packages/flutter/test/rendering/repaint_boundary_test.dart
View file @
59fc9216
...
@@ -17,8 +17,8 @@ void main() {
...
@@ -17,8 +17,8 @@ void main() {
opacity:
1.0
,
opacity:
1.0
,
child:
RenderRepaintBoundary
(
child:
RenderRepaintBoundary
(
child:
c
=
RenderOpacity
(
child:
c
=
RenderOpacity
(
opacity:
1.0
opacity:
1.0
,
)
)
,
),
),
),
),
),
),
...
...
packages/flutter/test/rendering/simple_semantics_test.dart
View file @
59fc9216
...
@@ -20,9 +20,9 @@ void main() {
...
@@ -20,9 +20,9 @@ void main() {
);
);
int
semanticsUpdateCount
=
0
;
int
semanticsUpdateCount
=
0
;
final
SemanticsHandle
semanticsHandle
=
renderer
.
pipelineOwner
.
ensureSemantics
(
final
SemanticsHandle
semanticsHandle
=
renderer
.
pipelineOwner
.
ensureSemantics
(
listener:
()
{
listener:
()
{
++
semanticsUpdateCount
;
++
semanticsUpdateCount
;
}
},
);
);
layout
(
tree
,
phase:
EnginePhase
.
flushSemantics
);
layout
(
tree
,
phase:
EnginePhase
.
flushSemantics
);
...
...
packages/flutter/test/rendering/size_test.dart
View file @
59fc9216
...
@@ -10,7 +10,8 @@ import 'rendering_tester.dart';
...
@@ -10,7 +10,8 @@ import 'rendering_tester.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'Stack can layout with top, right, bottom, left 0.0'
,
()
{
test
(
'Stack can layout with top, right, bottom, left 0.0'
,
()
{
final
RenderBox
box
=
RenderConstrainedBox
(
final
RenderBox
box
=
RenderConstrainedBox
(
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
)));
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
)),
);
layout
(
box
,
constraints:
const
BoxConstraints
());
layout
(
box
,
constraints:
const
BoxConstraints
());
...
...
packages/flutter/test/rendering/sliver_fixed_extent_layout_test.dart
View file @
59fc9216
...
@@ -66,41 +66,46 @@ void main() {
...
@@ -66,41 +66,46 @@ void main() {
});
});
test
(
'should be 1 when offset is greater than item extent'
,
()
{
test
(
'should be 1 when offset is greater than item extent'
,
()
{
final
int
actual
=
testGetMaxChildIndexForScrollOffset
(
final
int
actual
=
testGetMaxChildIndexForScrollOffset
(
genericItemExtent
+
1
,
genericItemExtent
);
genericItemExtent
+
1
,
genericItemExtent
);
expect
(
actual
,
1
);
expect
(
actual
,
1
);
});
});
test
(
'should be 1 when offset is slightly greater than item extent'
,
()
{
test
(
'should be 1 when offset is slightly greater than item extent'
,
()
{
final
int
actual
=
testGetMaxChildIndexForScrollOffset
(
final
int
actual
=
testGetMaxChildIndexForScrollOffset
(
genericItemExtent
+
extraValueToNotHaveRoundingIssues
,
genericItemExtent
);
genericItemExtent
+
extraValueToNotHaveRoundingIssues
,
genericItemExtent
,
);
expect
(
actual
,
1
);
expect
(
actual
,
1
);
});
});
test
(
'should be 4 when offset is four times and a half greater than item extent'
,
()
{
test
(
'should be 4 when offset is four times and a half greater than item extent'
,
()
{
final
int
actual
=
testGetMaxChildIndexForScrollOffset
(
final
int
actual
=
testGetMaxChildIndexForScrollOffset
(
genericItemExtent
*
4.5
,
genericItemExtent
);
genericItemExtent
*
4.5
,
genericItemExtent
);
expect
(
actual
,
4
);
expect
(
actual
,
4
);
});
});
test
(
'should be 5 when offset is 6 times greater than item extent'
,
()
{
test
(
'should be 5 when offset is 6 times greater than item extent'
,
()
{
const
double
anotherGenericItemExtent
=
414.0
;
const
double
anotherGenericItemExtent
=
414.0
;
final
int
actual
=
testGetMaxChildIndexForScrollOffset
(
final
int
actual
=
testGetMaxChildIndexForScrollOffset
(
anotherGenericItemExtent
*
6
,
anotherGenericItemExtent
);
anotherGenericItemExtent
*
6
,
anotherGenericItemExtent
,
);
expect
(
actual
,
5
);
expect
(
actual
,
5
);
});
});
test
(
'should be 5 when offset is 6 times greater than a specific item extent where the division will return more than 13 zero decimals'
,
()
{
test
(
'should be 5 when offset is 6 times greater than a specific item extent where the division will return more than 13 zero decimals'
,
()
{
const
double
itemExtentSpecificForAProblematicSreenSize
=
411.42857142857144
;
const
double
itemExtentSpecificForAProblematicSreenSize
=
411.42857142857144
;
final
int
actual
=
testGetMaxChildIndexForScrollOffset
(
final
int
actual
=
testGetMaxChildIndexForScrollOffset
(
itemExtentSpecificForAProblematicSreenSize
*
6
+
extraValueToHaveRoundingIssues
,
itemExtentSpecificForAProblematicSreenSize
*
6
+
extraValueToHaveRoundingIssues
,
itemExtentSpecificForAProblematicSreenSize
);
itemExtentSpecificForAProblematicSreenSize
,
);
expect
(
actual
,
5
);
expect
(
actual
,
5
);
});
});
test
(
'should be 0 when offset is 0.00000001 times greater than item extent where the division will return more than 13 zero decimals'
,
()
{
test
(
'should be 0 when offset is 0.00000001 times greater than item extent where the division will return more than 13 zero decimals'
,
()
{
final
int
actual
=
testGetMaxChildIndexForScrollOffset
(
final
int
actual
=
testGetMaxChildIndexForScrollOffset
(
genericItemExtent
+
extraValueToHaveRoundingIssues
,
genericItemExtent
);
genericItemExtent
+
extraValueToHaveRoundingIssues
,
genericItemExtent
,
);
expect
(
actual
,
0
);
expect
(
actual
,
0
);
});
});
});
});
...
...
packages/flutter/test/rendering/sliver_persistent_header_test.dart
View file @
59fc9216
...
@@ -27,8 +27,8 @@ void main() {
...
@@ -27,8 +27,8 @@ void main() {
test
(
'RenderSliverFloatingPinnedPersistentHeader maxScrollObstructionExtent is minExtent'
,
()
{
test
(
'RenderSliverFloatingPinnedPersistentHeader maxScrollObstructionExtent is minExtent'
,
()
{
final
TestRenderSliverFloatingPinnedPersistentHeader
header
=
TestRenderSliverFloatingPinnedPersistentHeader
(
final
TestRenderSliverFloatingPinnedPersistentHeader
header
=
TestRenderSliverFloatingPinnedPersistentHeader
(
child:
RenderSizedBox
(
const
Size
(
400.0
,
100.0
)
child:
RenderSizedBox
(
const
Size
(
400.0
,
100.0
)
),
)
)
;
);
final
RenderViewport
root
=
RenderViewport
(
final
RenderViewport
root
=
RenderViewport
(
axisDirection:
AxisDirection
.
down
,
axisDirection:
AxisDirection
.
down
,
crossAxisDirection:
AxisDirection
.
right
,
crossAxisDirection:
AxisDirection
.
right
,
...
...
packages/flutter/test/rendering/slivers_test.dart
View file @
59fc9216
...
@@ -27,7 +27,7 @@ void main() {
...
@@ -27,7 +27,7 @@ void main() {
' axisDirection: down
\n
'
' axisDirection: down
\n
'
' crossAxisDirection: right
\n
'
' crossAxisDirection: right
\n
'
' offset: _FixedViewportOffset#00000(offset: 0.0)
\n
'
' offset: _FixedViewportOffset#00000(offset: 0.0)
\n
'
' anchor: 0.0
\n
'
' anchor: 0.0
\n
'
,
),
),
);
);
layout
(
root
);
layout
(
root
);
...
@@ -164,7 +164,7 @@ void main() {
...
@@ -164,7 +164,7 @@ void main() {
' └─child: RenderSizedBox#00000 NEEDS-PAINT
\n
'
' └─child: RenderSizedBox#00000 NEEDS-PAINT
\n
'
' parentData: paintOffset=Offset(0.0, -0.0) (can use size)
\n
'
' parentData: paintOffset=Offset(0.0, -0.0) (can use size)
\n
'
' constraints: BoxConstraints(w=800.0, 0.0<=h<=Infinity)
\n
'
' constraints: BoxConstraints(w=800.0, 0.0<=h<=Infinity)
\n
'
' size: Size(800.0, 400.0)
\n
'
' size: Size(800.0, 400.0)
\n
'
,
),
),
);
);
expect
(
a
.
localToGlobal
(
Offset
.
zero
),
Offset
.
zero
);
expect
(
a
.
localToGlobal
(
Offset
.
zero
),
Offset
.
zero
);
...
...
packages/flutter/test/rendering/stack_test.dart
View file @
59fc9216
...
@@ -10,7 +10,7 @@ import 'rendering_tester.dart';
...
@@ -10,7 +10,7 @@ import 'rendering_tester.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'Stack can layout with top, right, bottom, left 0.0'
,
()
{
test
(
'Stack can layout with top, right, bottom, left 0.0'
,
()
{
final
RenderBox
size
=
RenderConstrainedBox
(
final
RenderBox
size
=
RenderConstrainedBox
(
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
))
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
))
,
);
);
final
RenderBox
red
=
RenderDecoratedBox
(
final
RenderBox
red
=
RenderDecoratedBox
(
...
@@ -91,18 +91,18 @@ void main() {
...
@@ -91,18 +91,18 @@ void main() {
group
(
'RenderIndexedStack'
,
()
{
group
(
'RenderIndexedStack'
,
()
{
test
(
'visitChildrenForSemantics only visits displayed child'
,
()
{
test
(
'visitChildrenForSemantics only visits displayed child'
,
()
{
final
RenderBox
child1
=
RenderConstrainedBox
(
final
RenderBox
child1
=
RenderConstrainedBox
(
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
))
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
)),
);
);
final
RenderBox
child2
=
RenderConstrainedBox
(
final
RenderBox
child2
=
RenderConstrainedBox
(
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
))
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
)),
);
);
final
RenderBox
child3
=
RenderConstrainedBox
(
final
RenderBox
child3
=
RenderConstrainedBox
(
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
))
additionalConstraints:
BoxConstraints
.
tight
(
const
Size
(
100.0
,
100.0
)),
);
);
final
RenderBox
stack
=
RenderIndexedStack
(
final
RenderBox
stack
=
RenderIndexedStack
(
index:
1
,
index:
1
,
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
children:
<
RenderBox
>[
child1
,
child2
,
child3
],
children:
<
RenderBox
>[
child1
,
child2
,
child3
],
);
);
final
List
<
RenderObject
>
visitedChildren
=
<
RenderObject
>[];
final
List
<
RenderObject
>
visitedChildren
=
<
RenderObject
>[];
...
...
packages/flutter/test/rendering/table_border_test.dart
View file @
59fc9216
...
@@ -103,8 +103,10 @@ void main() {
...
@@ -103,8 +103,10 @@ void main() {
expect
(
TableBorder
.
lerp
(
tableA
,
tableB
,
2.0
),
tableC
);
expect
(
TableBorder
.
lerp
(
tableA
,
tableB
,
2.0
),
tableC
);
expect
(
TableBorder
.
lerp
(
tableB
,
tableC
,
-
1.0
),
tableA
);
expect
(
TableBorder
.
lerp
(
tableB
,
tableC
,
-
1.0
),
tableA
);
expect
(
TableBorder
.
lerp
(
tableA
,
tableC
,
0.9195
)!.
isUniform
,
isFalse
);
expect
(
TableBorder
.
lerp
(
tableA
,
tableC
,
0.9195
)!.
isUniform
,
isFalse
);
expect
(
TableBorder
.
lerp
(
tableA
,
tableC
,
0.9195
)!.
dimensions
,
expect
(
EdgeInsets
.
lerp
(
tableA
.
dimensions
,
tableC
.
dimensions
,
0.9195
));
TableBorder
.
lerp
(
tableA
,
tableC
,
0.9195
)!.
dimensions
,
EdgeInsets
.
lerp
(
tableA
.
dimensions
,
tableC
.
dimensions
,
0.9195
),
);
});
});
test
(
'TableBorder.lerp with nulls'
,
()
{
test
(
'TableBorder.lerp with nulls'
,
()
{
...
...
packages/flutter/test/rendering/table_test.dart
View file @
59fc9216
...
@@ -10,7 +10,7 @@ import 'rendering_tester.dart';
...
@@ -10,7 +10,7 @@ import 'rendering_tester.dart';
RenderBox
sizedBox
(
double
width
,
double
height
)
{
RenderBox
sizedBox
(
double
width
,
double
height
)
{
return
RenderConstrainedBox
(
return
RenderConstrainedBox
(
additionalConstraints:
BoxConstraints
.
tight
(
Size
(
width
,
height
))
additionalConstraints:
BoxConstraints
.
tight
(
Size
(
width
,
height
))
,
);
);
}
}
...
...
packages/flutter/test/rendering/transform_test.dart
View file @
59fc9216
...
@@ -145,8 +145,10 @@ void main() {
...
@@ -145,8 +145,10 @@ void main() {
expect
(
inner
.
globalToLocal
(
const
Offset
(
25.0
,
17.0
)).
dy
,
lessThan
(
10.0
));
expect
(
inner
.
globalToLocal
(
const
Offset
(
25.0
,
17.0
)).
dy
,
lessThan
(
10.0
));
expect
(
inner
.
globalToLocal
(
const
Offset
(
25.0
,
83.0
)).
dy
,
greaterThan
(
90.0
));
expect
(
inner
.
globalToLocal
(
const
Offset
(
25.0
,
83.0
)).
dy
,
greaterThan
(
90.0
));
expect
(
inner
.
globalToLocal
(
const
Offset
(
25.0
,
83.0
)).
dy
,
lessThan
(
100.0
));
expect
(
inner
.
globalToLocal
(
const
Offset
(
25.0
,
83.0
)).
dy
,
lessThan
(
100.0
));
expect
(
round
(
inner
.
globalToLocal
(
const
Offset
(
25.0
,
17.0
))).
dy
,
expect
(
equals
(
100
-
round
(
inner
.
globalToLocal
(
const
Offset
(
25.0
,
83.0
))).
dy
));
round
(
inner
.
globalToLocal
(
const
Offset
(
25.0
,
17.0
))).
dy
,
equals
(
100
-
round
(
inner
.
globalToLocal
(
const
Offset
(
25.0
,
83.0
))).
dy
),
);
});
});
test
(
'RenderTransform - perspective - localToGlobal'
,
()
{
test
(
'RenderTransform - perspective - localToGlobal'
,
()
{
...
...
packages/flutter/test/rendering/viewport_caching_test.dart
View file @
59fc9216
...
@@ -62,14 +62,15 @@ void main() {
...
@@ -62,14 +62,15 @@ void main() {
});
});
test
(
'Cache extent - nullx viewport'
,
()
async
{
test
(
'Cache extent - nullx viewport'
,
()
async
{
await
expectLater
(()
=>
RenderViewport
(
await
expectLater
(
()
=>
RenderViewport
(
crossAxisDirection:
AxisDirection
.
left
,
crossAxisDirection:
AxisDirection
.
left
,
offset:
ViewportOffset
.
zero
(),
offset:
ViewportOffset
.
zero
(),
cacheExtent:
null
,
cacheExtent:
null
,
cacheExtentStyle:
CacheExtentStyle
.
viewport
,
cacheExtentStyle:
CacheExtentStyle
.
viewport
,
children:
children
,
children:
children
,
),
),
throwsAssertionError
throwsAssertionError
,
);
);
});
});
...
...
packages/flutter/test/rendering/viewport_test.dart
View file @
59fc9216
...
@@ -1115,14 +1115,15 @@ void main() {
...
@@ -1115,14 +1115,15 @@ void main() {
controller
.
jumpTo
(
controller
.
jumpTo
(
11
*
300.0
// Preceding headers
11
*
300.0
// Preceding headers
+
200.0
// Shrinks the pinned header to minExtent
+
200.0
// Shrinks the pinned header to minExtent
+
100.0
// Obstructs the leading 100 pixels of the 11th header
+
100.0
,
// Obstructs the leading 100 pixels of the 11th header
);
);
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
tester
.
renderObject
(
find
.
byWidget
(
children
[
11
],
skipOffstage:
false
)).
showOnScreen
();
tester
.
renderObject
(
find
.
byWidget
(
children
[
11
],
skipOffstage:
false
)).
showOnScreen
();
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
controller
.
offset
,
lessThan
(
11
*
300.0
+
200.0
+
100.0
));
expect
(
controller
.
offset
,
lessThan
(
11
*
300.0
+
200.0
+
100.0
));
});
},
);
void
testFloatingHeaderShowOnScreen
({
bool
animated
=
true
,
Axis
axis
=
Axis
.
vertical
})
{
void
testFloatingHeaderShowOnScreen
({
bool
animated
=
true
,
Axis
axis
=
Axis
.
vertical
})
{
final
TickerProvider
?
vsync
=
animated
?
const
TestVSync
()
:
null
;
final
TickerProvider
?
vsync
=
animated
?
const
TestVSync
()
:
null
;
...
@@ -1185,7 +1186,7 @@ void main() {
...
@@ -1185,7 +1186,7 @@ void main() {
floating:
true
,
floating:
true
,
delegate:
_TestSliverPersistentHeaderDelegate
(
minExtent:
100
,
maxExtent:
300
,
key:
headerKey
,
vsync:
vsync
),
delegate:
_TestSliverPersistentHeaderDelegate
(
minExtent:
100
,
maxExtent:
300
,
key:
headerKey
,
vsync:
vsync
),
),
),
)
)
,
);
);
final
Finder
pinnedHeaderContent
=
find
.
byKey
(
headerKey
,
skipOffstage:
false
);
final
Finder
pinnedHeaderContent
=
find
.
byKey
(
headerKey
,
skipOffstage:
false
);
...
@@ -1217,7 +1218,8 @@ void main() {
...
@@ -1217,7 +1218,8 @@ void main() {
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
controller
.
offset
,
300.0
*
15
);
expect
(
controller
.
offset
,
300.0
*
15
);
expect
(
mainAxisExtent
(
tester
,
pinnedHeaderContent
),
300
);
expect
(
mainAxisExtent
(
tester
,
pinnedHeaderContent
),
300
);
});
},
);
testWidgets
(
testWidgets
(
'RenderViewportBase.showOnScreen but no child'
,
'RenderViewportBase.showOnScreen but no child'
,
...
@@ -1230,7 +1232,7 @@ void main() {
...
@@ -1230,7 +1232,7 @@ void main() {
floating:
true
,
floating:
true
,
delegate:
_TestSliverPersistentHeaderDelegate
(
minExtent:
100
,
maxExtent:
300
,
child:
null
,
vsync:
vsync
),
delegate:
_TestSliverPersistentHeaderDelegate
(
minExtent:
100
,
maxExtent:
300
,
child:
null
,
vsync:
vsync
),
),
),
)
)
,
);
);
final
Finder
pinnedHeaderContent
=
find
.
byKey
(
headerKey
,
skipOffstage:
false
);
final
Finder
pinnedHeaderContent
=
find
.
byKey
(
headerKey
,
skipOffstage:
false
);
...
@@ -1260,7 +1262,8 @@ void main() {
...
@@ -1260,7 +1262,8 @@ void main() {
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
controller
.
offset
,
300.0
*
15
);
expect
(
controller
.
offset
,
300.0
*
15
);
expect
(
mainAxisExtent
(
tester
,
pinnedHeaderContent
),
300
);
expect
(
mainAxisExtent
(
tester
,
pinnedHeaderContent
),
300
);
});
},
);
testWidgets
(
testWidgets
(
'RenderViewportBase.showOnScreen with maxShowOnScreenExtent '
,
'RenderViewportBase.showOnScreen with maxShowOnScreenExtent '
,
...
@@ -1278,7 +1281,7 @@ void main() {
...
@@ -1278,7 +1281,7 @@ void main() {
showOnScreenConfiguration:
const
PersistentHeaderShowOnScreenConfiguration
(
maxShowOnScreenExtent:
200
),
showOnScreenConfiguration:
const
PersistentHeaderShowOnScreenConfiguration
(
maxShowOnScreenExtent:
200
),
),
),
),
),
)
)
,
);
);
final
Finder
pinnedHeaderContent
=
find
.
byKey
(
headerKey
,
skipOffstage:
false
);
final
Finder
pinnedHeaderContent
=
find
.
byKey
(
headerKey
,
skipOffstage:
false
);
...
@@ -1320,7 +1323,8 @@ void main() {
...
@@ -1320,7 +1323,8 @@ void main() {
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
controller
.
offset
,
300.0
*
10
+
50.0
);
expect
(
controller
.
offset
,
300.0
*
10
+
50.0
);
expect
(
mainAxisExtent
(
tester
,
pinnedHeaderContent
),
250
);
expect
(
mainAxisExtent
(
tester
,
pinnedHeaderContent
),
250
);
});
},
);
testWidgets
(
testWidgets
(
'RenderViewportBase.showOnScreen with minShowOnScreenExtent '
,
'RenderViewportBase.showOnScreen with minShowOnScreenExtent '
,
...
@@ -1338,7 +1342,7 @@ void main() {
...
@@ -1338,7 +1342,7 @@ void main() {
showOnScreenConfiguration:
const
PersistentHeaderShowOnScreenConfiguration
(
minShowOnScreenExtent:
200
),
showOnScreenConfiguration:
const
PersistentHeaderShowOnScreenConfiguration
(
minShowOnScreenExtent:
200
),
),
),
),
),
)
)
,
);
);
final
Finder
pinnedHeaderContent
=
find
.
byKey
(
headerKey
,
skipOffstage:
false
);
final
Finder
pinnedHeaderContent
=
find
.
byKey
(
headerKey
,
skipOffstage:
false
);
...
@@ -1380,7 +1384,8 @@ void main() {
...
@@ -1380,7 +1384,8 @@ void main() {
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
controller
.
offset
,
300.0
*
10
+
50.0
);
expect
(
controller
.
offset
,
300.0
*
10
+
50.0
);
expect
(
mainAxisExtent
(
tester
,
pinnedHeaderContent
),
250
);
expect
(
mainAxisExtent
(
tester
,
pinnedHeaderContent
),
250
);
});
},
);
testWidgets
(
testWidgets
(
'RenderViewportBase.showOnScreen should not scroll if the rect is already visible, '
'RenderViewportBase.showOnScreen should not scroll if the rect is already visible, '
...
@@ -1394,7 +1399,7 @@ void main() {
...
@@ -1394,7 +1399,7 @@ void main() {
delegate:
_TestSliverPersistentHeaderDelegate
(
minExtent:
100
,
maxExtent:
300
,
key:
headerKey
,
vsync:
vsync
),
delegate:
_TestSliverPersistentHeaderDelegate
(
minExtent:
100
,
maxExtent:
300
,
key:
headerKey
,
vsync:
vsync
),
),
),
reversed:
true
,
reversed:
true
,
)
)
,
);
);
controller
.
jumpTo
(-
300.0
*
15
);
controller
.
jumpTo
(-
300.0
*
15
);
...
@@ -1414,14 +1419,15 @@ void main() {
...
@@ -1414,14 +1419,15 @@ void main() {
-
8
*
300.0
// Preceding headers 11 - 18, children[11]'s top edge is aligned to the leading edge.
-
8
*
300.0
// Preceding headers 11 - 18, children[11]'s top edge is aligned to the leading edge.
-
400.0
// Viewport height. children[10] (the pinned header) becomes pinned at the bottom of the screen.
-
400.0
// Viewport height. children[10] (the pinned header) becomes pinned at the bottom of the screen.
-
200.0
// Shrinks the pinned header to minExtent (100).
-
200.0
// Shrinks the pinned header to minExtent (100).
-
100.0
// Obstructs the leading 100 pixels of the 11th header
-
100.0
,
// Obstructs the leading 100 pixels of the 11th header
);
);
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
tester
.
renderObject
(
find
.
byWidget
(
children
[
9
],
skipOffstage:
false
)).
showOnScreen
();
tester
.
renderObject
(
find
.
byWidget
(
children
[
9
],
skipOffstage:
false
)).
showOnScreen
();
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
controller
.
offset
,
-
8
*
300.0
-
400.0
-
200.0
);
expect
(
controller
.
offset
,
-
8
*
300.0
-
400.0
-
200.0
);
});
},
);
});
});
}
}
...
@@ -1653,7 +1659,7 @@ void main() {
...
@@ -1653,7 +1659,7 @@ void main() {
' horizontal space for the children. In this case, consider using a
\n
'
' horizontal space for the children. In this case, consider using a
\n
'
' Row instead. Otherwise, consider using the "shrinkWrap" property
\n
'
' Row instead. Otherwise, consider using the "shrinkWrap" property
\n
'
' (or a ShrinkWrappingViewport) to size the width of the viewport
\n
'
' (or a ShrinkWrappingViewport) to size the width of the viewport
\n
'
' to the sum of the widths of its children.
\n
'
' to the sum of the widths of its children.
\n
'
,
);
);
});
});
...
@@ -1667,7 +1673,7 @@ void main() {
...
@@ -1667,7 +1673,7 @@ void main() {
' Viewports expand in the cross axis to fill their container and
\n
'
' Viewports expand in the cross axis to fill their container and
\n
'
' constrain their children to match their extent in the cross axis.
\n
'
' constrain their children to match their extent in the cross axis.
\n
'
' In this case, a vertical viewport was given an unlimited amount
\n
'
' In this case, a vertical viewport was given an unlimited amount
\n
'
' of horizontal space in which to expand.
\n
'
' of horizontal space in which to expand.
\n
'
,
);
);
});
});
...
@@ -1688,14 +1694,14 @@ void main() {
...
@@ -1688,14 +1694,14 @@ void main() {
' vertical space for the children. In this case, consider using a
\n
'
' vertical space for the children. In this case, consider using a
\n
'
' Column instead. Otherwise, consider using the "shrinkWrap"
\n
'
' Column instead. Otherwise, consider using the "shrinkWrap"
\n
'
' property (or a ShrinkWrappingViewport) to size the height of the
\n
'
' property (or a ShrinkWrappingViewport) to size the height of the
\n
'
' viewport to the sum of the heights of its children.
\n
'
' viewport to the sum of the heights of its children.
\n
'
,
);
);
});
});
});
});
test
(
'Viewport debugThrowIfNotCheckingIntrinsics() control test'
,
()
{
test
(
'Viewport debugThrowIfNotCheckingIntrinsics() control test'
,
()
{
final
RenderViewport
renderViewport
=
RenderViewport
(
final
RenderViewport
renderViewport
=
RenderViewport
(
crossAxisDirection:
AxisDirection
.
right
,
offset:
ViewportOffset
.
zero
()
crossAxisDirection:
AxisDirection
.
right
,
offset:
ViewportOffset
.
zero
()
,
);
);
late
FlutterError
error
;
late
FlutterError
error
;
try
{
try
{
...
@@ -1717,7 +1723,7 @@ void main() {
...
@@ -1717,7 +1723,7 @@ void main() {
);
);
final
RenderShrinkWrappingViewport
renderShrinkWrappingViewport
=
RenderShrinkWrappingViewport
(
final
RenderShrinkWrappingViewport
renderShrinkWrappingViewport
=
RenderShrinkWrappingViewport
(
crossAxisDirection:
AxisDirection
.
right
,
offset:
ViewportOffset
.
zero
()
crossAxisDirection:
AxisDirection
.
right
,
offset:
ViewportOffset
.
zero
()
,
);
);
try
{
try
{
renderShrinkWrappingViewport
.
computeMinIntrinsicHeight
(
0
);
renderShrinkWrappingViewport
.
computeMinIntrinsicHeight
(
0
);
...
@@ -1757,8 +1763,10 @@ void main() {
...
@@ -1757,8 +1763,10 @@ void main() {
// Children should be painted in reverse order to the list given
// Children should be painted in reverse order to the list given
expect
(
renderViewport
.
childrenInPaintOrder
,
equals
(
children
.
reversed
));
expect
(
renderViewport
.
childrenInPaintOrder
,
equals
(
children
.
reversed
));
// childrenInPaintOrder should be reverse of childrenInHitTestOrder
// childrenInPaintOrder should be reverse of childrenInHitTestOrder
expect
(
renderViewport
.
childrenInPaintOrder
,
expect
(
equals
(
renderViewport
.
childrenInHitTestOrder
.
toList
().
reversed
));
renderViewport
.
childrenInPaintOrder
,
equals
(
renderViewport
.
childrenInHitTestOrder
.
toList
().
reversed
),
);
});
});
test
(
'RenderShrinkWrappingViewport'
,
()
async
{
test
(
'RenderShrinkWrappingViewport'
,
()
async
{
...
@@ -1778,8 +1786,10 @@ void main() {
...
@@ -1778,8 +1786,10 @@ void main() {
// Children should be painted in reverse order to the list given
// Children should be painted in reverse order to the list given
expect
(
renderViewport
.
childrenInPaintOrder
,
equals
(
children
.
reversed
));
expect
(
renderViewport
.
childrenInPaintOrder
,
equals
(
children
.
reversed
));
// childrenInPaintOrder should be reverse of childrenInHitTestOrder
// childrenInPaintOrder should be reverse of childrenInHitTestOrder
expect
(
renderViewport
.
childrenInPaintOrder
,
expect
(
equals
(
renderViewport
.
childrenInHitTestOrder
.
toList
().
reversed
));
renderViewport
.
childrenInPaintOrder
,
equals
(
renderViewport
.
childrenInHitTestOrder
.
toList
().
reversed
),
);
});
});
});
});
...
@@ -1797,10 +1807,11 @@ void main() {
...
@@ -1797,10 +1807,11 @@ void main() {
GridView
(
GridView
(
shrinkWrap:
true
,
shrinkWrap:
true
,
gridDelegate:
const
SliverGridDelegateWithFixedCrossAxisCount
(
gridDelegate:
const
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
3
,
crossAxisCount:
3
,
childAspectRatio:
3
,
childAspectRatio:
3
,
mainAxisSpacing:
3
,
mainAxisSpacing:
3
,
crossAxisSpacing:
3
),
crossAxisSpacing:
3
,
),
children:
const
<
Widget
>[
children:
const
<
Widget
>[
Text
(
'a'
),
Text
(
'a'
),
Text
(
'b'
),
Text
(
'b'
),
...
...
packages/flutter/test/rendering/wrap_test.dart
View file @
59fc9216
...
@@ -23,7 +23,7 @@ void main() {
...
@@ -23,7 +23,7 @@ void main() {
' spacing: 0.0
\n
'
' spacing: 0.0
\n
'
' runAlignment: start
\n
'
' runAlignment: start
\n
'
' runSpacing: 0.0
\n
'
' runSpacing: 0.0
\n
'
' crossAxisAlignment: 0.0
\n
'
' crossAxisAlignment: 0.0
\n
'
,
),
),
);
);
});
});
...
@@ -103,7 +103,7 @@ void main() {
...
@@ -103,7 +103,7 @@ void main() {
style:
TextStyle
(
fontSize:
lineHeight
),
style:
TextStyle
(
fontSize:
lineHeight
),
),
),
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
)
)
,
),
),
);
);
...
...
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