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
ac7c3a00
Commit
ac7c3a00
authored
Aug 21, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate RenderBox tests to box_test.dart
parent
855b8eb2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
box_test.dart
packages/unit/test/rendering/box_test.dart
+77
-0
No files found.
packages/unit/test/rendering/box_test.dart
0 → 100644
View file @
ac7c3a00
import
'package:sky/rendering.dart'
;
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/theme/shadows.dart'
;
import
'package:test/test.dart'
;
import
'layout_utils.dart'
;
void
main
(
)
{
test
(
"should size to render view"
,
()
{
RenderBox
root
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFF00FF00
),
gradient:
new
RadialGradient
(
center:
Point
.
origin
,
radius:
500.0
,
colors:
[
colors
.
Yellow
[
500
],
colors
.
Blue
[
500
]]),
boxShadow:
shadows
[
3
])
);
layout
(
root
);
expect
(
root
.
size
.
width
,
equals
(
800.0
));
expect
(
root
.
size
.
height
,
equals
(
600.0
));
});
test
(
'Flex and padding'
,
()
{
RenderBox
size
=
new
RenderConstrainedBox
(
additionalConstraints:
new
BoxConstraints
().
applyHeight
(
100.0
)
);
RenderBox
inner
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFF00FF00
)
),
child:
size
);
RenderBox
padding
=
new
RenderPadding
(
padding:
new
EdgeDims
.
all
(
50.0
),
child:
inner
);
RenderBox
flex
=
new
RenderFlex
(
children:
[
padding
],
direction:
FlexDirection
.
vertical
,
alignItems:
FlexAlignItems
.
stretch
);
RenderBox
outer
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
(
backgroundColor:
const
Color
(
0xFF0000FF
)
),
child:
flex
);
layout
(
outer
);
expect
(
size
.
size
.
width
,
equals
(
700.0
));
expect
(
size
.
size
.
height
,
equals
(
100.0
));
expect
(
inner
.
size
.
width
,
equals
(
700.0
));
expect
(
inner
.
size
.
height
,
equals
(
100.0
));
expect
(
padding
.
size
.
width
,
equals
(
800.0
));
expect
(
padding
.
size
.
height
,
equals
(
200.0
));
expect
(
flex
.
size
.
width
,
equals
(
800.0
));
expect
(
flex
.
size
.
height
,
equals
(
600.0
));
expect
(
outer
.
size
.
width
,
equals
(
800.0
));
expect
(
outer
.
size
.
height
,
equals
(
600.0
));
});
test
(
"should not have a 0 sized colored Box"
,
()
{
var
coloredBox
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
()
);
var
paddingBox
=
new
RenderPadding
(
padding:
const
EdgeDims
.
all
(
10.0
),
child:
coloredBox
);
RenderBox
root
=
new
RenderDecoratedBox
(
decoration:
new
BoxDecoration
(),
child:
paddingBox
);
layout
(
root
);
expect
(
coloredBox
.
size
.
width
,
equals
(
780.0
));
expect
(
coloredBox
.
size
.
height
,
equals
(
580.0
));
});
}
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