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
5b72a2fd
Commit
5b72a2fd
authored
Oct 13, 2015
by
Jason Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix warnings seen when running skyanalyzer in strong mode
parent
6e91cfa4
Changes
39
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
219 additions
and
206 deletions
+219
-206
sector_layout.dart
examples/rendering/sector_layout.dart
+0
-1
scrollbar_painter.dart
packages/flutter/lib/src/material/scrollbar_painter.dart
+0
-1
insert_before_test.dart
packages/unit/test/engine/insert_before_test.dart
+3
-3
replace_child_test.dart
packages/unit/test/engine/replace_child_test.dart
+18
-18
long_press_test.dart
packages/unit/test/gestures/long_press_test.dart
+3
-3
show_press_test.dart
packages/unit/test/gestures/show_press_test.dart
+2
-2
box_test.dart
packages/unit/test/rendering/box_test.dart
+2
-2
flex_test.dart
packages/unit/test/rendering/flex_test.dart
+7
-5
grid_test.dart
packages/unit/test/rendering/grid_test.dart
+3
-3
stack_test.dart
packages/unit/test/rendering/stack_test.dart
+1
-1
block_test.dart
packages/unit/test/widget/block_test.dart
+2
-2
center_test.dart
packages/unit/test/widget/center_test.dart
+1
-1
coordinates_test.dart
packages/unit/test/widget/coordinates_test.dart
+1
-1
date_picker_test.dart
packages/unit/test/widget/date_picker_test.dart
+1
-1
dismissable_test.dart
packages/unit/test/widget/dismissable_test.dart
+9
-9
draggable_test.dart
packages/unit/test/widget/draggable_test.dart
+2
-2
drawer_test.dart
packages/unit/test/widget/drawer_test.dart
+2
-2
duplicate_key_test.dart
packages/unit/test/widget/duplicate_key_test.dart
+2
-2
flex_test.dart
packages/unit/test/widget/flex_test.dart
+2
-2
focus_test.dart
packages/unit/test/widget/focus_test.dart
+1
-1
homogeneous_viewport_test.dart
packages/unit/test/widget/homogeneous_viewport_test.dart
+1
-1
input_test.dart
packages/unit/test/widget/input_test.dart
+1
-1
mixed_viewport_test.dart
packages/unit/test/widget/mixed_viewport_test.dart
+1
-1
multichild_test.dart
packages/unit/test/widget/multichild_test.dart
+47
-46
parent_data_test.dart
packages/unit/test/widget/parent_data_test.dart
+28
-28
progress_indicator_test.dart
packages/unit/test/widget/progress_indicator_test.dart
+2
-2
render_object_widget_test.dart
packages/unit/test/widget/render_object_widget_test.dart
+6
-6
reparent_state_test.dart
packages/unit/test/widget/reparent_state_test.dart
+3
-3
set_state_3_test.dart
packages/unit/test/widget/set_state_3_test.dart
+1
-1
shader_mask_test.dart
packages/unit/test/widget/shader_mask_test.dart
+2
-2
size_observer_test.dart
packages/unit/test/widget/size_observer_test.dart
+5
-5
snack_bar_test.dart
packages/unit/test/widget/snack_bar_test.dart
+1
-1
snap_scrolling_test.dart
packages/unit/test/widget/snap_scrolling_test.dart
+1
-1
stack_test.dart
packages/unit/test/widget/stack_test.dart
+44
-33
stateful_component_test.dart
packages/unit/test/widget/stateful_component_test.dart
+1
-1
syncing_test.dart
packages/unit/test/widget/syncing_test.dart
+4
-4
test_widgets.dart
packages/unit/test/widget/test_widgets.dart
+1
-1
transform_test.dart
packages/unit/test/widget/transform_test.dart
+3
-3
widget_tester.dart
packages/unit/test/widget/widget_tester.dart
+5
-4
No files found.
examples/rendering/sector_layout.dart
View file @
5b72a2fd
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:async'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'lib/sector_layout.dart'
;
import
'lib/sector_layout.dart'
;
...
...
packages/flutter/lib/src/material/scrollbar_painter.dart
View file @
5b72a2fd
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:async'
;
import
'dart:ui'
as
ui
;
import
'package:flutter/animation.dart'
;
import
'package:flutter/animation.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
...
...
packages/unit/test/engine/insert_before_test.dart
View file @
5b72a2fd
...
@@ -6,15 +6,15 @@ void main() {
...
@@ -6,15 +6,15 @@ void main() {
Document
document
=
new
Document
();
Document
document
=
new
Document
();
test
(
"should throw with invalid arguments"
,
()
{
test
(
"should throw with invalid arguments"
,
()
{
var
parent
=
document
.
createElement
(
"div"
);
Element
parent
=
document
.
createElement
(
"div"
);
var
child
=
document
.
createElement
(
"div"
);
Element
child
=
document
.
createElement
(
"div"
);
parent
.
appendChild
(
child
);
parent
.
appendChild
(
child
);
// TODO(eseidel): This should throw!
// TODO(eseidel): This should throw!
// expect(() {
// expect(() {
// parent.insertBefore([parent]);
// parent.insertBefore([parent]);
// }, throws);
// }, throws);
expect
(()
{
expect
(()
{
child
.
insertBefore
([
parent
]);
child
.
insertBefore
(
<
Node
>
[
parent
]);
},
throws
);
},
throws
);
});
});
...
...
packages/unit/test/engine/replace_child_test.dart
View file @
5b72a2fd
...
@@ -5,36 +5,36 @@ import 'package:test/test.dart';
...
@@ -5,36 +5,36 @@ import 'package:test/test.dart';
import
'dom_utils.dart'
;
import
'dom_utils.dart'
;
void
main
(
)
{
void
main
(
)
{
var
document
=
new
Document
();
Document
document
=
new
Document
();
test
(
"should replace elements"
,
()
{
test
(
"should replace elements"
,
()
{
var
parent
=
document
.
createElement
(
"div"
);
Element
parent
=
document
.
createElement
(
"div"
);
var
oldChild
=
parent
.
appendChild
(
document
.
createElement
(
"div"
));
Element
oldChild
=
parent
.
appendChild
(
document
.
createElement
(
"div"
));
var
newChild
=
document
.
createElement
(
"div"
);
Element
newChild
=
document
.
createElement
(
"div"
);
oldChild
.
replaceWith
([
newChild
]);
oldChild
.
replaceWith
(
<
Node
>
[
newChild
]);
expect
(
oldChild
.
parentNode
,
isNull
);
expect
(
oldChild
.
parentNode
,
isNull
);
expect
(
newChild
.
parentNode
,
equals
(
parent
));
expect
(
newChild
.
parentNode
,
equals
(
parent
));
});
});
test
(
"should replace text"
,
()
{
test
(
"should replace text"
,
()
{
var
parent
=
document
.
createElement
(
"div"
);
Element
parent
=
document
.
createElement
(
"div"
);
var
oldChild
=
parent
.
appendChild
(
document
.
createText
(
" it's a text "
));
Node
oldChild
=
parent
.
appendChild
(
document
.
createText
(
" it's a text "
));
var
newChild
=
document
.
createElement
(
"div"
);
Element
newChild
=
document
.
createElement
(
"div"
);
oldChild
.
replaceWith
([
newChild
]);
oldChild
.
replaceWith
(
<
Node
>
[
newChild
]);
expect
(
oldChild
.
parentNode
,
isNull
);
expect
(
oldChild
.
parentNode
,
isNull
);
expect
(
newChild
.
parentNode
,
equals
(
parent
));
expect
(
newChild
.
parentNode
,
equals
(
parent
));
});
});
test
(
"should replace children with a fragment"
,
()
{
test
(
"should replace children with a fragment"
,
()
{
var
fragment
=
document
.
createDocumentFragment
();
DocumentFragment
fragment
=
document
.
createDocumentFragment
();
var
child1
=
fragment
.
appendChild
(
document
.
createElement
(
"div"
));
Element
child1
=
fragment
.
appendChild
(
document
.
createElement
(
"div"
));
var
child2
=
fragment
.
appendChild
(
document
.
createText
(
" text "
));
Node
child2
=
fragment
.
appendChild
(
document
.
createText
(
" text "
));
var
child3
=
fragment
.
appendChild
(
document
.
createText
(
" "
));
Node
child3
=
fragment
.
appendChild
(
document
.
createText
(
" "
));
var
child4
=
fragment
.
appendChild
(
document
.
createElement
(
"div"
));
Element
child4
=
fragment
.
appendChild
(
document
.
createElement
(
"div"
));
var
parent
=
document
.
createElement
(
"div"
);
Element
parent
=
document
.
createElement
(
"div"
);
var
oldChild
=
parent
.
appendChild
(
document
.
createElement
(
"div"
));
Element
oldChild
=
parent
.
appendChild
(
document
.
createElement
(
"div"
));
var
lastChild
=
parent
.
appendChild
(
document
.
createElement
(
"div"
));
Element
lastChild
=
parent
.
appendChild
(
document
.
createElement
(
"div"
));
oldChild
.
replaceWith
([
fragment
]);
oldChild
.
replaceWith
(
<
Node
>
[
fragment
]);
expect
(
child1
.
parentNode
,
equals
(
parent
));
expect
(
child1
.
parentNode
,
equals
(
parent
));
expect
(
child2
.
parentNode
,
equals
(
parent
));
expect
(
child2
.
parentNode
,
equals
(
parent
));
expect
(
child3
.
parentNode
,
equals
(
parent
));
expect
(
child3
.
parentNode
,
equals
(
parent
));
...
...
packages/unit/test/gestures/long_press_test.dart
View file @
5b72a2fd
...
@@ -26,7 +26,7 @@ void main() {
...
@@ -26,7 +26,7 @@ void main() {
longPressRecognized
=
true
;
longPressRecognized
=
true
;
};
};
new
FakeAsync
().
run
((
async
)
{
new
FakeAsync
().
run
((
FakeAsync
async
)
{
longPress
.
addPointer
(
down
);
longPress
.
addPointer
(
down
);
GestureArena
.
instance
.
close
(
5
);
GestureArena
.
instance
.
close
(
5
);
expect
(
longPressRecognized
,
isFalse
);
expect
(
longPressRecognized
,
isFalse
);
...
@@ -50,7 +50,7 @@ void main() {
...
@@ -50,7 +50,7 @@ void main() {
longPressRecognized
=
true
;
longPressRecognized
=
true
;
};
};
new
FakeAsync
().
run
((
async
)
{
new
FakeAsync
().
run
((
FakeAsync
async
)
{
longPress
.
addPointer
(
down
);
longPress
.
addPointer
(
down
);
GestureArena
.
instance
.
close
(
5
);
GestureArena
.
instance
.
close
(
5
);
expect
(
longPressRecognized
,
isFalse
);
expect
(
longPressRecognized
,
isFalse
);
...
@@ -82,7 +82,7 @@ void main() {
...
@@ -82,7 +82,7 @@ void main() {
longPressRecognized
=
true
;
longPressRecognized
=
true
;
};
};
new
FakeAsync
().
run
((
async
)
{
new
FakeAsync
().
run
((
FakeAsync
async
)
{
showPress
.
addPointer
(
down
);
showPress
.
addPointer
(
down
);
longPress
.
addPointer
(
down
);
longPress
.
addPointer
(
down
);
GestureArena
.
instance
.
close
(
5
);
GestureArena
.
instance
.
close
(
5
);
...
...
packages/unit/test/gestures/show_press_test.dart
View file @
5b72a2fd
...
@@ -26,7 +26,7 @@ void main() {
...
@@ -26,7 +26,7 @@ void main() {
showPressRecognized
=
true
;
showPressRecognized
=
true
;
};
};
new
FakeAsync
().
run
((
async
)
{
new
FakeAsync
().
run
((
FakeAsync
async
)
{
showPress
.
addPointer
(
down
);
showPress
.
addPointer
(
down
);
GestureArena
.
instance
.
close
(
5
);
GestureArena
.
instance
.
close
(
5
);
expect
(
showPressRecognized
,
isFalse
);
expect
(
showPressRecognized
,
isFalse
);
...
@@ -48,7 +48,7 @@ void main() {
...
@@ -48,7 +48,7 @@ void main() {
showPressRecognized
=
true
;
showPressRecognized
=
true
;
};
};
new
FakeAsync
().
run
((
async
)
{
new
FakeAsync
().
run
((
FakeAsync
async
)
{
showPress
.
addPointer
(
down
);
showPress
.
addPointer
(
down
);
GestureArena
.
instance
.
close
(
5
);
GestureArena
.
instance
.
close
(
5
);
expect
(
showPressRecognized
,
isFalse
);
expect
(
showPressRecognized
,
isFalse
);
...
...
packages/unit/test/rendering/box_test.dart
View file @
5b72a2fd
...
@@ -11,7 +11,7 @@ void main() {
...
@@ -11,7 +11,7 @@ void main() {
backgroundColor:
const
Color
(
0xFF00FF00
),
backgroundColor:
const
Color
(
0xFF00FF00
),
gradient:
new
RadialGradient
(
gradient:
new
RadialGradient
(
center:
Point
.
origin
,
radius:
500.0
,
center:
Point
.
origin
,
radius:
500.0
,
colors:
[
Colors
.
yellow
[
500
],
Colors
.
blue
[
500
]]),
colors:
<
Color
>
[
Colors
.
yellow
[
500
],
Colors
.
blue
[
500
]]),
boxShadow:
shadows
[
3
])
boxShadow:
shadows
[
3
])
);
);
layout
(
root
);
layout
(
root
);
...
@@ -34,7 +34,7 @@ void main() {
...
@@ -34,7 +34,7 @@ void main() {
child:
inner
child:
inner
);
);
RenderBox
flex
=
new
RenderFlex
(
RenderBox
flex
=
new
RenderFlex
(
children:
[
padding
],
children:
<
RenderBox
>
[
padding
],
direction:
FlexDirection
.
vertical
,
direction:
FlexDirection
.
vertical
,
alignItems:
FlexAlignItems
.
stretch
alignItems:
FlexAlignItems
.
stretch
);
);
...
...
packages/unit/test/rendering/flex_test.dart
View file @
5b72a2fd
...
@@ -6,7 +6,7 @@ import 'rendering_tester.dart';
...
@@ -6,7 +6,7 @@ import 'rendering_tester.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'Overconstrained flex'
,
()
{
test
(
'Overconstrained flex'
,
()
{
RenderDecoratedBox
box
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
());
RenderDecoratedBox
box
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
());
RenderFlex
flex
=
new
RenderFlex
(
children:
[
box
]);
RenderFlex
flex
=
new
RenderFlex
(
children:
<
RenderBox
>[
box
]);
layout
(
flex
,
constraints:
const
BoxConstraints
(
layout
(
flex
,
constraints:
const
BoxConstraints
(
minWidth:
200.0
,
maxWidth:
100.0
,
minHeight:
200.0
,
maxHeight:
100.0
)
minWidth:
200.0
,
maxWidth:
100.0
,
minHeight:
200.0
,
maxHeight:
100.0
)
);
);
...
@@ -24,7 +24,7 @@ void main() {
...
@@ -24,7 +24,7 @@ void main() {
test
(
'Parent data'
,
()
{
test
(
'Parent data'
,
()
{
RenderDecoratedBox
box1
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
());
RenderDecoratedBox
box1
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
());
RenderDecoratedBox
box2
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
());
RenderDecoratedBox
box2
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
());
RenderFlex
flex
=
new
RenderFlex
(
children:
[
box1
,
box2
]);
RenderFlex
flex
=
new
RenderFlex
(
children:
<
RenderBox
>[
box1
,
box2
]);
layout
(
flex
,
constraints:
const
BoxConstraints
(
layout
(
flex
,
constraints:
const
BoxConstraints
(
minWidth:
0.0
,
maxWidth:
100.0
,
minHeight:
0.0
,
maxHeight:
100.0
)
minWidth:
0.0
,
maxWidth:
100.0
,
minHeight:
0.0
,
maxHeight:
100.0
)
);
);
...
@@ -33,7 +33,8 @@ void main() {
...
@@ -33,7 +33,8 @@ void main() {
expect
(
box2
.
size
.
width
,
equals
(
0.0
));
expect
(
box2
.
size
.
width
,
equals
(
0.0
));
expect
(
box2
.
size
.
height
,
equals
(
0.0
));
expect
(
box2
.
size
.
height
,
equals
(
0.0
));
box2
.
parentData
.
flex
=
1
;
final
FlexParentData
box2ParentData
=
box2
.
parentData
;
box2ParentData
.
flex
=
1
;
flex
.
markNeedsLayout
();
flex
.
markNeedsLayout
();
pumpFrame
();
pumpFrame
();
expect
(
box1
.
size
.
width
,
equals
(
0.0
));
expect
(
box1
.
size
.
width
,
equals
(
0.0
));
...
@@ -47,8 +48,9 @@ void main() {
...
@@ -47,8 +48,9 @@ void main() {
RenderDecoratedBox
box2
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
());
RenderDecoratedBox
box2
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
());
RenderFlex
flex
=
new
RenderFlex
();
RenderFlex
flex
=
new
RenderFlex
();
flex
.
setupParentData
(
box2
);
flex
.
setupParentData
(
box2
);
box2
.
parentData
.
flex
=
2
;
final
FlexParentData
box2ParentData
=
box2
.
parentData
;
flex
.
addAll
([
box1
,
box2
]);
box2ParentData
.
flex
=
2
;
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
)
);
);
...
...
packages/unit/test/rendering/grid_test.dart
View file @
5b72a2fd
...
@@ -5,7 +5,7 @@ import 'rendering_tester.dart';
...
@@ -5,7 +5,7 @@ import 'rendering_tester.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'Basic grid layout test'
,
()
{
test
(
'Basic grid layout test'
,
()
{
List
<
RenderBox
>
children
=
[
List
<
RenderBox
>
children
=
<
RenderBox
>
[
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
()),
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
()),
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
()),
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
()),
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
()),
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
()),
...
@@ -15,7 +15,7 @@ void main() {
...
@@ -15,7 +15,7 @@ void main() {
RenderGrid
grid
=
new
RenderGrid
(
children:
children
,
maxChildExtent:
100.0
);
RenderGrid
grid
=
new
RenderGrid
(
children:
children
,
maxChildExtent:
100.0
);
layout
(
grid
,
constraints:
const
BoxConstraints
(
maxWidth:
200.0
));
layout
(
grid
,
constraints:
const
BoxConstraints
(
maxWidth:
200.0
));
children
.
forEach
((
child
)
{
children
.
forEach
((
RenderBox
child
)
{
expect
(
child
.
size
.
width
,
equals
(
100.0
),
reason:
"child width"
);
expect
(
child
.
size
.
width
,
equals
(
100.0
),
reason:
"child width"
);
expect
(
child
.
size
.
height
,
equals
(
100.0
),
reason:
"child height"
);
expect
(
child
.
size
.
height
,
equals
(
100.0
),
reason:
"child height"
);
});
});
...
@@ -29,7 +29,7 @@ void main() {
...
@@ -29,7 +29,7 @@ void main() {
pumpFrame
();
pumpFrame
();
children
.
forEach
((
child
)
{
children
.
forEach
((
RenderBox
child
)
{
expect
(
child
.
size
.
width
,
equals
(
50.0
),
reason:
"child width"
);
expect
(
child
.
size
.
width
,
equals
(
50.0
),
reason:
"child width"
);
expect
(
child
.
size
.
height
,
equals
(
50.0
),
reason:
"child height"
);
expect
(
child
.
size
.
height
,
equals
(
50.0
),
reason:
"child height"
);
});
});
...
...
packages/unit/test/rendering/stack_test.dart
View file @
5b72a2fd
...
@@ -19,7 +19,7 @@ void main() {
...
@@ -19,7 +19,7 @@ void main() {
backgroundColor:
const
Color
(
0xFFFF0000
)
backgroundColor:
const
Color
(
0xFFFF0000
)
));
));
RenderBox
stack
=
new
RenderStack
(
children:
[
red
,
green
]);
RenderBox
stack
=
new
RenderStack
(
children:
<
RenderBox
>
[
red
,
green
]);
(
green
.
parentData
as
StackParentData
)
(
green
.
parentData
as
StackParentData
)
..
top
=
0.0
..
top
=
0.0
..
right
=
0.0
..
right
=
0.0
...
...
packages/unit/test/widget/block_test.dart
View file @
5b72a2fd
...
@@ -10,7 +10,7 @@ void main() {
...
@@ -10,7 +10,7 @@ void main() {
test
(
'Cannot scroll a non-overflowing block'
,
()
{
test
(
'Cannot scroll a non-overflowing block'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Block
([
new
Block
(
<
Widget
>
[
new
Container
(
new
Container
(
height:
200.0
,
// less than 600, the height of the test area
height:
200.0
,
// less than 600, the height of the test area
child:
new
Text
(
'Hello'
)
child:
new
Text
(
'Hello'
)
...
@@ -37,7 +37,7 @@ void main() {
...
@@ -37,7 +37,7 @@ void main() {
test
(
'Can scroll an overflowing block'
,
()
{
test
(
'Can scroll an overflowing block'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Block
([
new
Block
(
<
Widget
>
[
new
Container
(
new
Container
(
height:
2000.0
,
// more than 600, the height of the test area
height:
2000.0
,
// more than 600, the height of the test area
child:
new
Text
(
'Hello'
)
child:
new
Text
(
'Hello'
)
...
...
packages/unit/test/widget/center_test.dart
View file @
5b72a2fd
...
@@ -6,7 +6,7 @@ import 'widget_tester.dart';
...
@@ -6,7 +6,7 @@ import 'widget_tester.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'Can be placed in an infinte box'
,
()
{
test
(
'Can be placed in an infinte box'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
Block
([
new
Center
()]));
tester
.
pumpWidget
(
new
Block
(
<
Widget
>
[
new
Center
()]));
});
});
});
});
}
}
packages/unit/test/widget/coordinates_test.dart
View file @
5b72a2fd
...
@@ -11,7 +11,7 @@ void main() {
...
@@ -11,7 +11,7 @@ void main() {
Key
keyB
=
new
GlobalKey
();
Key
keyB
=
new
GlobalKey
();
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Positioned
(
new
Positioned
(
top:
100.0
,
top:
100.0
,
left:
100.0
,
left:
100.0
,
...
...
packages/unit/test/widget/date_picker_test.dart
View file @
5b72a2fd
...
@@ -8,7 +8,7 @@ void main() {
...
@@ -8,7 +8,7 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
DateTime
currentValue
;
DateTime
currentValue
;
Widget
widget
=
new
Block
([
Widget
widget
=
new
Block
(
<
Widget
>
[
new
DatePicker
(
new
DatePicker
(
selectedDate:
new
DateTime
.
utc
(
2015
,
6
,
9
,
7
,
12
),
selectedDate:
new
DateTime
.
utc
(
2015
,
6
,
9
,
7
,
12
),
firstDate:
new
DateTime
.
utc
(
2013
),
firstDate:
new
DateTime
.
utc
(
2013
),
...
...
packages/unit/test/widget/dismissable_test.dart
View file @
5b72a2fd
...
@@ -8,7 +8,7 @@ import 'widget_tester.dart';
...
@@ -8,7 +8,7 @@ import 'widget_tester.dart';
const
double
itemExtent
=
100.0
;
const
double
itemExtent
=
100.0
;
ScrollDirection
scrollDirection
=
ScrollDirection
.
vertical
;
ScrollDirection
scrollDirection
=
ScrollDirection
.
vertical
;
DismissDirection
dismissDirection
=
DismissDirection
.
horizontal
;
DismissDirection
dismissDirection
=
DismissDirection
.
horizontal
;
List
<
int
>
dismissedItems
=
[];
List
<
int
>
dismissedItems
=
<
int
>
[];
void
handleOnResized
(
item
)
{
void
handleOnResized
(
item
)
{
expect
(
dismissedItems
.
contains
(
item
),
isFalse
);
expect
(
dismissedItems
.
contains
(
item
),
isFalse
);
...
@@ -117,7 +117,7 @@ void main() {
...
@@ -117,7 +117,7 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
ScrollDirection
.
vertical
;
scrollDirection
=
ScrollDirection
.
vertical
;
dismissDirection
=
DismissDirection
.
horizontal
;
dismissDirection
=
DismissDirection
.
horizontal
;
dismissedItems
=
[];
dismissedItems
=
<
int
>
[];
tester
.
pumpWidget
(
widgetBuilder
());
tester
.
pumpWidget
(
widgetBuilder
());
expect
(
dismissedItems
,
isEmpty
);
expect
(
dismissedItems
,
isEmpty
);
...
@@ -136,7 +136,7 @@ void main() {
...
@@ -136,7 +136,7 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
ScrollDirection
.
horizontal
;
scrollDirection
=
ScrollDirection
.
horizontal
;
dismissDirection
=
DismissDirection
.
vertical
;
dismissDirection
=
DismissDirection
.
vertical
;
dismissedItems
=
[];
dismissedItems
=
<
int
>
[];
tester
.
pumpWidget
(
widgetBuilder
());
tester
.
pumpWidget
(
widgetBuilder
());
expect
(
dismissedItems
,
isEmpty
);
expect
(
dismissedItems
,
isEmpty
);
...
@@ -155,7 +155,7 @@ void main() {
...
@@ -155,7 +155,7 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
ScrollDirection
.
vertical
;
scrollDirection
=
ScrollDirection
.
vertical
;
dismissDirection
=
DismissDirection
.
left
;
dismissDirection
=
DismissDirection
.
left
;
dismissedItems
=
[];
dismissedItems
=
<
int
>
[];
tester
.
pumpWidget
(
widgetBuilder
());
tester
.
pumpWidget
(
widgetBuilder
());
expect
(
dismissedItems
,
isEmpty
);
expect
(
dismissedItems
,
isEmpty
);
...
@@ -174,7 +174,7 @@ void main() {
...
@@ -174,7 +174,7 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
ScrollDirection
.
vertical
;
scrollDirection
=
ScrollDirection
.
vertical
;
dismissDirection
=
DismissDirection
.
right
;
dismissDirection
=
DismissDirection
.
right
;
dismissedItems
=
[];
dismissedItems
=
<
int
>
[];
tester
.
pumpWidget
(
widgetBuilder
());
tester
.
pumpWidget
(
widgetBuilder
());
expect
(
dismissedItems
,
isEmpty
);
expect
(
dismissedItems
,
isEmpty
);
...
@@ -193,7 +193,7 @@ void main() {
...
@@ -193,7 +193,7 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
ScrollDirection
.
horizontal
;
scrollDirection
=
ScrollDirection
.
horizontal
;
dismissDirection
=
DismissDirection
.
up
;
dismissDirection
=
DismissDirection
.
up
;
dismissedItems
=
[];
dismissedItems
=
<
int
>
[];
tester
.
pumpWidget
(
widgetBuilder
());
tester
.
pumpWidget
(
widgetBuilder
());
expect
(
dismissedItems
,
isEmpty
);
expect
(
dismissedItems
,
isEmpty
);
...
@@ -212,7 +212,7 @@ void main() {
...
@@ -212,7 +212,7 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
ScrollDirection
.
horizontal
;
scrollDirection
=
ScrollDirection
.
horizontal
;
dismissDirection
=
DismissDirection
.
down
;
dismissDirection
=
DismissDirection
.
down
;
dismissedItems
=
[];
dismissedItems
=
<
int
>
[];
tester
.
pumpWidget
(
widgetBuilder
());
tester
.
pumpWidget
(
widgetBuilder
());
expect
(
dismissedItems
,
isEmpty
);
expect
(
dismissedItems
,
isEmpty
);
...
@@ -233,7 +233,7 @@ void main() {
...
@@ -233,7 +233,7 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
ScrollDirection
.
horizontal
;
scrollDirection
=
ScrollDirection
.
horizontal
;
dismissDirection
=
DismissDirection
.
down
;
dismissDirection
=
DismissDirection
.
down
;
dismissedItems
=
[];
dismissedItems
=
<
int
>
[];
tester
.
pumpWidget
(
widgetBuilder
());
tester
.
pumpWidget
(
widgetBuilder
());
Element
itemElement
=
tester
.
findText
(
'0'
);
Element
itemElement
=
tester
.
findText
(
'0'
);
...
@@ -261,7 +261,7 @@ void main() {
...
@@ -261,7 +261,7 @@ void main() {
child:
new
Container
(
child:
new
Container
(
width:
100.0
,
width:
100.0
,
height:
1000.0
,
height:
1000.0
,
child:
new
Column
([
child:
new
Column
(
<
Widget
>
[
new
Test1215DismissableComponent
(
'1'
),
new
Test1215DismissableComponent
(
'1'
),
new
Test1215DismissableComponent
(
'2'
)
new
Test1215DismissableComponent
(
'2'
)
])
])
...
...
packages/unit/test/widget/draggable_test.dart
View file @
5b72a2fd
...
@@ -12,8 +12,8 @@ void main() {
...
@@ -12,8 +12,8 @@ void main() {
List
accepted
=
[];
List
accepted
=
[];
tester
.
pumpWidget
(
new
Navigator
(
tester
.
pumpWidget
(
new
Navigator
(
routes:
{
routes:
<
String
,
RouteBuilder
>
{
'/'
:
(
RouteArguments
args
)
{
return
new
Column
([
'/'
:
(
RouteArguments
args
)
{
return
new
Column
(
<
Widget
>
[
new
Draggable
(
new
Draggable
(
navigator:
args
.
navigator
,
navigator:
args
.
navigator
,
data:
1
,
data:
1
,
...
...
packages/unit/test/widget/drawer_test.dart
View file @
5b72a2fd
...
@@ -11,7 +11,7 @@ void main() {
...
@@ -11,7 +11,7 @@ void main() {
NavigatorState
navigator
;
NavigatorState
navigator
;
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
MaterialApp
(
new
MaterialApp
(
routes:
{
routes:
<
String
,
RouteBuilder
>
{
'/'
:
(
RouteArguments
args
)
{
'/'
:
(
RouteArguments
args
)
{
navigator
=
args
.
navigator
;
navigator
=
args
.
navigator
;
new
Container
();
new
Container
();
...
@@ -40,7 +40,7 @@ void main() {
...
@@ -40,7 +40,7 @@ void main() {
tester
.
pumpWidget
(
new
Container
());
// throw away the old App and its Navigator
tester
.
pumpWidget
(
new
Container
());
// throw away the old App and its Navigator
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
MaterialApp
(
new
MaterialApp
(
routes:
{
routes:
<
String
,
RouteBuilder
>
{
'/'
:
(
RouteArguments
args
)
{
'/'
:
(
RouteArguments
args
)
{
navigator
=
args
.
navigator
;
navigator
=
args
.
navigator
;
new
Container
();
new
Container
();
...
...
packages/unit/test/widget/duplicate_key_test.dart
View file @
5b72a2fd
...
@@ -8,7 +8,7 @@ class Item {
...
@@ -8,7 +8,7 @@ class Item {
GlobalKey
key2
=
new
GlobalKey
();
GlobalKey
key2
=
new
GlobalKey
();
String
toString
()
=>
"Item(
$key1
,
$key2
)"
;
String
toString
()
=>
"Item(
$key1
,
$key2
)"
;
}
}
List
<
Item
>
items
=
[
new
Item
(),
new
Item
()];
List
<
Item
>
items
=
<
Item
>
[
new
Item
(),
new
Item
()];
class
StatefulLeaf
extends
StatefulComponent
{
class
StatefulLeaf
extends
StatefulComponent
{
StatefulLeaf
({
GlobalKey
key
})
:
super
(
key:
key
);
StatefulLeaf
({
GlobalKey
key
})
:
super
(
key:
key
);
...
@@ -34,7 +34,7 @@ class KeyedWrapper extends StatelessComponent {
...
@@ -34,7 +34,7 @@ class KeyedWrapper extends StatelessComponent {
}
}
Widget
builder
(
)
{
Widget
builder
(
)
{
return
new
Column
([
return
new
Column
(
<
Widget
>
[
new
KeyedWrapper
(
items
[
1
].
key1
,
items
[
1
].
key2
),
new
KeyedWrapper
(
items
[
1
].
key1
,
items
[
1
].
key2
),
new
KeyedWrapper
(
items
[
0
].
key1
,
items
[
0
].
key2
)
new
KeyedWrapper
(
items
[
0
].
key1
,
items
[
0
].
key2
)
]);
]);
...
...
packages/unit/test/widget/flex_test.dart
View file @
5b72a2fd
...
@@ -12,11 +12,11 @@ void main() {
...
@@ -12,11 +12,11 @@ void main() {
decoration:
const
BoxDecoration
(
decoration:
const
BoxDecoration
(
backgroundColor:
const
Color
(
0xFF00FF00
)
backgroundColor:
const
Color
(
0xFF00FF00
)
),
),
child:
new
Stack
([
child:
new
Stack
(
<
Widget
>
[
new
Positioned
(
new
Positioned
(
top:
10.0
,
top:
10.0
,
left:
10.0
,
left:
10.0
,
child:
new
Column
([
child:
new
Column
(
<
Widget
>
[
new
GestureDetector
(
new
GestureDetector
(
onTap:
()
{
onTap:
()
{
didReceiveTap
=
true
;
didReceiveTap
=
true
;
...
...
packages/unit/test/widget/focus_test.dart
View file @
5b72a2fd
...
@@ -23,7 +23,7 @@ void main() {
...
@@ -23,7 +23,7 @@ void main() {
GlobalKey
keyB
=
new
GlobalKey
();
GlobalKey
keyB
=
new
GlobalKey
();
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Focus
(
new
Focus
(
child:
new
Column
([
child:
new
Column
(
<
Widget
>
[
// reverse these when you fix https://github.com/flutter/engine/issues/1495
// reverse these when you fix https://github.com/flutter/engine/issues/1495
new
TestFocusable
(
'b'
,
'B FOCUSED'
,
keyB
),
new
TestFocusable
(
'b'
,
'B FOCUSED'
,
keyB
),
new
TestFocusable
(
'a'
,
'A FOCUSED'
,
keyA
),
new
TestFocusable
(
'a'
,
'A FOCUSED'
,
keyA
),
...
...
packages/unit/test/widget/homogeneous_viewport_test.dart
View file @
5b72a2fd
...
@@ -36,7 +36,7 @@ void main() {
...
@@ -36,7 +36,7 @@ void main() {
tester
.
pumpWidget
(
builder
());
tester
.
pumpWidget
(
builder
());
StatefulComponentElement
element
=
tester
.
findElement
((
element
)
=>
element
.
widget
is
FlipComponent
);
StatefulComponentElement
element
=
tester
.
findElement
((
Element
element
)
=>
element
.
widget
is
FlipComponent
);
FlipComponentState
testComponent
=
element
.
state
;
FlipComponentState
testComponent
=
element
.
state
;
expect
(
callbackTracker
,
equals
([
0
,
1
,
2
,
3
,
4
,
5
]));
expect
(
callbackTracker
,
equals
([
0
,
1
,
2
,
3
,
4
,
5
]));
...
...
packages/unit/test/widget/input_test.dart
View file @
5b72a2fd
...
@@ -37,7 +37,7 @@ void main() {
...
@@ -37,7 +37,7 @@ void main() {
child:
new
Input
(
child:
new
Input
(
key:
inputKey
,
key:
inputKey
,
placeholder:
'Placeholder'
,
placeholder:
'Placeholder'
,
onChanged:
(
value
)
{
inputValue
=
value
;
}
onChanged:
(
String
value
)
{
inputValue
=
value
;
}
)
)
);
);
}
}
...
...
packages/unit/test/widget/mixed_viewport_test.dart
View file @
5b72a2fd
...
@@ -31,7 +31,7 @@ void main() {
...
@@ -31,7 +31,7 @@ void main() {
tester
.
pumpWidget
(
builder
());
tester
.
pumpWidget
(
builder
());
StatefulComponentElement
element
=
tester
.
findElement
((
element
)
=>
element
.
widget
is
FlipComponent
);
StatefulComponentElement
element
=
tester
.
findElement
((
Element
element
)
=>
element
.
widget
is
FlipComponent
);
FlipComponentState
testComponent
=
element
.
state
;
FlipComponentState
testComponent
=
element
.
state
;
expect
(
callbackTracker
,
equals
([
0
,
1
,
2
,
3
,
4
,
5
]));
expect
(
callbackTracker
,
equals
([
0
,
1
,
2
,
3
,
4
,
5
]));
...
...
packages/unit/test/widget/multichild_test.dart
View file @
5b72a2fd
...
@@ -7,7 +7,7 @@ import 'widget_tester.dart';
...
@@ -7,7 +7,7 @@ import 'widget_tester.dart';
void
checkTree
(
WidgetTester
tester
,
List
<
BoxDecoration
>
expectedDecorations
)
{
void
checkTree
(
WidgetTester
tester
,
List
<
BoxDecoration
>
expectedDecorations
)
{
MultiChildRenderObjectElement
element
=
MultiChildRenderObjectElement
element
=
tester
.
findElement
((
element
)
=>
element
is
MultiChildRenderObjectElement
);
tester
.
findElement
((
Element
element
)
=>
element
is
MultiChildRenderObjectElement
);
expect
(
element
,
isNotNull
);
expect
(
element
,
isNotNull
);
expect
(
element
.
renderObject
is
RenderStack
,
isTrue
);
expect
(
element
.
renderObject
is
RenderStack
,
isTrue
);
RenderStack
renderObject
=
element
.
renderObject
;
RenderStack
renderObject
=
element
.
renderObject
;
...
@@ -17,7 +17,8 @@ void checkTree(WidgetTester tester, List<BoxDecoration> expectedDecorations) {
...
@@ -17,7 +17,8 @@ void checkTree(WidgetTester tester, List<BoxDecoration> expectedDecorations) {
expect
(
child
is
RenderDecoratedBox
,
isTrue
);
expect
(
child
is
RenderDecoratedBox
,
isTrue
);
RenderDecoratedBox
decoratedBox
=
child
;
RenderDecoratedBox
decoratedBox
=
child
;
expect
(
decoratedBox
.
decoration
,
equals
(
decoration
));
expect
(
decoratedBox
.
decoration
,
equals
(
decoration
));
child
=
decoratedBox
.
parentData
.
nextSibling
;
final
StackParentData
decoratedBoxParentData
=
decoratedBox
.
parentData
;
child
=
decoratedBoxParentData
.
nextSibling
;
}
}
expect
(
child
,
isNull
);
expect
(
child
,
isNull
);
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -31,67 +32,67 @@ void main() {
...
@@ -31,67 +32,67 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
decoration:
kBoxDecorationB
),
new
DecoratedBox
(
decoration:
kBoxDecorationB
),
new
DecoratedBox
(
decoration:
kBoxDecorationC
),
new
DecoratedBox
(
decoration:
kBoxDecorationC
),
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationA
,
kBoxDecorationB
,
kBoxDecorationC
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationA
,
kBoxDecorationB
,
kBoxDecorationC
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
decoration:
kBoxDecorationC
),
new
DecoratedBox
(
decoration:
kBoxDecorationC
),
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationA
,
kBoxDecorationC
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationA
,
kBoxDecorationC
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
key:
new
Key
(
'b'
),
decoration:
kBoxDecorationB
),
new
DecoratedBox
(
key:
new
Key
(
'b'
),
decoration:
kBoxDecorationB
),
new
DecoratedBox
(
decoration:
kBoxDecorationC
),
new
DecoratedBox
(
decoration:
kBoxDecorationC
),
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationA
,
kBoxDecorationB
,
kBoxDecorationC
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationA
,
kBoxDecorationB
,
kBoxDecorationC
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
DecoratedBox
(
key:
new
Key
(
'b'
),
decoration:
kBoxDecorationB
),
new
DecoratedBox
(
key:
new
Key
(
'b'
),
decoration:
kBoxDecorationB
),
new
DecoratedBox
(
decoration:
kBoxDecorationC
),
new
DecoratedBox
(
decoration:
kBoxDecorationC
),
new
DecoratedBox
(
key:
new
Key
(
'a'
),
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
key:
new
Key
(
'a'
),
decoration:
kBoxDecorationA
),
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationB
,
kBoxDecorationC
,
kBoxDecorationA
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationB
,
kBoxDecorationC
,
kBoxDecorationA
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
DecoratedBox
(
key:
new
Key
(
'a'
),
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
key:
new
Key
(
'a'
),
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
decoration:
kBoxDecorationC
),
new
DecoratedBox
(
decoration:
kBoxDecorationC
),
new
DecoratedBox
(
key:
new
Key
(
'b'
),
decoration:
kBoxDecorationB
),
new
DecoratedBox
(
key:
new
Key
(
'b'
),
decoration:
kBoxDecorationB
),
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationA
,
kBoxDecorationC
,
kBoxDecorationB
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationA
,
kBoxDecorationC
,
kBoxDecorationB
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
DecoratedBox
(
decoration:
kBoxDecorationC
),
new
DecoratedBox
(
decoration:
kBoxDecorationC
),
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationC
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationC
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([])
new
Stack
(
<
Widget
>
[])
);
);
checkTree
(
tester
,
[]);
checkTree
(
tester
,
<
BoxDecoration
>
[]);
});
});
});
});
...
@@ -100,17 +101,17 @@ void main() {
...
@@ -100,17 +101,17 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
decoration:
kBoxDecorationB
),
new
DecoratedBox
(
decoration:
kBoxDecorationB
),
new
DecoratedBox
(
decoration:
kBoxDecorationC
),
new
DecoratedBox
(
decoration:
kBoxDecorationC
),
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationA
,
kBoxDecorationB
,
kBoxDecorationC
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationA
,
kBoxDecorationB
,
kBoxDecorationC
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
Container
(
new
Container
(
child:
new
DecoratedBox
(
decoration:
kBoxDecorationB
)
child:
new
DecoratedBox
(
decoration:
kBoxDecorationB
)
...
@@ -119,10 +120,10 @@ void main() {
...
@@ -119,10 +120,10 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationA
,
kBoxDecorationB
,
kBoxDecorationC
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationA
,
kBoxDecorationB
,
kBoxDecorationC
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
Container
(
new
Container
(
child:
new
Container
(
child:
new
Container
(
...
@@ -133,10 +134,10 @@ void main() {
...
@@ -133,10 +134,10 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationA
,
kBoxDecorationB
,
kBoxDecorationC
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationA
,
kBoxDecorationB
,
kBoxDecorationC
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Container
(
new
Container
(
child:
new
Container
(
child:
new
Container
(
child:
new
DecoratedBox
(
decoration:
kBoxDecorationB
)
child:
new
DecoratedBox
(
decoration:
kBoxDecorationB
)
...
@@ -149,10 +150,10 @@ void main() {
...
@@ -149,10 +150,10 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationB
,
kBoxDecorationA
,
kBoxDecorationC
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationB
,
kBoxDecorationA
,
kBoxDecorationC
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Container
(
new
Container
(
child:
new
DecoratedBox
(
decoration:
kBoxDecorationB
)
child:
new
DecoratedBox
(
decoration:
kBoxDecorationB
)
),
),
...
@@ -163,10 +164,10 @@ void main() {
...
@@ -163,10 +164,10 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationB
,
kBoxDecorationA
,
kBoxDecorationC
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationB
,
kBoxDecorationA
,
kBoxDecorationC
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Container
(
new
Container
(
key:
new
Key
(
'b'
),
key:
new
Key
(
'b'
),
child:
new
DecoratedBox
(
decoration:
kBoxDecorationB
)
child:
new
DecoratedBox
(
decoration:
kBoxDecorationB
)
...
@@ -178,10 +179,10 @@ void main() {
...
@@ -178,10 +179,10 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationB
,
kBoxDecorationA
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationB
,
kBoxDecorationA
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Container
(
new
Container
(
key:
new
Key
(
'a'
),
key:
new
Key
(
'a'
),
child:
new
DecoratedBox
(
decoration:
kBoxDecorationA
)
child:
new
DecoratedBox
(
decoration:
kBoxDecorationA
)
...
@@ -193,29 +194,29 @@ void main() {
...
@@ -193,29 +194,29 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationA
,
kBoxDecorationB
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationA
,
kBoxDecorationB
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
(
[
])
new
Stack
(
<
Widget
>[
])
);
);
checkTree
(
tester
,
[]);
checkTree
(
tester
,
<
BoxDecoration
>
[]);
});
});
});
});
test
(
'MultiChildRenderObjectElement with stateful components'
,
()
{
test
(
'MultiChildRenderObjectElement with stateful components'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
decoration:
kBoxDecorationB
),
new
DecoratedBox
(
decoration:
kBoxDecorationB
),
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationA
,
kBoxDecorationB
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationA
,
kBoxDecorationB
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
FlipComponent
(
new
FlipComponent
(
left:
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
left:
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
right:
new
DecoratedBox
(
decoration:
kBoxDecorationB
)
right:
new
DecoratedBox
(
decoration:
kBoxDecorationB
)
...
@@ -224,15 +225,15 @@ void main() {
...
@@ -224,15 +225,15 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationA
,
kBoxDecorationC
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationA
,
kBoxDecorationC
]);
flipStatefulComponent
(
tester
);
flipStatefulComponent
(
tester
);
tester
.
pump
();
tester
.
pump
();
checkTree
(
tester
,
[
kBoxDecorationB
,
kBoxDecorationC
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationB
,
kBoxDecorationC
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
FlipComponent
(
new
FlipComponent
(
left:
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
left:
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
right:
new
DecoratedBox
(
decoration:
kBoxDecorationB
)
right:
new
DecoratedBox
(
decoration:
kBoxDecorationB
)
...
@@ -240,15 +241,15 @@ void main() {
...
@@ -240,15 +241,15 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationB
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationB
]);
flipStatefulComponent
(
tester
);
flipStatefulComponent
(
tester
);
tester
.
pump
();
tester
.
pump
();
checkTree
(
tester
,
[
kBoxDecorationA
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationA
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
FlipComponent
(
new
FlipComponent
(
key:
new
Key
(
'flip'
),
key:
new
Key
(
'flip'
),
left:
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
left:
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
...
@@ -258,7 +259,7 @@ void main() {
...
@@ -258,7 +259,7 @@ void main() {
);
);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
DecoratedBox
(
key:
new
Key
(
'c'
),
decoration:
kBoxDecorationC
),
new
DecoratedBox
(
key:
new
Key
(
'c'
),
decoration:
kBoxDecorationC
),
new
FlipComponent
(
new
FlipComponent
(
key:
new
Key
(
'flip'
),
key:
new
Key
(
'flip'
),
...
@@ -268,15 +269,15 @@ void main() {
...
@@ -268,15 +269,15 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationC
,
kBoxDecorationA
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationC
,
kBoxDecorationA
]);
flipStatefulComponent
(
tester
);
flipStatefulComponent
(
tester
);
tester
.
pump
();
tester
.
pump
();
checkTree
(
tester
,
[
kBoxDecorationC
,
kBoxDecorationB
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationC
,
kBoxDecorationB
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
FlipComponent
(
new
FlipComponent
(
key:
new
Key
(
'flip'
),
key:
new
Key
(
'flip'
),
left:
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
left:
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
...
@@ -286,7 +287,7 @@ void main() {
...
@@ -286,7 +287,7 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
kBoxDecorationB
,
kBoxDecorationC
]);
checkTree
(
tester
,
<
BoxDecoration
>
[
kBoxDecorationB
,
kBoxDecorationC
]);
});
});
});
});
}
}
packages/unit/test/widget/parent_data_test.dart
View file @
5b72a2fd
...
@@ -16,7 +16,7 @@ class TestParentData {
...
@@ -16,7 +16,7 @@ class TestParentData {
void
checkTree
(
WidgetTester
tester
,
List
<
TestParentData
>
expectedParentData
)
{
void
checkTree
(
WidgetTester
tester
,
List
<
TestParentData
>
expectedParentData
)
{
MultiChildRenderObjectElement
element
=
MultiChildRenderObjectElement
element
=
tester
.
findElement
((
element
)
=>
element
is
MultiChildRenderObjectElement
);
tester
.
findElement
((
Element
element
)
=>
element
is
MultiChildRenderObjectElement
);
expect
(
element
,
isNotNull
);
expect
(
element
,
isNotNull
);
expect
(
element
.
renderObject
is
RenderStack
,
isTrue
);
expect
(
element
.
renderObject
is
RenderStack
,
isTrue
);
RenderStack
renderObject
=
element
.
renderObject
;
RenderStack
renderObject
=
element
.
renderObject
;
...
@@ -31,7 +31,7 @@ void checkTree(WidgetTester tester, List<TestParentData> expectedParentData) {
...
@@ -31,7 +31,7 @@ void checkTree(WidgetTester tester, List<TestParentData> expectedParentData) {
expect
(
parentData
.
right
,
equals
(
expected
.
right
));
expect
(
parentData
.
right
,
equals
(
expected
.
right
));
expect
(
parentData
.
bottom
,
equals
(
expected
.
bottom
));
expect
(
parentData
.
bottom
,
equals
(
expected
.
bottom
));
expect
(
parentData
.
left
,
equals
(
expected
.
left
));
expect
(
parentData
.
left
,
equals
(
expected
.
left
));
child
=
decoratedBox
.
parentData
.
nextSibling
;
child
=
(
decoratedBox
.
parentData
as
StackParentData
)
.
nextSibling
;
}
}
expect
(
child
,
isNull
);
expect
(
child
,
isNull
);
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -61,7 +61,7 @@ void main() {
...
@@ -61,7 +61,7 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
DecoratedBox
(
decoration:
kBoxDecorationA
),
new
Positioned
(
new
Positioned
(
top:
10.0
,
top:
10.0
,
...
@@ -72,14 +72,14 @@ void main() {
...
@@ -72,14 +72,14 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
checkTree
(
tester
,
<
TestParentData
>
[
kNonPositioned
,
kNonPositioned
,
new
TestParentData
(
top:
10.0
,
left:
10.0
),
new
TestParentData
(
top:
10.0
,
left:
10.0
),
kNonPositioned
,
kNonPositioned
,
]);
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Positioned
(
new
Positioned
(
bottom:
5.0
,
bottom:
5.0
,
right:
7.0
,
right:
7.0
,
...
@@ -94,7 +94,7 @@ void main() {
...
@@ -94,7 +94,7 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
checkTree
(
tester
,
<
TestParentData
>
[
new
TestParentData
(
bottom:
5.0
,
right:
7.0
),
new
TestParentData
(
bottom:
5.0
,
right:
7.0
),
new
TestParentData
(
top:
10.0
,
left:
10.0
),
new
TestParentData
(
top:
10.0
,
left:
10.0
),
kNonPositioned
,
kNonPositioned
,
...
@@ -105,7 +105,7 @@ void main() {
...
@@ -105,7 +105,7 @@ void main() {
DecoratedBox
kDecoratedBoxC
=
new
DecoratedBox
(
decoration:
kBoxDecorationC
);
DecoratedBox
kDecoratedBoxC
=
new
DecoratedBox
(
decoration:
kBoxDecorationC
);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Positioned
(
new
Positioned
(
bottom:
5.0
,
bottom:
5.0
,
right:
7.0
,
right:
7.0
,
...
@@ -120,14 +120,14 @@ void main() {
...
@@ -120,14 +120,14 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
checkTree
(
tester
,
<
TestParentData
>
[
new
TestParentData
(
bottom:
5.0
,
right:
7.0
),
new
TestParentData
(
bottom:
5.0
,
right:
7.0
),
new
TestParentData
(
top:
10.0
,
left:
10.0
),
new
TestParentData
(
top:
10.0
,
left:
10.0
),
kNonPositioned
,
kNonPositioned
,
]);
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Positioned
(
new
Positioned
(
bottom:
6.0
,
bottom:
6.0
,
right:
8.0
,
right:
8.0
,
...
@@ -142,14 +142,14 @@ void main() {
...
@@ -142,14 +142,14 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
checkTree
(
tester
,
<
TestParentData
>
[
new
TestParentData
(
bottom:
6.0
,
right:
8.0
),
new
TestParentData
(
bottom:
6.0
,
right:
8.0
),
new
TestParentData
(
left:
10.0
,
right:
10.0
),
new
TestParentData
(
left:
10.0
,
right:
10.0
),
kNonPositioned
,
kNonPositioned
,
]);
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
kDecoratedBoxA
,
kDecoratedBoxA
,
new
Positioned
(
new
Positioned
(
left:
11.0
,
left:
11.0
,
...
@@ -160,14 +160,14 @@ void main() {
...
@@ -160,14 +160,14 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
checkTree
(
tester
,
<
TestParentData
>
[
kNonPositioned
,
kNonPositioned
,
new
TestParentData
(
left:
11.0
,
right:
12.0
),
new
TestParentData
(
left:
11.0
,
right:
12.0
),
kNonPositioned
,
kNonPositioned
,
]);
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
kDecoratedBoxA
,
kDecoratedBoxA
,
new
Positioned
(
new
Positioned
(
right:
10.0
,
right:
10.0
,
...
@@ -182,14 +182,14 @@ void main() {
...
@@ -182,14 +182,14 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
checkTree
(
tester
,
<
TestParentData
>
[
kNonPositioned
,
kNonPositioned
,
new
TestParentData
(
right:
10.0
),
new
TestParentData
(
right:
10.0
),
new
TestParentData
(
top:
8.0
),
new
TestParentData
(
top:
8.0
),
]);
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Positioned
(
new
Positioned
(
right:
10.0
,
right:
10.0
,
child:
new
FlipComponent
(
left:
kDecoratedBoxA
,
right:
kDecoratedBoxB
)
child:
new
FlipComponent
(
left:
kDecoratedBoxA
,
right:
kDecoratedBoxB
)
...
@@ -197,19 +197,19 @@ void main() {
...
@@ -197,19 +197,19 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
checkTree
(
tester
,
<
TestParentData
>
[
new
TestParentData
(
right:
10.0
),
new
TestParentData
(
right:
10.0
),
]);
]);
flipStatefulComponent
(
tester
);
flipStatefulComponent
(
tester
);
tester
.
pump
();
tester
.
pump
();
checkTree
(
tester
,
[
checkTree
(
tester
,
<
TestParentData
>
[
new
TestParentData
(
right:
10.0
),
new
TestParentData
(
right:
10.0
),
]);
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Positioned
(
new
Positioned
(
top:
7.0
,
top:
7.0
,
child:
new
FlipComponent
(
left:
kDecoratedBoxA
,
right:
kDecoratedBoxB
)
child:
new
FlipComponent
(
left:
kDecoratedBoxA
,
right:
kDecoratedBoxB
)
...
@@ -217,22 +217,22 @@ void main() {
...
@@ -217,22 +217,22 @@ void main() {
])
])
);
);
checkTree
(
tester
,
[
checkTree
(
tester
,
<
TestParentData
>
[
new
TestParentData
(
top:
7.0
),
new
TestParentData
(
top:
7.0
),
]);
]);
flipStatefulComponent
(
tester
);
flipStatefulComponent
(
tester
);
tester
.
pump
();
tester
.
pump
();
checkTree
(
tester
,
[
checkTree
(
tester
,
<
TestParentData
>
[
new
TestParentData
(
top:
7.0
),
new
TestParentData
(
top:
7.0
),
]);
]);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([])
new
Stack
(
<
Widget
>
[])
);
);
checkTree
(
tester
,
[]);
checkTree
(
tester
,
<
TestParentData
>
[]);
});
});
});
});
...
@@ -241,7 +241,7 @@ void main() {
...
@@ -241,7 +241,7 @@ void main() {
expect
(
cachedException
,
isNull
);
expect
(
cachedException
,
isNull
);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Positioned
(
new
Positioned
(
top:
5.0
,
top:
5.0
,
bottom:
8.0
,
bottom:
8.0
,
...
@@ -257,14 +257,14 @@ void main() {
...
@@ -257,14 +257,14 @@ void main() {
expect
(
cachedException
,
isNotNull
);
expect
(
cachedException
,
isNotNull
);
cachedException
=
null
;
cachedException
=
null
;
tester
.
pumpWidget
(
new
Stack
([]));
tester
.
pumpWidget
(
new
Stack
(
<
Widget
>
[]));
checkTree
(
tester
,
[]);
checkTree
(
tester
,
<
TestParentData
>
[]);
expect
(
cachedException
,
isNull
);
expect
(
cachedException
,
isNull
);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Container
(
new
Container
(
child:
new
Flex
([
child:
new
Flex
(
<
Widget
>
[
new
Positioned
(
new
Positioned
(
top:
6.0
,
top:
6.0
,
left:
7.0
,
left:
7.0
,
...
@@ -278,10 +278,10 @@ void main() {
...
@@ -278,10 +278,10 @@ void main() {
cachedException
=
null
;
cachedException
=
null
;
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([])
new
Stack
(
<
Widget
>
[])
);
);
checkTree
(
tester
,
[]);
checkTree
(
tester
,
<
TestParentData
>
[]);
});
});
});
});
}
}
packages/unit/test/widget/progress_indicator_test.dart
View file @
5b72a2fd
...
@@ -8,11 +8,11 @@ import 'widget_tester.dart';
...
@@ -8,11 +8,11 @@ import 'widget_tester.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'LinearProgressIndicator changes when its value changes'
,
()
{
test
(
'LinearProgressIndicator changes when its value changes'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
Block
([
new
LinearProgressIndicator
(
value:
0.0
)]));
tester
.
pumpWidget
(
new
Block
(
<
Widget
>
[
new
LinearProgressIndicator
(
value:
0.0
)]));
List
<
Layer
>
layers1
=
tester
.
layers
;
List
<
Layer
>
layers1
=
tester
.
layers
;
tester
.
pumpWidget
(
new
Block
([
new
LinearProgressIndicator
(
value:
0.5
)]));
tester
.
pumpWidget
(
new
Block
(
<
Widget
>
[
new
LinearProgressIndicator
(
value:
0.5
)]));
List
<
Layer
>
layers2
=
tester
.
layers
;
List
<
Layer
>
layers2
=
tester
.
layers
;
expect
(
layers1
,
isNot
(
equals
(
layers2
)));
expect
(
layers1
,
isNot
(
equals
(
layers2
)));
...
...
packages/unit/test/widget/render_object_widget_test.dart
View file @
5b72a2fd
...
@@ -19,7 +19,7 @@ void main() {
...
@@ -19,7 +19,7 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
DecoratedBox
(
decoration:
kBoxDecorationA
));
tester
.
pumpWidget
(
new
DecoratedBox
(
decoration:
kBoxDecorationA
));
OneChildRenderObjectElement
element
=
OneChildRenderObjectElement
element
=
tester
.
findElement
((
element
)
=>
element
is
OneChildRenderObjectElement
);
tester
.
findElement
((
Element
element
)
=>
element
is
OneChildRenderObjectElement
);
expect
(
element
,
isNotNull
);
expect
(
element
,
isNotNull
);
expect
(
element
.
renderObject
is
RenderDecoratedBox
,
isTrue
);
expect
(
element
.
renderObject
is
RenderDecoratedBox
,
isTrue
);
RenderDecoratedBox
renderObject
=
element
.
renderObject
;
RenderDecoratedBox
renderObject
=
element
.
renderObject
;
...
@@ -27,7 +27,7 @@ void main() {
...
@@ -27,7 +27,7 @@ void main() {
expect
(
renderObject
.
position
,
equals
(
BoxDecorationPosition
.
background
));
expect
(
renderObject
.
position
,
equals
(
BoxDecorationPosition
.
background
));
tester
.
pumpWidget
(
new
DecoratedBox
(
decoration:
kBoxDecorationB
));
tester
.
pumpWidget
(
new
DecoratedBox
(
decoration:
kBoxDecorationB
));
element
=
tester
.
findElement
((
element
)
=>
element
is
OneChildRenderObjectElement
);
element
=
tester
.
findElement
((
Element
element
)
=>
element
is
OneChildRenderObjectElement
);
expect
(
element
,
isNotNull
);
expect
(
element
,
isNotNull
);
expect
(
element
.
renderObject
is
RenderDecoratedBox
,
isTrue
);
expect
(
element
.
renderObject
is
RenderDecoratedBox
,
isTrue
);
renderObject
=
element
.
renderObject
;
renderObject
=
element
.
renderObject
;
...
@@ -41,7 +41,7 @@ void main() {
...
@@ -41,7 +41,7 @@ void main() {
void
checkFullTree
()
{
void
checkFullTree
()
{
OneChildRenderObjectElement
element
=
OneChildRenderObjectElement
element
=
tester
.
findElement
((
element
)
=>
element
is
OneChildRenderObjectElement
);
tester
.
findElement
((
Element
element
)
=>
element
is
OneChildRenderObjectElement
);
expect
(
element
,
isNotNull
);
expect
(
element
,
isNotNull
);
expect
(
element
.
renderObject
is
RenderDecoratedBox
,
isTrue
);
expect
(
element
.
renderObject
is
RenderDecoratedBox
,
isTrue
);
RenderDecoratedBox
renderObject
=
element
.
renderObject
;
RenderDecoratedBox
renderObject
=
element
.
renderObject
;
...
@@ -57,7 +57,7 @@ void main() {
...
@@ -57,7 +57,7 @@ void main() {
void
childBareTree
()
{
void
childBareTree
()
{
OneChildRenderObjectElement
element
=
OneChildRenderObjectElement
element
=
tester
.
findElement
((
element
)
=>
element
is
OneChildRenderObjectElement
);
tester
.
findElement
((
Element
element
)
=>
element
is
OneChildRenderObjectElement
);
expect
(
element
,
isNotNull
);
expect
(
element
,
isNotNull
);
expect
(
element
.
renderObject
is
RenderDecoratedBox
,
isTrue
);
expect
(
element
.
renderObject
is
RenderDecoratedBox
,
isTrue
);
RenderDecoratedBox
renderObject
=
element
.
renderObject
;
RenderDecoratedBox
renderObject
=
element
.
renderObject
;
...
@@ -136,7 +136,7 @@ void main() {
...
@@ -136,7 +136,7 @@ void main() {
));
));
OneChildRenderObjectElement
element
=
OneChildRenderObjectElement
element
=
tester
.
findElement
((
element
)
=>
element
is
OneChildRenderObjectElement
);
tester
.
findElement
((
Element
element
)
=>
element
is
OneChildRenderObjectElement
);
expect
(
element
.
renderObject
is
RenderDecoratedBox
,
isTrue
);
expect
(
element
.
renderObject
is
RenderDecoratedBox
,
isTrue
);
RenderDecoratedBox
parent
=
element
.
renderObject
;
RenderDecoratedBox
parent
=
element
.
renderObject
;
expect
(
parent
.
child
is
RenderDecoratedBox
,
isTrue
);
expect
(
parent
.
child
is
RenderDecoratedBox
,
isTrue
);
...
@@ -152,7 +152,7 @@ void main() {
...
@@ -152,7 +152,7 @@ void main() {
));
));
element
=
element
=
tester
.
findElement
((
element
)
=>
element
is
OneChildRenderObjectElement
);
tester
.
findElement
((
Element
element
)
=>
element
is
OneChildRenderObjectElement
);
expect
(
element
.
renderObject
is
RenderDecoratedBox
,
isTrue
);
expect
(
element
.
renderObject
is
RenderDecoratedBox
,
isTrue
);
expect
(
element
.
renderObject
,
equals
(
parent
));
expect
(
element
.
renderObject
,
equals
(
parent
));
expect
(
parent
.
child
,
isNull
);
expect
(
parent
.
child
,
isNull
);
...
...
packages/unit/test/widget/reparent_state_test.dart
View file @
5b72a2fd
...
@@ -33,7 +33,7 @@ void main() {
...
@@ -33,7 +33,7 @@ void main() {
StateMarker
grandchild
=
new
StateMarker
();
StateMarker
grandchild
=
new
StateMarker
();
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Container
(
new
Container
(
child:
new
StateMarker
(
key:
left
)
child:
new
StateMarker
(
key:
left
)
),
),
...
@@ -55,7 +55,7 @@ void main() {
...
@@ -55,7 +55,7 @@ void main() {
StateMarker
newGrandchild
=
new
StateMarker
();
StateMarker
newGrandchild
=
new
StateMarker
();
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Container
(
new
Container
(
child:
new
StateMarker
(
child:
new
StateMarker
(
key:
right
,
key:
right
,
...
@@ -101,7 +101,7 @@ void main() {
...
@@ -101,7 +101,7 @@ void main() {
(
key
.
currentState
as
StateMarkerState
).
marker
=
"marked"
;
(
key
.
currentState
as
StateMarkerState
).
marker
=
"marked"
;
tester
.
pumpWidget
(
new
ScrollableList
<
int
>(
tester
.
pumpWidget
(
new
ScrollableList
<
int
>(
items:
[
0
],
items:
<
int
>
[
0
],
itemExtent:
100.0
,
itemExtent:
100.0
,
itemBuilder:
(
BuildContext
context
,
int
item
)
{
itemBuilder:
(
BuildContext
context
,
int
item
)
{
return
new
Container
(
return
new
Container
(
...
...
packages/unit/test/widget/set_state_3_test.dart
View file @
5b72a2fd
...
@@ -27,7 +27,7 @@ class ChangerState extends State<Changer> {
...
@@ -27,7 +27,7 @@ class ChangerState extends State<Changer> {
void
test
()
{
setState
(()
{
_state
=
true
;
});
}
void
test
()
{
setState
(()
{
_state
=
true
;
});
}
Widget
build
(
BuildContext
)
=>
_state
?
new
Wrapper
(
config
.
child
)
:
config
.
child
;
Widget
build
(
BuildContext
context
)
=>
_state
?
new
Wrapper
(
config
.
child
)
:
config
.
child
;
}
}
class
Wrapper
extends
StatelessComponent
{
class
Wrapper
extends
StatelessComponent
{
...
...
packages/unit/test/widget/shader_mask_test.dart
View file @
5b72a2fd
...
@@ -10,8 +10,8 @@ ui.Shader createShader(Rect bounds) {
...
@@ -10,8 +10,8 @@ ui.Shader createShader(Rect bounds) {
return
new
LinearGradient
(
return
new
LinearGradient
(
begin:
Point
.
origin
,
begin:
Point
.
origin
,
end:
new
Point
(
0.0
,
bounds
.
height
),
end:
new
Point
(
0.0
,
bounds
.
height
),
colors:
[
const
Color
(
0x00FFFFFF
),
const
Color
(
0xFFFFFFFF
)],
colors:
<
Color
>
[
const
Color
(
0x00FFFFFF
),
const
Color
(
0xFFFFFFFF
)],
stops:
[
0.1
,
0.35
]
stops:
<
double
>
[
0.1
,
0.35
]
)
)
.
createShader
();
.
createShader
();
}
}
...
...
packages/unit/test/widget/size_observer_test.dart
View file @
5b72a2fd
...
@@ -8,10 +8,10 @@ import 'widget_tester.dart';
...
@@ -8,10 +8,10 @@ import 'widget_tester.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'SizeObserver notices zero size'
,
()
{
test
(
'SizeObserver notices zero size'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
List
results
=
[];
List
<
Size
>
results
=
<
Size
>
[];
tester
.
pumpWidget
(
new
Center
(
tester
.
pumpWidget
(
new
Center
(
child:
new
SizeObserver
(
child:
new
SizeObserver
(
callback:
(
size
)
{
results
.
add
(
size
);
},
callback:
(
Size
size
)
{
results
.
add
(
size
);
},
child:
new
Container
(
width:
0.0
,
height:
0.0
)
child:
new
Container
(
width:
0.0
,
height:
0.0
)
)
)
));
));
...
@@ -20,7 +20,7 @@ void main() {
...
@@ -20,7 +20,7 @@ void main() {
expect
(
results
,
equals
([
Size
.
zero
]));
expect
(
results
,
equals
([
Size
.
zero
]));
tester
.
pumpWidget
(
new
Center
(
tester
.
pumpWidget
(
new
Center
(
child:
new
SizeObserver
(
child:
new
SizeObserver
(
callback:
(
size
)
{
results
.
add
(
size
);
},
callback:
(
Size
size
)
{
results
.
add
(
size
);
},
child:
new
Container
(
width:
100.0
,
height:
0.0
)
child:
new
Container
(
width:
100.0
,
height:
0.0
)
)
)
));
));
...
@@ -29,7 +29,7 @@ void main() {
...
@@ -29,7 +29,7 @@ void main() {
expect
(
results
,
equals
([
Size
.
zero
,
const
Size
(
100.0
,
0.0
)]));
expect
(
results
,
equals
([
Size
.
zero
,
const
Size
(
100.0
,
0.0
)]));
tester
.
pumpWidget
(
new
Center
(
tester
.
pumpWidget
(
new
Center
(
child:
new
SizeObserver
(
child:
new
SizeObserver
(
callback:
(
size
)
{
results
.
add
(
size
);
},
callback:
(
Size
size
)
{
results
.
add
(
size
);
},
child:
new
Container
(
width:
0.0
,
height:
0.0
)
child:
new
Container
(
width:
0.0
,
height:
0.0
)
)
)
));
));
...
@@ -38,7 +38,7 @@ void main() {
...
@@ -38,7 +38,7 @@ void main() {
expect
(
results
,
equals
([
Size
.
zero
,
const
Size
(
100.0
,
0.0
),
Size
.
zero
]));
expect
(
results
,
equals
([
Size
.
zero
,
const
Size
(
100.0
,
0.0
),
Size
.
zero
]));
tester
.
pumpWidget
(
new
Center
(
tester
.
pumpWidget
(
new
Center
(
child:
new
SizeObserver
(
child:
new
SizeObserver
(
callback:
(
size
)
{
results
.
add
(
size
);
},
callback:
(
Size
size
)
{
results
.
add
(
size
);
},
child:
new
Container
(
width:
0.0
,
height:
0.0
)
child:
new
Container
(
width:
0.0
,
height:
0.0
)
)
)
));
));
...
...
packages/unit/test/widget/snack_bar_test.dart
View file @
5b72a2fd
...
@@ -11,7 +11,7 @@ void main() {
...
@@ -11,7 +11,7 @@ void main() {
Key
tapTarget
=
new
Key
(
'tap-target'
);
Key
tapTarget
=
new
Key
(
'tap-target'
);
tester
.
pumpWidget
(
new
MaterialApp
(
tester
.
pumpWidget
(
new
MaterialApp
(
routes:
{
routes:
<
String
,
RouteBuilder
>
{
'/'
:
(
RouteArguments
args
)
{
'/'
:
(
RouteArguments
args
)
{
return
new
GestureDetector
(
return
new
GestureDetector
(
onTap:
()
{
onTap:
()
{
...
...
packages/unit/test/widget/snap_scrolling_test.dart
View file @
5b72a2fd
...
@@ -35,7 +35,7 @@ Widget buildFrame() {
...
@@ -35,7 +35,7 @@ Widget buildFrame() {
key:
scrollableListKey
,
key:
scrollableListKey
,
snapOffsetCallback:
snapOffsetCallback
,
snapOffsetCallback:
snapOffsetCallback
,
scrollDirection:
scrollDirection
,
scrollDirection:
scrollDirection
,
items:
[
0
,
1
,
2
,
3
,
4
,
5
,
7
,
8
,
9
],
items:
<
int
>
[
0
,
1
,
2
,
3
,
4
,
5
,
7
,
8
,
9
],
itemBuilder:
buildItem
,
itemBuilder:
buildItem
,
itemExtent:
itemExtent
itemExtent:
itemExtent
)
)
...
...
packages/unit/test/widget/stack_test.dart
View file @
5b72a2fd
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:test/test.dart'
;
import
'package:test/test.dart'
;
...
@@ -6,13 +7,13 @@ import 'widget_tester.dart';
...
@@ -6,13 +7,13 @@ import 'widget_tester.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'Can construct an empty Stack'
,
()
{
test
(
'Can construct an empty Stack'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
Stack
([]));
tester
.
pumpWidget
(
new
Stack
(
<
Widget
>
[]));
});
});
});
});
test
(
'Can construct an empty Centered Stack'
,
()
{
test
(
'Can construct an empty Centered Stack'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
Center
(
child:
new
Stack
([])));
tester
.
pumpWidget
(
new
Center
(
child:
new
Stack
(
<
Widget
>
[])));
});
});
});
});
...
@@ -21,7 +22,7 @@ void main() {
...
@@ -21,7 +22,7 @@ void main() {
Key
key
=
new
Key
(
'container'
);
Key
key
=
new
Key
(
'container'
);
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Positioned
(
new
Positioned
(
left:
10.0
,
left:
10.0
,
child:
new
Container
(
child:
new
Container
(
...
@@ -33,14 +34,18 @@ void main() {
...
@@ -33,14 +34,18 @@ void main() {
])
])
);
);
Element
container
=
tester
.
findElementByKey
(
key
);
Element
container
;
expect
(
container
.
renderObject
.
parentData
.
top
,
isNull
);
StackParentData
parentData
;
expect
(
container
.
renderObject
.
parentData
.
right
,
isNull
);
expect
(
container
.
renderObject
.
parentData
.
bottom
,
isNull
);
container
=
tester
.
findElementByKey
(
key
);
expect
(
container
.
renderObject
.
parentData
.
left
,
equals
(
10.0
));
parentData
=
container
.
renderObject
.
parentData
;
expect
(
parentData
.
top
,
isNull
);
expect
(
parentData
.
right
,
isNull
);
expect
(
parentData
.
bottom
,
isNull
);
expect
(
parentData
.
left
,
equals
(
10.0
));
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Positioned
(
new
Positioned
(
right:
10.0
,
right:
10.0
,
child:
new
Container
(
child:
new
Container
(
...
@@ -53,10 +58,11 @@ void main() {
...
@@ -53,10 +58,11 @@ void main() {
);
);
container
=
tester
.
findElementByKey
(
key
);
container
=
tester
.
findElementByKey
(
key
);
expect
(
container
.
renderObject
.
parentData
.
top
,
isNull
);
parentData
=
container
.
renderObject
.
parentData
;
expect
(
container
.
renderObject
.
parentData
.
right
,
equals
(
10.0
));
expect
(
parentData
.
top
,
isNull
);
expect
(
container
.
renderObject
.
parentData
.
bottom
,
isNull
);
expect
(
parentData
.
right
,
equals
(
10.0
));
expect
(
container
.
renderObject
.
parentData
.
left
,
isNull
);
expect
(
parentData
.
bottom
,
isNull
);
expect
(
parentData
.
left
,
isNull
);
});
});
});
});
...
@@ -65,21 +71,24 @@ void main() {
...
@@ -65,21 +71,24 @@ void main() {
Key
key
=
new
Key
(
'container'
);
Key
key
=
new
Key
(
'container'
);
Container
container
=
new
Container
(
key:
key
,
width:
10.0
,
height:
10.0
);
Container
container
=
new
Container
(
key:
key
,
width:
10.0
,
height:
10.0
);
tester
.
pumpWidget
(
new
Stack
([
new
Positioned
(
left:
10.0
,
child:
container
)
]));
tester
.
pumpWidget
(
new
Stack
(
<
Widget
>
[
new
Positioned
(
left:
10.0
,
child:
container
)
]));
Element
containerElement
=
tester
.
findElementByKey
(
key
);
Element
containerElement
=
tester
.
findElementByKey
(
key
);
expect
(
containerElement
.
renderObject
.
parentData
.
top
,
isNull
);
StackParentData
parentData
;
expect
(
containerElement
.
renderObject
.
parentData
.
right
,
isNull
);
parentData
=
containerElement
.
renderObject
.
parentData
;
expect
(
containerElement
.
renderObject
.
parentData
.
bottom
,
isNull
);
expect
(
parentData
.
top
,
isNull
);
expect
(
containerElement
.
renderObject
.
parentData
.
left
,
equals
(
10.0
));
expect
(
parentData
.
right
,
isNull
);
expect
(
parentData
.
bottom
,
isNull
);
expect
(
parentData
.
left
,
equals
(
10.0
));
tester
.
pumpWidget
(
new
Stack
([
container
]));
tester
.
pumpWidget
(
new
Stack
(
<
Widget
>
[
container
]));
containerElement
=
tester
.
findElementByKey
(
key
);
containerElement
=
tester
.
findElementByKey
(
key
);
expect
(
containerElement
.
renderObject
.
parentData
.
top
,
isNull
);
parentData
=
containerElement
.
renderObject
.
parentData
;
expect
(
containerElement
.
renderObject
.
parentData
.
right
,
isNull
);
expect
(
parentData
.
top
,
isNull
);
expect
(
containerElement
.
renderObject
.
parentData
.
bottom
,
isNull
);
expect
(
parentData
.
right
,
isNull
);
expect
(
containerElement
.
renderObject
.
parentData
.
left
,
isNull
);
expect
(
parentData
.
bottom
,
isNull
);
expect
(
parentData
.
left
,
isNull
);
});
});
});
});
...
@@ -90,7 +99,7 @@ void main() {
...
@@ -90,7 +99,7 @@ void main() {
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Center
(
new
Center
(
child:
new
Stack
([
child:
new
Stack
(
<
Widget
>
[
new
Container
(
key:
child0Key
,
width:
20.0
,
height:
20.0
),
new
Container
(
key:
child0Key
,
width:
20.0
,
height:
20.0
),
new
Container
(
key:
child1Key
,
width:
10.0
,
height:
10.0
)
new
Container
(
key:
child1Key
,
width:
10.0
,
height:
10.0
)
],
],
...
@@ -101,22 +110,24 @@ void main() {
...
@@ -101,22 +110,24 @@ void main() {
);
);
Element
child0
=
tester
.
findElementByKey
(
child0Key
);
Element
child0
=
tester
.
findElementByKey
(
child0Key
);
expect
(
child0
.
renderObject
.
parentData
.
position
,
equals
(
const
Point
(
0.0
,
0.0
)));
final
StackParentData
child0RenderObjectParentData
=
child0
.
renderObject
.
parentData
;
expect
(
child0RenderObjectParentData
.
position
,
equals
(
const
Point
(
0.0
,
0.0
)));
Element
child1
=
tester
.
findElementByKey
(
child1Key
);
Element
child1
=
tester
.
findElementByKey
(
child1Key
);
expect
(
child1
.
renderObject
.
parentData
.
position
,
equals
(
const
Point
(
5.0
,
5.0
)));
final
StackParentData
child1RenderObjectParentData
=
child1
.
renderObject
.
parentData
;
expect
(
child1RenderObjectParentData
.
position
,
equals
(
const
Point
(
5.0
,
5.0
)));
});
});
});
});
test
(
'Can construct an empty IndexedStack'
,
()
{
test
(
'Can construct an empty IndexedStack'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
IndexedStack
([]));
tester
.
pumpWidget
(
new
IndexedStack
(
<
Widget
>
[]));
});
});
});
});
test
(
'Can construct an empty Centered IndexedStack'
,
()
{
test
(
'Can construct an empty Centered IndexedStack'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
Center
(
child:
new
IndexedStack
([])));
tester
.
pumpWidget
(
new
Center
(
child:
new
IndexedStack
(
<
Widget
>
[])));
});
});
});
});
...
@@ -126,9 +137,9 @@ void main() {
...
@@ -126,9 +137,9 @@ void main() {
List
<
int
>
itemsPainted
;
List
<
int
>
itemsPainted
;
Widget
buildFrame
(
int
index
)
{
Widget
buildFrame
(
int
index
)
{
itemsPainted
=
[];
itemsPainted
=
<
int
>
[];
List
<
Widget
>
items
=
new
List
.
generate
(
itemCount
,
(
i
)
{
List
<
Widget
>
items
=
new
List
<
Widget
>
.
generate
(
itemCount
,
(
i
)
{
return
new
CustomPaint
(
child:
new
Text
(
'
$i
'
),
callback:
(
_
0
,
_1
)
{
itemsPainted
.
add
(
i
);
});
return
new
CustomPaint
(
child:
new
Text
(
'
$i
'
),
callback:
(
_
,
__
)
{
itemsPainted
.
add
(
i
);
});
});
});
return
new
Center
(
child:
new
IndexedStack
(
items
,
index:
index
));
return
new
Center
(
child:
new
IndexedStack
(
items
,
index:
index
));
}
}
...
@@ -154,8 +165,8 @@ void main() {
...
@@ -154,8 +165,8 @@ void main() {
List
<
int
>
itemsTapped
;
List
<
int
>
itemsTapped
;
Widget
buildFrame
(
int
index
)
{
Widget
buildFrame
(
int
index
)
{
itemsTapped
=
[];
itemsTapped
=
<
int
>
[];
List
<
Widget
>
items
=
new
List
.
generate
(
itemCount
,
(
i
)
{
List
<
Widget
>
items
=
new
List
<
Widget
>
.
generate
(
itemCount
,
(
i
)
{
return
new
GestureDetector
(
child:
new
Text
(
'
$i
'
),
onTap:
()
{
itemsTapped
.
add
(
i
);
});
return
new
GestureDetector
(
child:
new
Text
(
'
$i
'
),
onTap:
()
{
itemsTapped
.
add
(
i
);
});
});
});
return
new
Center
(
child:
new
IndexedStack
(
items
,
key:
key
,
index:
index
));
return
new
Center
(
child:
new
IndexedStack
(
items
,
key:
key
,
index:
index
));
...
...
packages/unit/test/widget/stateful_component_test.dart
View file @
5b72a2fd
...
@@ -11,7 +11,7 @@ void main() {
...
@@ -11,7 +11,7 @@ void main() {
void
checkTree
(
BoxDecoration
expectedDecoration
)
{
void
checkTree
(
BoxDecoration
expectedDecoration
)
{
OneChildRenderObjectElement
element
=
OneChildRenderObjectElement
element
=
tester
.
findElement
((
element
)
=>
element
is
OneChildRenderObjectElement
);
tester
.
findElement
((
Element
element
)
=>
element
is
OneChildRenderObjectElement
);
expect
(
element
,
isNotNull
);
expect
(
element
,
isNotNull
);
expect
(
element
.
renderObject
is
RenderDecoratedBox
,
isTrue
);
expect
(
element
.
renderObject
is
RenderDecoratedBox
,
isTrue
);
RenderDecoratedBox
renderObject
=
element
.
renderObject
;
RenderDecoratedBox
renderObject
=
element
.
renderObject
;
...
...
packages/unit/test/widget/syncing_test.dart
View file @
5b72a2fd
...
@@ -112,13 +112,13 @@ void main() {
...
@@ -112,13 +112,13 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
Widget
a
=
new
TestWidget
(
persistentState:
0x61
,
syncedState:
0x41
,
child:
new
Text
(
'apple'
));
Widget
a
=
new
TestWidget
(
persistentState:
0x61
,
syncedState:
0x41
,
child:
new
Text
(
'apple'
));
Widget
b
=
new
TestWidget
(
persistentState:
0x62
,
syncedState:
0x42
,
child:
new
Text
(
'banana'
));
Widget
b
=
new
TestWidget
(
persistentState:
0x62
,
syncedState:
0x42
,
child:
new
Text
(
'banana'
));
tester
.
pumpWidget
(
new
Column
([]));
tester
.
pumpWidget
(
new
Column
(
<
Widget
>
[]));
GlobalKey
keyA
=
new
GlobalKey
();
GlobalKey
keyA
=
new
GlobalKey
();
GlobalKey
keyB
=
new
GlobalKey
();
GlobalKey
keyB
=
new
GlobalKey
();
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Column
([
new
Column
(
<
Widget
>
[
new
Container
(
new
Container
(
key:
keyA
,
key:
keyA
,
child:
a
child:
a
...
@@ -143,7 +143,7 @@ void main() {
...
@@ -143,7 +143,7 @@ void main() {
expect
(
second
.
syncedState
,
equals
(
0x42
));
expect
(
second
.
syncedState
,
equals
(
0x42
));
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Column
([
new
Column
(
<
Widget
>
[
new
Container
(
new
Container
(
key:
keyA
,
key:
keyA
,
child:
a
child:
a
...
@@ -170,7 +170,7 @@ void main() {
...
@@ -170,7 +170,7 @@ void main() {
// since they are both "old" nodes, they shouldn't sync with each other even though they look alike
// since they are both "old" nodes, they shouldn't sync with each other even though they look alike
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Column
([
new
Column
(
<
Widget
>
[
new
Container
(
new
Container
(
key:
keyA
,
key:
keyA
,
child:
b
child:
b
...
...
packages/unit/test/widget/test_widgets.dart
View file @
5b72a2fd
...
@@ -49,7 +49,7 @@ class TestBuildCounter extends StatelessComponent {
...
@@ -49,7 +49,7 @@ class TestBuildCounter extends StatelessComponent {
void
flipStatefulComponent
(
WidgetTester
tester
)
{
void
flipStatefulComponent
(
WidgetTester
tester
)
{
StatefulComponentElement
stateElement
=
StatefulComponentElement
stateElement
=
tester
.
findElement
((
element
)
=>
element
is
StatefulComponentElement
);
tester
.
findElement
((
Element
element
)
=>
element
is
StatefulComponentElement
);
expect
(
stateElement
,
isNotNull
);
expect
(
stateElement
,
isNotNull
);
expect
(
stateElement
.
state
is
FlipComponentState
,
isTrue
);
expect
(
stateElement
.
state
is
FlipComponentState
,
isTrue
);
FlipComponentState
state
=
stateElement
.
state
;
FlipComponentState
state
=
stateElement
.
state
;
...
...
packages/unit/test/widget/transform_test.dart
View file @
5b72a2fd
...
@@ -8,7 +8,7 @@ void main() {
...
@@ -8,7 +8,7 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
bool
didReceiveTap
=
false
;
bool
didReceiveTap
=
false
;
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Positioned
(
new
Positioned
(
top:
100.0
,
top:
100.0
,
left:
100.0
,
left:
100.0
,
...
@@ -53,7 +53,7 @@ void main() {
...
@@ -53,7 +53,7 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
bool
didReceiveTap
=
false
;
bool
didReceiveTap
=
false
;
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Positioned
(
new
Positioned
(
top:
100.0
,
top:
100.0
,
left:
100.0
,
left:
100.0
,
...
@@ -98,7 +98,7 @@ void main() {
...
@@ -98,7 +98,7 @@ void main() {
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
bool
didReceiveTap
=
false
;
bool
didReceiveTap
=
false
;
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
([
new
Stack
(
<
Widget
>
[
new
Positioned
(
new
Positioned
(
top:
100.0
,
top:
100.0
,
left:
100.0
,
left:
100.0
,
...
...
packages/unit/test/widget/widget_tester.dart
View file @
5b72a2fd
...
@@ -24,11 +24,12 @@ class RootComponentState extends State<RootComponent> {
...
@@ -24,11 +24,12 @@ class RootComponentState extends State<RootComponent> {
Widget
build
(
BuildContext
context
)
=>
child
;
Widget
build
(
BuildContext
context
)
=>
child
;
}
}
typedef
Point
SizeToPointFunction
(
Size
size
);
class
WidgetTester
{
class
WidgetTester
{
WidgetTester
.
_
(
FakeAsync
async
)
WidgetTester
.
_
(
FakeAsync
async
)
:
async
=
async
,
:
async
=
async
,
clock
=
async
.
getClock
(
new
DateTime
.
utc
(
2015
,
1
,
1
))
{
clock
=
async
.
getClock
(
new
DateTime
.
utc
(
2015
,
1
,
1
));
}
final
FakeAsync
async
;
final
FakeAsync
async
;
final
Clock
clock
;
final
Clock
clock
;
...
@@ -46,7 +47,7 @@ class WidgetTester {
...
@@ -46,7 +47,7 @@ class WidgetTester {
}
}
List
<
Layer
>
_layers
(
Layer
layer
)
{
List
<
Layer
>
_layers
(
Layer
layer
)
{
List
<
Layer
>
result
=
[
layer
];
List
<
Layer
>
result
=
<
Layer
>
[
layer
];
if
(
layer
is
ContainerLayer
)
{
if
(
layer
is
ContainerLayer
)
{
ContainerLayer
root
=
layer
;
ContainerLayer
root
=
layer
;
Layer
child
=
root
.
firstChild
;
Layer
child
=
root
.
firstChild
;
...
@@ -124,7 +125,7 @@ class WidgetTester {
...
@@ -124,7 +125,7 @@ class WidgetTester {
return
_getElementPoint
(
element
,
(
Size
size
)
=>
size
.
bottomRight
(
Point
.
origin
));
return
_getElementPoint
(
element
,
(
Size
size
)
=>
size
.
bottomRight
(
Point
.
origin
));
}
}
Point
_getElementPoint
(
Element
element
,
Function
sizeToPoint
)
{
Point
_getElementPoint
(
Element
element
,
SizeToPoint
Function
sizeToPoint
)
{
assert
(
element
!=
null
);
assert
(
element
!=
null
);
RenderBox
box
=
element
.
renderObject
as
RenderBox
;
RenderBox
box
=
element
.
renderObject
as
RenderBox
;
assert
(
box
!=
null
);
assert
(
box
!=
null
);
...
...
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