Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1213)

Side by Side Diff: sky/tests/resources/display_list.dart

Issue 1185423003: Add a Paint::toString() method to describe our Paint objects. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: abarth Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/tests/raw/sector_layout-expected.txt ('k') | sky/tests/widgets/buttons-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 import 'dart:async'; 2 import 'dart:async';
3 import 'dart:sky' as sky; 3 import 'dart:sky' as sky;
4 import "dart:sky.internals" as internals; 4 import "dart:sky.internals" as internals;
5 5
6 import 'package:sky/widgets/basic.dart'; 6 import 'package:sky/widgets/basic.dart';
7 import 'package:sky/rendering/box.dart'; 7 import 'package:sky/rendering/box.dart';
8 import 'package:sky/rendering/object.dart'; 8 import 'package:sky/rendering/object.dart';
9 9
10 typedef void Logger (String s); 10 typedef void Logger (String s);
11 11
12 class TestDisplayList extends RenderObjectDisplayList { 12 class TestDisplayList extends RenderObjectDisplayList {
13 TestDisplayList(double width, double height, this.logger, { this.indent: '' }) : 13 TestDisplayList(double width, double height, this.logger, { this.indent: '' }) :
14 this.width = width, 14 this.width = width,
15 this.height = height, 15 this.height = height,
16 super(width, height) { 16 super(width, height) {
17 log("TestDisplayList() constructor: $width x $height"); 17 log("TestDisplayList() constructor: $width x $height");
18 } 18 }
19 19
20 final String indent; 20 final String indent;
21 final double width; 21 final double width;
22 final double height; 22 final double height;
23 23
24 Logger logger; 24 Logger logger;
25 void log(String s) { 25 void log(String s) {
26 logger("${indent} ${s}"); 26 logger("${indent} ${s}");
27 } 27 }
28 28
29 String explainPaint(Paint paint) {
30 assert(paint.toString() == "Instance of 'Paint'"); // if this assertion fail s, remove all calls to explainPaint with just inlining $paint
31 return "Paint(${paint.color})";
32 }
33
34 void save() { 29 void save() {
35 log("save"); 30 log("save");
36 } 31 }
37 32
38 void saveLayer(Rect bounds, Paint paint) { 33 void saveLayer(Rect bounds, Paint paint) {
39 log("saveLayer($bounds, ${explainPaint(paint)})"); 34 log("saveLayer($bounds, $paint)");
40 } 35 }
41 36
42 void restore() { 37 void restore() {
43 log("restore"); 38 log("restore");
44 } 39 }
45 40
46 void translate(double dx, double dy) { 41 void translate(double dx, double dy) {
47 log("translate($dx, $dy)"); 42 log("translate($dx, $dy)");
48 } 43 }
49 44
(...skipping 19 matching lines...) Expand all
69 64
70 void clipRRect(sky.RRect rrect) { 65 void clipRRect(sky.RRect rrect) {
71 log("clipRRect()"); 66 log("clipRRect()");
72 } 67 }
73 68
74 void clipPath(Path path) { 69 void clipPath(Path path) {
75 log("clipPath($path)"); 70 log("clipPath($path)");
76 } 71 }
77 72
78 void drawLine(double x0, double y0, double x1, double y1, Paint paint) { 73 void drawLine(double x0, double y0, double x1, double y1, Paint paint) {
79 log("drawLine($x0, $y0, $x1, $y1, ${explainPaint(paint)})"); 74 log("drawLine($x0, $y0, $x1, $y1, $paint)");
80 } 75 }
81 76
82 void drawPicture(sky.Picture picture) { 77 void drawPicture(sky.Picture picture) {
83 log("drawPicture($picture)"); 78 log("drawPicture($picture)");
84 } 79 }
85 80
86 void drawPaint(Paint paint) { 81 void drawPaint(Paint paint) {
87 log("drawPaint(${explainPaint(paint)})"); 82 log("drawPaint($paint)");
88 } 83 }
89 84
90 void drawRect(Rect rect, Paint paint) { 85 void drawRect(Rect rect, Paint paint) {
91 log("drawRect($rect, ${explainPaint(paint)})"); 86 log("drawRect($rect, $paint)");
92 } 87 }
93 88
94 void drawRRect(sky.RRect rrect, Paint paint) { 89 void drawRRect(sky.RRect rrect, Paint paint) {
95 log("drawRRect($rrect, ${explainPaint(paint)})"); 90 log("drawRRect($rrect, $paint)");
96 } 91 }
97 92
98 void drawOval(Rect rect, Paint paint) { 93 void drawOval(Rect rect, Paint paint) {
99 log("drawOval($rect, ${explainPaint(paint)})"); 94 log("drawOval($rect, $paint)");
100 } 95 }
101 96
102 void drawCircle(double x, double y, double radius, Paint paint) { 97 void drawCircle(double x, double y, double radius, Paint paint) {
103 log("drawCircle($x, $y, $radius, ${explainPaint(paint)})"); 98 log("drawCircle($x, $y, $radius, $paint)");
104 } 99 }
105 100
106 void drawPath(Path path, Paint paint) { 101 void drawPath(Path path, Paint paint) {
107 log("drawPath($path, ${explainPaint(paint)})"); 102 log("drawPath($path, $paint)");
108 } 103 }
109 104
110 void drawImage(sky.Image image, double x, double y, Paint paint) { 105 void drawImage(sky.Image image, double x, double y, Paint paint) {
111 log("drawImage($image, $x, $y, ${explainPaint(paint)})"); 106 log("drawImage($image, $x, $y, $paint)");
112 } 107 }
113 108
114 void paintChild(RenderObject child, Point position) { 109 void paintChild(RenderObject child, Point position) {
115 log("paintChild ${child.runtimeType} at $position"); 110 log("paintChild ${child.runtimeType} at $position");
116 child.paint(new TestDisplayList(width, height, logger, indent: "$indent |") ); 111 child.paint(new TestDisplayList(width, height, logger, indent: "$indent |") );
117 } 112 }
118 } 113 }
119 114
120 class TestRenderView extends RenderView { 115 class TestRenderView extends RenderView {
121 116
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 173
179 Future test(Function builder) { 174 Future test(Function builder) {
180 runApp(new TestApp(builder: builder), renderViewOverride: renderView); 175 runApp(new TestApp(builder: builder), renderViewOverride: renderView);
181 return renderView.checkFrame(); 176 return renderView.checkFrame();
182 } 177 }
183 178
184 void endTest() { 179 void endTest() {
185 renderView.endTest(); 180 renderView.endTest();
186 } 181 }
187 } 182 }
OLDNEW
« no previous file with comments | « sky/tests/raw/sector_layout-expected.txt ('k') | sky/tests/widgets/buttons-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698