Commit 1a15cb2d authored by Adam Barth's avatar Adam Barth

Merge pull request #854 from abarth/sector_broken

Sector demo is broken because of compositor changes
parents 51f3fdcb 2e2fa94e
......@@ -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);
......
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();
});
}
......@@ -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();
}
}
RenderView layout(RenderBox box, { BoxConstraints constraints }) {
RenderingTester 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;
}
......@@ -15,16 +15,16 @@ void main() {
child: size);
RenderViewport viewport = new RenderViewport(child: red, scrollOffset: new Offset(0.0, -10.0));
RenderView renderView = layout(viewport);
RenderingTester 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));
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment