Index: sky/tests/resources/display_list.dart |
diff --git a/sky/tests/resources/display_list.dart b/sky/tests/resources/display_list.dart |
index 95ed3aca955cf471daebf37038759ba32167aaad..71f5202ac714957e7ba06467b92df1179b055a6a 100644 |
--- a/sky/tests/resources/display_list.dart |
+++ b/sky/tests/resources/display_list.dart |
@@ -1,8 +1,9 @@ |
-import 'package:sky/framework/rendering/object.dart'; |
-import 'package:sky/framework/rendering/box.dart'; |
import 'dart:sky' as sky; |
+import 'package:sky/framework/rendering/box.dart'; |
+import 'package:sky/framework/rendering/object.dart'; |
+ |
typedef void Logger (String s); |
class TestDisplayList extends RenderObjectDisplayList { |
@@ -22,7 +23,8 @@ class TestDisplayList extends RenderObjectDisplayList { |
logger("${indent} ${s}"); |
} |
- String explainPaint(sky.Paint paint) { |
+ String explainPaint(Paint paint) { |
+ assert(paint.toString() == "Instance of 'Paint'"); // if this assertion fails, remove all calls to explainPaint with just inlining $paint |
return "Paint(${paint.color})"; |
} |
@@ -30,8 +32,8 @@ class TestDisplayList extends RenderObjectDisplayList { |
log("save"); |
} |
- void saveLayer(sky.Rect bounds, sky.Paint paint) { |
- log("saveLayer(${bounds.top}:${bounds.left}:${bounds.bottom}:${bounds.right}, ${explainPaint(paint)})"); |
+ void saveLayer(Rect bounds, Paint paint) { |
+ log("saveLayer($bounds, ${explainPaint(paint)})"); |
} |
void restore() { |
@@ -58,47 +60,68 @@ class TestDisplayList extends RenderObjectDisplayList { |
log("concat($matrix9)"); |
} |
- void clipRect(sky.Rect rect) { |
- log("clipRect(${rect.top}:${rect.left}:${rect.bottom}:${rect.right})"); |
+ void clipRect(Rect rect) { |
+ log("clipRect($rect)"); |
+ } |
+ |
+ void clipRRect(sky.RRect rrect) { |
+ log("clipRRect()"); |
+ } |
+ |
+ void clipPath(Path path) { |
+ log("clipPath($path)"); |
+ } |
+ |
+ void drawLine(double x0, double y0, double x1, double y1, Paint paint) { |
+ log("drawLine($x0, $y0, $x1, $y1, ${explainPaint(paint)})"); |
} |
void drawPicture(sky.Picture picture) { |
- log("drawPicture()"); |
+ log("drawPicture($picture)"); |
} |
- void drawPaint(sky.Paint paint) { |
+ void drawPaint(Paint paint) { |
log("drawPaint(${explainPaint(paint)})"); |
} |
- void drawRect(sky.Rect rect, sky.Paint paint) { |
- log("drawRect(${rect.top}:${rect.left}:${rect.bottom}:${rect.right}, ${explainPaint(paint)})"); |
+ void drawRect(Rect rect, Paint paint) { |
+ log("drawRect($rect, ${explainPaint(paint)})"); |
} |
- void drawOval(sky.Rect rect, sky.Paint paint) { |
- log("drawOval(${rect.top}:${rect.left}:${rect.bottom}:${rect.right}, ${explainPaint(paint)})"); |
+ void drawRRect(sky.RRect rrect, Paint paint) { |
+ log("drawRRect($rrect, ${explainPaint(paint)})"); |
} |
- void drawCircle(double x, double y, double radius, sky.Paint paint) { |
+ void drawOval(Rect rect, Paint paint) { |
+ log("drawOval($rect, ${explainPaint(paint)})"); |
+ } |
+ |
+ void drawCircle(double x, double y, double radius, Paint paint) { |
log("drawCircle($x, $y, $radius, ${explainPaint(paint)})"); |
} |
- void drawPath(sky.Path path, sky.Paint paint) { |
- log("drawPath(Path, ${explainPaint(paint)})"); |
+ void drawPath(Path path, Paint paint) { |
+ log("drawPath($path, ${explainPaint(paint)})"); |
+ } |
+ |
+ void drawImage(sky.Image image, double x, double y, Paint paint) { |
+ log("drawImage($image, $x, $y, ${explainPaint(paint)})"); |
} |
- void paintChild(RenderObject child, sky.Point position) { |
- log("paintChild at ${position.x},${position.y}"); |
+ void paintChild(RenderObject child, Point position) { |
+ log("paintChild ${child.runtimeType} at $position"); |
child.paint(new TestDisplayList(width, height, logger, indent: "$indent |")); |
} |
} |
-class TestView extends RenderView { |
+class TestRenderView extends RenderView { |
- TestView({ |
- RenderBox child, |
- Duration timeForRotation |
- }) : super(child: child, timeForRotation: timeForRotation) { |
- print("TestView enabled"); |
+ TestRenderView([ RenderBox child = null ]) : super(child: child) { |
+ print("TestRenderView enabled"); |
+ attach(); |
+ rootConstraints = new ViewConstraints(width: 800.0, height: 600.0); // arbitrary figures |
+ scheduleInitialLayout(); |
+ checkFrame(); |
} |
int frame = 0; |
@@ -111,37 +134,18 @@ class TestView extends RenderView { |
void paintFrame() { |
RenderObject.debugDoingPaint = true; |
frame += 1; |
+ lastPaint = ''; |
log("PAINT FOR FRAME #${frame} ----------------------------------------------"); |
- var canvas = new TestDisplayList(sky.view.width, sky.view.height, log, indent: "${frame} |"); |
+ var canvas = new TestDisplayList(rootConstraints.width, rootConstraints.height, log, indent: "${frame} |"); |
paint(canvas); |
log("------------------------------------------------------------------------"); |
RenderObject.debugDoingPaint = false; |
} |
-} |
- |
-class TestApp { |
- |
- TestApp(RenderBox root) { |
- _renderView = new TestView(child: root); |
- _renderView.attach(); |
- _renderView.rootConstraints = new ViewConstraints(width: sky.view.width, height: sky.view.height); |
- _renderView.scheduleInitialLayout(); |
- RenderObject.flushLayout(); |
- _renderView.paintFrame(); |
- print(_renderView.lastPaint); // TODO(ianh): figure out how to make this fit the unit testing framework better |
- } |
- |
- RenderView _renderView; |
- |
- RenderBox get root => _renderView.child; |
- void set root(RenderBox value) { |
- _renderView.child = value; |
- } |
- void _beginFrame(double timeStamp) { |
+ void checkFrame() { |
RenderObject.flushLayout(); |
- _renderView.paintFrame(); |
- print(_renderView.lastPaint); // TODO(ianh): figure out how to make this fit the unit testing framework better |
+ paintFrame(); |
+ print(lastPaint); // TODO(ianh): figure out how to make this fit the unit testing framework better |
} |
} |