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
1a15cb2d
Commit
1a15cb2d
authored
Aug 26, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #854 from abarth/sector_broken
Sector demo is broken because of compositor changes
parents
51f3fdcb
2e2fa94e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
8 deletions
+52
-8
sector_layout.dart
examples/rendering/sector_layout.dart
+12
-0
sector_layout_test.dart
packages/unit/test/examples/sector_layout_test.dart
+10
-0
layout_utils.dart
packages/unit/test/rendering/layout_utils.dart
+27
-5
viewport_test.dart
packages/unit/test/rendering/viewport_test.dart
+3
-3
No files found.
examples/rendering/sector_layout.dart
View file @
1a15cb2d
...
...
@@ -166,6 +166,14 @@ class RenderSectorWithChildren extends RenderDecoratedSector with ContainerRende
child
=
child
.
parentData
.
previousSibling
;
}
}
void
visitChildren
(
RenderObjectVisitor
visitor
)
{
RenderSector
child
=
lastChild
;
while
(
child
!=
null
)
{
visitor
(
child
);
child
=
child
.
parentData
.
previousSibling
;
}
}
}
class
RenderSectorRing
extends
RenderSectorWithChildren
{
...
...
@@ -413,6 +421,10 @@ class RenderBoxToRenderSectorAdapter extends RenderBox {
child
.
parentData
=
new
SectorParentData
();
}
void
visitChildren
(
RenderObjectVisitor
visitor
)
{
visitor
(
_child
);
}
double
getMinIntrinsicWidth
(
BoxConstraints
constraints
)
{
if
(
child
==
null
)
return
super
.
getMinIntrinsicWidth
(
constraints
);
...
...
packages/unit/test/examples/sector_layout_test.dart
0 → 100644
View file @
1a15cb2d
import
'package:test/test.dart'
;
import
'../rendering/layout_utils.dart'
;
import
'../../../../examples/rendering/sector_layout.dart'
;
void
main
(
)
{
test
(
'Sector layout can paint'
,
()
{
RenderingTester
tester
=
new
RenderingTester
(
root:
buildSectorExample
());
tester
.
pumpFrame
();
});
}
packages/unit/test/rendering/layout_utils.dart
View file @
1a15cb2d
...
...
@@ -7,14 +7,36 @@ class TestRenderView extends RenderView {
attach
();
rootConstraints
=
new
ViewConstraints
(
size:
_kTestViewSize
);
scheduleInitialLayout
();
scheduleInitialPaint
(
new
TransformLayer
(
transform:
new
Matrix4
.
identity
()));
}
}
enum
EnginePhase
{
layout
,
paint
,
composite
}
class
RenderingTester
{
RenderingTester
({
RenderBox
root
})
{
renderView
=
new
TestRenderView
(
child:
root
);
}
RenderView
renderView
;
void
beginFrame
(
double
timeStamp
)
{
void
pumpFrame
({
EnginePhase
phase:
EnginePhase
.
composite
}
)
{
RenderObject
.
flushLayout
();
if
(
phase
==
EnginePhase
.
layout
)
return
;
renderView
.
updateCompositingBits
();
RenderObject
.
flushPaint
();
if
(
phase
==
EnginePhase
.
paint
)
return
;
renderView
.
compositeFrame
();
}
}
Render
View
layout
(
RenderBox
box
,
{
BoxConstraints
constraints
})
{
Render
ingTester
layout
(
RenderBox
box
,
{
BoxConstraints
constraints
})
{
if
(
constraints
!=
null
)
{
box
=
new
RenderPositionedBox
(
child:
new
RenderConstrainedBox
(
...
...
@@ -24,7 +46,7 @@ RenderView layout(RenderBox box, { BoxConstraints constraints }) {
);
}
TestRenderView
renderView
=
new
TestRenderView
(
child
:
box
);
renderView
.
beginFrame
(
0.0
);
return
renderView
;
RenderingTester
tester
=
new
RenderingTester
(
root
:
box
);
tester
.
pumpFrame
(
phase:
EnginePhase
.
layout
);
return
tester
;
}
packages/unit/test/rendering/viewport_test.dart
View file @
1a15cb2d
...
...
@@ -15,16 +15,16 @@ void main() {
child:
size
);
RenderViewport
viewport
=
new
RenderViewport
(
child:
red
,
scrollOffset:
new
Offset
(
0.0
,
-
10.0
));
Render
View
renderView
=
layout
(
viewport
);
Render
ingTester
tester
=
layout
(
viewport
);
HitTestResult
result
;
result
=
new
HitTestResult
();
renderView
.
hitTest
(
result
,
position:
new
Point
(
15.0
,
0.0
));
tester
.
renderView
.
hitTest
(
result
,
position:
new
Point
(
15.0
,
0.0
));
expect
(
result
.
path
.
first
.
target
,
equals
(
viewport
));
result
=
new
HitTestResult
();
renderView
.
hitTest
(
result
,
position:
new
Point
(
15.0
,
15.0
));
tester
.
renderView
.
hitTest
(
result
,
position:
new
Point
(
15.0
,
15.0
));
expect
(
result
.
path
.
first
.
target
,
equals
(
size
));
});
}
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