blob: 38ccc909e0e323eff4f37b2952d2a3630b5d9cab [file] [log] [blame]
reed@google.com37f3ae02011-11-28 16:06:04 +00001
2/*
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +00003 * Copyright 2012 Google Inc.
reed@google.com37f3ae02011-11-28 16:06:04 +00004 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +00008
9/* Description:
10 * This test defines a series of elementatry test steps that perform
11 * a single or a small group of canvas API calls. Each test step is
12 * used in several test cases that verify that different types of SkCanvas
13 * flavors and derivatives pass it and yield consistent behavior. The
14 * test cases analyse results that are queryable through the API. They do
15 * not look at rendering results.
16 *
17 * Adding test stepss:
18 * The general pattern for creating a new test step is to write a test
19 * function of the form:
20 *
21 * static void MyTestStepFunction(SkCanvas* canvas,
22 * skiatest::Reporter* reporter,
23 * CanvasTestStep* testStep)
24 * {
25 * canvas->someCanvasAPImethod();
26 * (...)
27 * REPORTER_ASSERT_MESSAGE(reporter, (...), \
28 * testStep->assertMessage());
29 * }
30 *
31 * The definition of the test step function should be followed by an
32 * invocation of the TEST_STEP macro, which generates a class and
33 * instance for the test step:
34 *
35 * TEST_STEP(MyTestStep, MyTestStepFunction)
36 *
37 * There are also short hand macros for defining simple test steps
38 * in a single line of code. A simple test step is a one that is made
39 * of a single canvas API call.
40 *
41 * SIMPLE_TEST_STEP(MytestStep, someCanvasAPIMethod());
42 *
43 * There is another macro called SIMPLE_TEST_STEP_WITH_ASSERT that
44 * works the same way as SIMPLE_TEST_STEP, and additionally verifies
45 * that the invoked method returns a non-zero value.
46 */
reed@google.com37f3ae02011-11-28 16:06:04 +000047#include "SkBitmap.h"
48#include "SkCanvas.h"
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +000049#include "SkDeferredCanvas.h"
50#include "SkDevice.h"
51#include "SkMatrix.h"
52#include "SkNWayCanvas.h"
53#include "SkPaint.h"
54#include "SkPath.h"
55#include "SkPicture.h"
56#include "SkPictureRecord.h"
57#include "SkProxyCanvas.h"
58#include "SkRect.h"
59#include "SkRegion.h"
60#include "SkShader.h"
61#include "SkStream.h"
62#include "SkTDArray.h"
63#include "Test.h"
reed@google.com37f3ae02011-11-28 16:06:04 +000064
reed@google.com90c07ea2012-04-13 13:50:27 +000065class Canvas2CanvasClipVisitor : public SkCanvas::ClipVisitor {
66public:
67 Canvas2CanvasClipVisitor(SkCanvas* target) : fTarget(target) {}
68
69 virtual void clipRect(const SkRect& r, SkRegion::Op op, bool aa) {
70 fTarget->clipRect(r, op, aa);
71 }
72 virtual void clipPath(const SkPath& p, SkRegion::Op op, bool aa) {
73 fTarget->clipPath(p, op, aa);
74 }
75
76private:
77 SkCanvas* fTarget;
78};
79
80static void test_clipVisitor(skiatest::Reporter* reporter, SkCanvas* canvas) {
81 SkISize size = canvas->getDeviceSize();
82
83 SkBitmap bm;
84 bm.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height());
85 SkCanvas c(bm);
86
87 Canvas2CanvasClipVisitor visitor(&c);
88 canvas->replayClips(&visitor);
89
90 REPORTER_ASSERT(reporter, c.getTotalClip() == canvas->getTotalClip());
91}
92
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +000093static const int kWidth = 2;
94static const int kHeight = 2;
95// Maximum stream length for picture serialization
96static const size_t kMaxPictureBufferSize = 1024;
reed@google.com7c202932011-12-14 18:48:05 +000097
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +000098// Format strings that describe the test context. The %s token is where
99// the name of the test step is inserted. The context is required for
100// disambiguating the error in the case of failures that are reported in
101// functions that are called multiple times in different contexts (test
102// cases and test steps).
103static const char* const kDefaultAssertMessageFormat = "%s";
104static const char* const kCanvasDrawAssertMessageFormat =
105 "Drawing test step %s with SkCanvas";
106static const char* const kPictureDrawAssertMessageFormat =
107 "Drawing test step %s with SkPicture";
108static const char* const kPictureSecondDrawAssertMessageFormat =
109 "Duplicate draw of test step %s with SkPicture";
110static const char* const kPictureReDrawAssertMessageFormat =
111 "Playing back test step %s from an SkPicture to another SkPicture";
112static const char* const kDeferredDrawAssertMessageFormat =
113 "Drawing test step %s with SkDeferredCanvas";
114static const char* const kProxyDrawAssertMessageFormat =
115 "Drawing test step %s with SkProxyCanvas";
116static const char* const kNWayDrawAssertMessageFormat =
117 "Drawing test step %s with SkNWayCanvas";
118static const char* const kRoundTripAssertMessageFormat =
119 "test step %s, SkPicture consistency after round trip";
120static const char* const kPictureRecoringAssertMessageFormat =
121 "test step %s, SkPicture state consistency after recording";
122static const char* const kPicturePlaybackAssertMessageFormat =
123 "test step %s, SkPicture state consistency in playback canvas";
124static const char* const kDeferredPreFlushAssertMessageFormat =
125 "test step %s, SkDeferredCanvas state consistency before flush";
junov@chromium.orgcff01c52012-07-18 21:50:26 +0000126static const char* const kDeferredPostFlushPlaybackAssertMessageFormat =
127 "test step %s, SkDeferredCanvas playback canvas state consistency after flush";
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000128static const char* const kDeferredPostFlushAssertMessageFormat =
129 "test step %s, SkDeferredCanvas state consistency after flush";
130static const char* const kPictureResourceReuseMessageFormat =
131 "test step %s, SkPicture duplicate flattened object test";
132static const char* const kProxyStateAssertMessageFormat =
133 "test step %s, SkProxyCanvas state consistency";
134static const char* const kProxyIndirectStateAssertMessageFormat =
135 "test step %s, SkProxyCanvas indirect canvas state consistency";
136static const char* const kNWayStateAssertMessageFormat =
137 "test step %s, SkNWayCanvas state consistency";
138static const char* const kNWayIndirect1StateAssertMessageFormat =
139 "test step %s, SkNWayCanvas indirect canvas 1 state consistency";
140static const char* const kNWayIndirect2StateAssertMessageFormat =
141 "test step %s, SkNWayCanvas indirect canvas 2 state consistency";
142
143static void createBitmap(SkBitmap* bm, SkBitmap::Config config, SkColor color) {
144 bm->setConfig(config, kWidth, kHeight);
145 bm->allocPixels();
146 bm->eraseColor(color);
147}
148
149class CanvasTestStep;
150static SkTDArray<CanvasTestStep*>& testStepArray() {
151 static SkTDArray<CanvasTestStep*> theTests;
152 return theTests;
153}
154
155class CanvasTestStep {
156public:
157 CanvasTestStep() {
158 *testStepArray().append() = this;
159 fAssertMessageFormat = kDefaultAssertMessageFormat;
160 }
djsollen@google.come63793a2012-03-21 15:39:03 +0000161 virtual ~CanvasTestStep() { }
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000162
163 virtual void draw(SkCanvas*, skiatest::Reporter*) = 0;
164 virtual const char* name() const = 0;
165
166 const char* assertMessage() {
167 fAssertMessage.printf(fAssertMessageFormat, name());
168 return fAssertMessage.c_str();
169 }
170
171 void setAssertMessageFormat(const char* format) {
172 fAssertMessageFormat = format;
173 }
174
175private:
176 SkString fAssertMessage;
177 const char* fAssertMessageFormat;
178};
179
180///////////////////////////////////////////////////////////////////////////////
181// Constants used by test steps
182
183const SkRect kTestRect =
184 SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScalar(0),
185 SkIntToScalar(2), SkIntToScalar(1));
186static SkMatrix testMatrix() {
187 SkMatrix matrix;
188 matrix.reset();
189 matrix.setScale(SkIntToScalar(2), SkIntToScalar(3));
190 return matrix;
191}
192const SkMatrix kTestMatrix = testMatrix();
193static SkPath testPath() {
194 SkPath path;
195 path.addRect(SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScalar(0),
196 SkIntToScalar(2), SkIntToScalar(1)));
197 return path;
198}
199const SkPath kTestPath = testPath();
200static SkRegion testRegion() {
201 SkRegion region;
202 SkIRect rect = SkIRect::MakeXYWH(0, 0, 2, 1);
203 region.setRect(rect);
204 return region;
205}
206const SkIRect kTestIRect = SkIRect::MakeXYWH(0, 0, 2, 1);
207const SkRegion kTestRegion = testRegion();
208const SkColor kTestColor = 0x01020304;
209const SkPaint kTestPaint;
210const SkPoint kTestPoints[3] = {
211 {SkIntToScalar(0), SkIntToScalar(0)},
212 {SkIntToScalar(2), SkIntToScalar(1)},
213 {SkIntToScalar(0), SkIntToScalar(2)}
214};
215const size_t kTestPointCount = 3;
216static SkBitmap testBitmap() {
217 SkBitmap bitmap;
218 createBitmap(&bitmap, SkBitmap::kARGB_8888_Config, 0x05060708);
219 return bitmap;
220}
221SkBitmap kTestBitmap; // cannot be created during static init
222SkString kTestText("Hello World");
robertphillips@google.com977b9c82012-06-05 19:35:09 +0000223SkPoint kTestPoints2[] = {
224 { SkIntToScalar(0), SkIntToScalar(1) },
225 { SkIntToScalar(1), SkIntToScalar(1) },
226 { SkIntToScalar(2), SkIntToScalar(1) },
227 { SkIntToScalar(3), SkIntToScalar(1) },
228 { SkIntToScalar(4), SkIntToScalar(1) },
229 { SkIntToScalar(5), SkIntToScalar(1) },
230 { SkIntToScalar(6), SkIntToScalar(1) },
231 { SkIntToScalar(7), SkIntToScalar(1) },
232 { SkIntToScalar(8), SkIntToScalar(1) },
233 { SkIntToScalar(9), SkIntToScalar(1) },
234 { SkIntToScalar(10), SkIntToScalar(1) },
235};
236
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000237
238///////////////////////////////////////////////////////////////////////////////
239// Macros for defining test steps
240
241#define TEST_STEP(NAME, FUNCTION) \
242class NAME##_TestStep : public CanvasTestStep{ \
243public: \
244 virtual void draw(SkCanvas* canvas, skiatest::Reporter* reporter) { \
245 FUNCTION (canvas, reporter, this); \
246 } \
247 virtual const char* name() const {return #NAME ;} \
248}; \
249static NAME##_TestStep NAME##_TestStepInstance;
250
251#define SIMPLE_TEST_STEP(NAME, CALL) \
252static void NAME##TestStep(SkCanvas* canvas, skiatest::Reporter*, \
253 CanvasTestStep*) { \
254 canvas-> CALL ; \
255} \
256TEST_STEP(NAME, NAME##TestStep )
257
258#define SIMPLE_TEST_STEP_WITH_ASSERT(NAME, CALL) \
259static void NAME##TestStep(SkCanvas* canvas, skiatest::Reporter* reporter, \
260 CanvasTestStep* testStep) { \
261 REPORTER_ASSERT_MESSAGE(reporter, canvas-> CALL , \
262 testStep->assertMessage()); \
263} \
264TEST_STEP(NAME, NAME##TestStep )
265
266
267///////////////////////////////////////////////////////////////////////////////
268// Basic test steps for most virtual methods in SkCanvas that draw or affect
269// the state of the canvas.
270
junov@chromium.orga907ac32012-02-24 21:54:07 +0000271SIMPLE_TEST_STEP_WITH_ASSERT(Translate,
272 translate(SkIntToScalar(1), SkIntToScalar(2)));
273SIMPLE_TEST_STEP_WITH_ASSERT(Scale,
274 scale(SkIntToScalar(1), SkIntToScalar(2)));
275SIMPLE_TEST_STEP_WITH_ASSERT(Rotate, rotate(SkIntToScalar(1)));
276SIMPLE_TEST_STEP_WITH_ASSERT(Skew,
277 skew(SkIntToScalar(1), SkIntToScalar(2)));
278SIMPLE_TEST_STEP_WITH_ASSERT(Concat, concat(kTestMatrix));
279SIMPLE_TEST_STEP(SetMatrix, setMatrix(kTestMatrix));
junov@chromium.org4e6dfa52012-07-16 14:04:59 +0000280SIMPLE_TEST_STEP(ClipRect, clipRect(kTestRect));
281SIMPLE_TEST_STEP(ClipPath, clipPath(kTestPath));
282SIMPLE_TEST_STEP(ClipRegion,
junov@chromium.orga907ac32012-02-24 21:54:07 +0000283 clipRegion(kTestRegion, SkRegion::kReplace_Op));
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000284SIMPLE_TEST_STEP(Clear, clear(kTestColor));
285SIMPLE_TEST_STEP(DrawPaint, drawPaint(kTestPaint));
286SIMPLE_TEST_STEP(DrawPointsPoints, drawPoints(SkCanvas::kPoints_PointMode,
287 kTestPointCount, kTestPoints, kTestPaint));
288SIMPLE_TEST_STEP(DrawPointsLiness, drawPoints(SkCanvas::kLines_PointMode,
289 kTestPointCount, kTestPoints, kTestPaint));
290SIMPLE_TEST_STEP(DrawPointsPolygon, drawPoints(SkCanvas::kPolygon_PointMode,
291 kTestPointCount, kTestPoints, kTestPaint));
292SIMPLE_TEST_STEP(DrawRect, drawRect(kTestRect, kTestPaint));
293SIMPLE_TEST_STEP(DrawPath, drawPath(kTestPath, kTestPaint));
junov@chromium.org87f982c2012-02-23 21:34:34 +0000294SIMPLE_TEST_STEP(DrawBitmap, drawBitmap(kTestBitmap, 0, 0));
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000295SIMPLE_TEST_STEP(DrawBitmapPaint, drawBitmap(kTestBitmap, 0, 0, &kTestPaint));
296SIMPLE_TEST_STEP(DrawBitmapRect, drawBitmapRect(kTestBitmap, NULL, kTestRect,
297 NULL));
298SIMPLE_TEST_STEP(DrawBitmapRectSrcRect, drawBitmapRect(kTestBitmap,
299 &kTestIRect, kTestRect, NULL));
300SIMPLE_TEST_STEP(DrawBitmapRectPaint, drawBitmapRect(kTestBitmap, NULL,
301 kTestRect, &kTestPaint));
302SIMPLE_TEST_STEP(DrawBitmapMatrix, drawBitmapMatrix(kTestBitmap, kTestMatrix,
303 NULL));
304SIMPLE_TEST_STEP(DrawBitmapMatrixPaint, drawBitmapMatrix(kTestBitmap,
305 kTestMatrix, &kTestPaint));
306SIMPLE_TEST_STEP(DrawBitmapNine, drawBitmapNine(kTestBitmap, kTestIRect,
307 kTestRect, NULL));
308SIMPLE_TEST_STEP(DrawBitmapNinePaint, drawBitmapNine(kTestBitmap, kTestIRect,
309 kTestRect, &kTestPaint));
junov@chromium.org87f982c2012-02-23 21:34:34 +0000310SIMPLE_TEST_STEP(DrawSprite, drawSprite(kTestBitmap, 0, 0, NULL));
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000311SIMPLE_TEST_STEP(DrawSpritePaint, drawSprite(kTestBitmap, 0, 0, &kTestPaint));
312SIMPLE_TEST_STEP(DrawText, drawText(kTestText.c_str(), kTestText.size(),
313 0, 1, kTestPaint));
314SIMPLE_TEST_STEP(DrawPosText, drawPosText(kTestText.c_str(),
robertphillips@google.com977b9c82012-06-05 19:35:09 +0000315 kTestText.size(), kTestPoints2, kTestPaint));
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000316SIMPLE_TEST_STEP(DrawTextOnPath, drawTextOnPath(kTestText.c_str(),
317 kTestText.size(), kTestPath, NULL, kTestPaint));
318SIMPLE_TEST_STEP(DrawTextOnPathMatrix, drawTextOnPath(kTestText.c_str(),
319 kTestText.size(), kTestPath, &kTestMatrix, kTestPaint));
320SIMPLE_TEST_STEP(SetExternalMatrix, setExternalMatrix(&kTestMatrix));
321SIMPLE_TEST_STEP(DrawData, drawData(kTestText.c_str(), kTestText.size()));
322
323///////////////////////////////////////////////////////////////////////////////
324// Complex test steps
325
junov@chromium.org4e6dfa52012-07-16 14:04:59 +0000326// Save/restore calls cannot be in isolated simple test steps because the test
327// cases that use SkPicture require that save and restore calls be balanced.
328static void SaveMatrixStep(SkCanvas* canvas,
329 skiatest::Reporter* reporter,
330 CanvasTestStep* testStep) {
331 int saveCount = canvas->getSaveCount();
332 canvas->save(SkCanvas::kMatrix_SaveFlag);
333 canvas->clipRegion(kTestRegion);
334 canvas->translate(SkIntToScalar(1), SkIntToScalar(2));
335 canvas->restore();
336 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
337 testStep->assertMessage());
338 REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalMatrix().isIdentity(),
339 testStep->assertMessage());
340 REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalClip() == kTestRegion,
341 testStep->assertMessage());
342}
343TEST_STEP(SaveMatrix, SaveMatrixStep);
344
345static void SaveClipStep(SkCanvas* canvas,
346 skiatest::Reporter* reporter,
347 CanvasTestStep* testStep) {
348 int saveCount = canvas->getSaveCount();
349 canvas->save(SkCanvas::kClip_SaveFlag);
350 canvas->translate(SkIntToScalar(1), SkIntToScalar(2));
351 canvas->clipRegion(kTestRegion);
352 canvas->restore();
353 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
354 testStep->assertMessage());
355 REPORTER_ASSERT_MESSAGE(reporter, !canvas->getTotalMatrix().isIdentity(),
356 testStep->assertMessage());
357 REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalClip() != kTestRegion,
358 testStep->assertMessage());
359}
360TEST_STEP(SaveClip, SaveClipStep);
361
362static void SaveMatrixClipStep(SkCanvas* canvas,
363 skiatest::Reporter* reporter,
364 CanvasTestStep* testStep) {
365 int saveCount = canvas->getSaveCount();
366 canvas->save(SkCanvas::kMatrixClip_SaveFlag);
367 canvas->translate(SkIntToScalar(1), SkIntToScalar(2));
368 canvas->clipRegion(kTestRegion);
369 canvas->restore();
370 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
371 testStep->assertMessage());
372 REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalMatrix().isIdentity(),
373 testStep->assertMessage());
374 REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalClip() != kTestRegion,
375 testStep->assertMessage());
376}
377TEST_STEP(SaveMatrixClip, SaveMatrixClipStep);
378
379static void SaveLayerStep(SkCanvas* canvas,
380 skiatest::Reporter* reporter,
381 CanvasTestStep* testStep) {
382 int saveCount = canvas->getSaveCount();
383 canvas->saveLayer(NULL, NULL);
384 canvas->restore();
385 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
386 testStep->assertMessage());
387}
388TEST_STEP(SaveLayer, SaveLayerStep);
389
390static void BoundedSaveLayerStep(SkCanvas* canvas,
391 skiatest::Reporter* reporter,
392 CanvasTestStep* testStep) {
393 int saveCount = canvas->getSaveCount();
394 canvas->saveLayer(&kTestRect, NULL);
395 canvas->restore();
396 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
397 testStep->assertMessage());
398}
399TEST_STEP(BoundedSaveLayer, BoundedSaveLayerStep);
400
401static void PaintSaveLayerStep(SkCanvas* canvas,
402 skiatest::Reporter* reporter,
403 CanvasTestStep* testStep) {
404 int saveCount = canvas->getSaveCount();
405 canvas->saveLayer(NULL, &kTestPaint);
406 canvas->restore();
407 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount,
408 testStep->assertMessage());
409}
410TEST_STEP(PaintSaveLayer, PaintSaveLayerStep);
411
junov@chromium.orga6c9e0e2012-07-12 17:47:34 +0000412static void TwoClipOpsStep(SkCanvas* canvas,
junov@chromium.org4e6dfa52012-07-16 14:04:59 +0000413 skiatest::Reporter* reporter,
414 CanvasTestStep* testStep) {
junov@chromium.orga6c9e0e2012-07-12 17:47:34 +0000415 // This test exercises a functionality in SkPicture that leads to the
416 // recording of restore offset placeholders. This test will trigger an
417 // assertion at playback time if the placeholders are not properly
418 // filled when the recording ends.
419 canvas->clipRect(kTestRect);
420 canvas->clipRegion(kTestRegion);
421}
422TEST_STEP(TwoClipOps, TwoClipOpsStep);
423
epoger@google.com94fa43c2012-04-11 17:51:01 +0000424// exercise fix for http://code.google.com/p/skia/issues/detail?id=560
425// ('SkPathStroker::lineTo() fails for line with length SK_ScalarNearlyZero')
426static void DrawNearlyZeroLengthPathTestStep(SkCanvas* canvas,
427 skiatest::Reporter* reporter,
428 CanvasTestStep* testStep) {
429 SkPaint paint;
430 paint.setStrokeWidth(SkIntToScalar(1));
431 paint.setStyle(SkPaint::kStroke_Style);
432
433 SkPath path;
434 SkPoint pt1 = { 0, 0 };
435 SkPoint pt2 = { 0, SK_ScalarNearlyZero };
436 SkPoint pt3 = { SkIntToScalar(1), 0 };
437 SkPoint pt4 = { SkIntToScalar(1), SK_ScalarNearlyZero/2 };
438 path.moveTo(pt1);
439 path.lineTo(pt2);
440 path.lineTo(pt3);
441 path.lineTo(pt4);
442
443 canvas->drawPath(path, paint);
444}
445TEST_STEP(DrawNearlyZeroLengthPath, DrawNearlyZeroLengthPathTestStep);
446
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000447static void DrawVerticesShaderTestStep(SkCanvas* canvas,
448 skiatest::Reporter* reporter,
449 CanvasTestStep* testStep) {
450 SkPoint pts[4];
451 pts[0].set(0, 0);
452 pts[1].set(SkIntToScalar(kWidth), 0);
453 pts[2].set(SkIntToScalar(kWidth), SkIntToScalar(kHeight));
454 pts[3].set(0, SkIntToScalar(kHeight));
455 SkPaint paint;
456 SkShader* shader = SkShader::CreateBitmapShader(kTestBitmap,
457 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
458 paint.setShader(shader)->unref();
459 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, pts, pts,
460 NULL, NULL, NULL, 0, paint);
461}
462TEST_STEP(DrawVerticesShader, DrawVerticesShaderTestStep);
463
464static void DrawPictureTestStep(SkCanvas* canvas,
465 skiatest::Reporter* reporter,
466 CanvasTestStep* testStep) {
467 SkPicture* testPicture = SkNEW_ARGS(SkPicture, ());
468 SkAutoUnref aup(testPicture);
469 SkCanvas* testCanvas = testPicture->beginRecording(kWidth, kHeight);
470 testCanvas->scale(SkIntToScalar(2), SkIntToScalar(1));
471 testCanvas->clipRect(kTestRect);
472 testCanvas->drawRect(kTestRect, kTestPaint);
473 canvas->drawPicture(*testPicture);
474}
475TEST_STEP(DrawPicture, DrawPictureTestStep);
476
477static void SaveRestoreTestStep(SkCanvas* canvas,
478 skiatest::Reporter* reporter,
479 CanvasTestStep* testStep) {
junov@chromium.org4e6dfa52012-07-16 14:04:59 +0000480 int baseSaveCount = canvas->getSaveCount();
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000481 size_t n = canvas->save();
junov@chromium.org4e6dfa52012-07-16 14:04:59 +0000482 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount == n, testStep->assertMessage());
483 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount + 1 == canvas->getSaveCount(),
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000484 testStep->assertMessage());
485 canvas->save();
486 canvas->save();
junov@chromium.org4e6dfa52012-07-16 14:04:59 +0000487 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount + 3 == canvas->getSaveCount(),
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000488 testStep->assertMessage());
junov@chromium.org4e6dfa52012-07-16 14:04:59 +0000489 canvas->restoreToCount(baseSaveCount + 1);
490 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount + 1 == canvas->getSaveCount(),
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000491 testStep->assertMessage());
492
493 // should this pin to 1, or be a no-op, or crash?
494 canvas->restoreToCount(0);
495 REPORTER_ASSERT_MESSAGE(reporter, 1 == canvas->getSaveCount(),
496 testStep->assertMessage());
497}
498TEST_STEP(SaveRestore, SaveRestoreTestStep);
499
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000500static void DrawLayerTestStep(SkCanvas* canvas,
501 skiatest::Reporter* reporter,
502 CanvasTestStep* testStep) {
503 REPORTER_ASSERT_MESSAGE(reporter, !canvas->isDrawingToLayer(),
504 testStep->assertMessage());
505 canvas->save();
506 REPORTER_ASSERT_MESSAGE(reporter, !canvas->isDrawingToLayer(),
507 testStep->assertMessage());
junov@chromium.org4e6dfa52012-07-16 14:04:59 +0000508 canvas->restore();
reed@google.com7c202932011-12-14 18:48:05 +0000509
510 const SkRect* bounds = NULL; // null means include entire bounds
511 const SkPaint* paint = NULL;
512
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000513 canvas->saveLayer(bounds, paint);
514 REPORTER_ASSERT_MESSAGE(reporter, canvas->isDrawingToLayer(),
515 testStep->assertMessage());
516 canvas->restore();
517 REPORTER_ASSERT_MESSAGE(reporter, !canvas->isDrawingToLayer(),
518 testStep->assertMessage());
reed@google.com7c202932011-12-14 18:48:05 +0000519
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000520 canvas->saveLayer(bounds, paint);
521 canvas->saveLayer(bounds, paint);
522 REPORTER_ASSERT_MESSAGE(reporter, canvas->isDrawingToLayer(),
523 testStep->assertMessage());
524 canvas->restore();
525 REPORTER_ASSERT_MESSAGE(reporter, canvas->isDrawingToLayer(),
526 testStep->assertMessage());
527 canvas->restore();
reed@google.com7c202932011-12-14 18:48:05 +0000528 // now layer count should be 0
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000529 REPORTER_ASSERT_MESSAGE(reporter, !canvas->isDrawingToLayer(),
530 testStep->assertMessage());
531}
532TEST_STEP(DrawLayer, DrawLayerTestStep);
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000533
534static void AssertCanvasStatesEqual(skiatest::Reporter* reporter,
535 const SkCanvas* canvas1,
536 const SkCanvas* canvas2,
537 CanvasTestStep* testStep) {
538 REPORTER_ASSERT_MESSAGE(reporter, canvas1->getDeviceSize() ==
539 canvas2->getDeviceSize(), testStep->assertMessage());
540 REPORTER_ASSERT_MESSAGE(reporter, canvas1->getSaveCount() ==
541 canvas2->getSaveCount(), testStep->assertMessage());
542 REPORTER_ASSERT_MESSAGE(reporter, canvas1->isDrawingToLayer() ==
543 canvas2->isDrawingToLayer(), testStep->assertMessage());
544 SkRect bounds1, bounds2;
545 REPORTER_ASSERT_MESSAGE(reporter,
546 canvas1->getClipBounds(&bounds1, SkCanvas::kAA_EdgeType) ==
547 canvas2->getClipBounds(&bounds2, SkCanvas::kAA_EdgeType),
548 testStep->assertMessage());
549 REPORTER_ASSERT_MESSAGE(reporter, bounds1 == bounds2,
550 testStep->assertMessage());
551 REPORTER_ASSERT_MESSAGE(reporter,
552 canvas1->getClipBounds(&bounds1, SkCanvas::kBW_EdgeType) ==
553 canvas2->getClipBounds(&bounds2, SkCanvas::kBW_EdgeType),
554 testStep->assertMessage());
555 REPORTER_ASSERT_MESSAGE(reporter, bounds1 == bounds2,
556 testStep->assertMessage());
557 REPORTER_ASSERT_MESSAGE(reporter, canvas1->getDrawFilter() ==
558 canvas2->getDrawFilter(), testStep->assertMessage());
559 SkIRect deviceBounds1, deviceBounds2;
560 REPORTER_ASSERT_MESSAGE(reporter,
561 canvas1->getClipDeviceBounds(&deviceBounds1) ==
562 canvas2->getClipDeviceBounds(&deviceBounds2),
563 testStep->assertMessage());
564 REPORTER_ASSERT_MESSAGE(reporter, deviceBounds1 == deviceBounds2,
565 testStep->assertMessage());
566 REPORTER_ASSERT_MESSAGE(reporter, canvas1->getBounder() ==
567 canvas2->getBounder(), testStep->assertMessage());
568 REPORTER_ASSERT_MESSAGE(reporter, canvas1->getTotalMatrix() ==
569 canvas2->getTotalMatrix(), testStep->assertMessage());
570 REPORTER_ASSERT_MESSAGE(reporter, canvas1->getClipType() ==
571 canvas2->getClipType(), testStep->assertMessage());
572 REPORTER_ASSERT_MESSAGE(reporter, canvas1->getTotalClip() ==
573 canvas2->getTotalClip(), testStep->assertMessage());
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000574
575 // The following test code is commented out because the test fails when
576 // the canvas is an SkPictureRecord or SkDeferredCanvas
577 // Issue: http://code.google.com/p/skia/issues/detail?id=498
578 // Also, creating a LayerIter on an SkProxyCanvas crashes
579 // Issue: http://code.google.com/p/skia/issues/detail?id=499
580 /*
581 SkCanvas::LayerIter layerIter1(const_cast<SkCanvas*>(canvas1), false);
582 SkCanvas::LayerIter layerIter2(const_cast<SkCanvas*>(canvas2), false);
583 while (!layerIter1.done() && !layerIter2.done()) {
584 REPORTER_ASSERT_MESSAGE(reporter, layerIter1.matrix() ==
585 layerIter2.matrix(), testStep->assertMessage());
586 REPORTER_ASSERT_MESSAGE(reporter, layerIter1.clip() ==
587 layerIter2.clip(), testStep->assertMessage());
588 REPORTER_ASSERT_MESSAGE(reporter, layerIter1.paint() ==
589 layerIter2.paint(), testStep->assertMessage());
590 REPORTER_ASSERT_MESSAGE(reporter, layerIter1.x() ==
591 layerIter2.x(), testStep->assertMessage());
592 REPORTER_ASSERT_MESSAGE(reporter, layerIter1.y() ==
593 layerIter2.y(), testStep->assertMessage());
594 layerIter1.next();
595 layerIter2.next();
596 }
597 REPORTER_ASSERT_MESSAGE(reporter, layerIter1.done(),
598 testStep->assertMessage());
599 REPORTER_ASSERT_MESSAGE(reporter, layerIter2.done(),
600 testStep->assertMessage());
601 */
602}
603
604// The following class groups static functions that need to access
605// the privates members of SkPictureRecord
606class SkPictureTester {
607private:
reed@google.come2589ae2012-07-10 19:38:01 +0000608 static int EQ(const SkFlatData* a, const SkFlatData* b) {
609 return *a == *b;
610 }
611
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000612 static void AssertFlattenedObjectsEqual(
613 SkPictureRecord* referenceRecord,
614 SkPictureRecord* testRecord,
615 skiatest::Reporter* reporter,
616 CanvasTestStep* testStep) {
617
618 REPORTER_ASSERT_MESSAGE(reporter,
619 referenceRecord->fBitmaps.count() ==
620 testRecord->fBitmaps.count(), testStep->assertMessage());
621 for (int i = 0; i < referenceRecord->fBitmaps.count(); ++i) {
622 REPORTER_ASSERT_MESSAGE(reporter,
reed@google.come2589ae2012-07-10 19:38:01 +0000623 EQ(referenceRecord->fBitmaps[i], testRecord->fBitmaps[i]),
624 testStep->assertMessage());
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000625 }
626 REPORTER_ASSERT_MESSAGE(reporter,
627 referenceRecord->fMatrices.count() ==
628 testRecord->fMatrices.count(), testStep->assertMessage());
629 for (int i = 0; i < referenceRecord->fMatrices.count(); ++i) {
630 REPORTER_ASSERT_MESSAGE(reporter,
reed@google.come2589ae2012-07-10 19:38:01 +0000631 EQ(referenceRecord->fMatrices[i], testRecord->fMatrices[i]),
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000632 testStep->assertMessage());
633 }
634 REPORTER_ASSERT_MESSAGE(reporter,
635 referenceRecord->fPaints.count() ==
636 testRecord->fPaints.count(), testStep->assertMessage());
637 for (int i = 0; i < referenceRecord->fPaints.count(); ++i) {
638 REPORTER_ASSERT_MESSAGE(reporter,
reed@google.come2589ae2012-07-10 19:38:01 +0000639 EQ(referenceRecord->fPaints[i], testRecord->fPaints[i]),
640 testStep->assertMessage());
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000641 }
642 REPORTER_ASSERT_MESSAGE(reporter,
643 referenceRecord->fRegions.count() ==
644 testRecord->fRegions.count(), testStep->assertMessage());
645 for (int i = 0; i < referenceRecord->fRegions.count(); ++i) {
646 REPORTER_ASSERT_MESSAGE(reporter,
reed@google.come2589ae2012-07-10 19:38:01 +0000647 EQ(referenceRecord->fRegions[i], testRecord->fRegions[i]),
648 testStep->assertMessage());
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000649 }
650 REPORTER_ASSERT_MESSAGE(reporter,
651 !referenceRecord->fPathHeap ==
652 !testRecord->fPathHeap,
653 testStep->assertMessage());
junov@chromium.orgdadcfdc2012-02-23 14:59:22 +0000654 // The following tests are commented out because they currently
655 // fail. Issue: http://code.google.com/p/skia/issues/detail?id=507
656 /*
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000657 if (referenceRecord->fPathHeap) {
658 REPORTER_ASSERT_MESSAGE(reporter,
659 referenceRecord->fPathHeap->count() ==
660 testRecord->fPathHeap->count(),
661 testStep->assertMessage());
662 for (int i = 0; i < referenceRecord->fPathHeap->count(); ++i) {
663 REPORTER_ASSERT_MESSAGE(reporter,
664 (*referenceRecord->fPathHeap)[i] ==
665 (*testRecord->fPathHeap)[i], testStep->assertMessage());
666 }
667 }
junov@chromium.orgdadcfdc2012-02-23 14:59:22 +0000668 */
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000669
670 }
671
672public:
673
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000674 static void TestPictureFlattenedObjectReuse(skiatest::Reporter* reporter,
junov@chromium.org4866cc02012-06-01 21:23:07 +0000675 CanvasTestStep* testStep,
676 uint32_t recordFlags) {
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000677 // Verify that when a test step is executed twice, no extra resources
678 // are flattened during the second execution
679 testStep->setAssertMessageFormat(kPictureDrawAssertMessageFormat);
680 SkPicture referencePicture;
681 SkCanvas* referenceCanvas = referencePicture.beginRecording(kWidth,
junov@chromium.org4866cc02012-06-01 21:23:07 +0000682 kHeight, recordFlags);
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000683 testStep->draw(referenceCanvas, reporter);
684 SkPicture testPicture;
junov@chromium.orgdadcfdc2012-02-23 14:59:22 +0000685 SkCanvas* testCanvas = testPicture.beginRecording(kWidth,
junov@chromium.org4866cc02012-06-01 21:23:07 +0000686 kHeight, recordFlags);
junov@chromium.orgdadcfdc2012-02-23 14:59:22 +0000687 testStep->draw(testCanvas, reporter);
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000688 testStep->setAssertMessageFormat(kPictureSecondDrawAssertMessageFormat);
junov@chromium.orgdadcfdc2012-02-23 14:59:22 +0000689 testStep->draw(testCanvas, reporter);
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000690
691 SkPictureRecord* referenceRecord = static_cast<SkPictureRecord*>(
692 referenceCanvas);
693 SkPictureRecord* testRecord = static_cast<SkPictureRecord*>(
694 testCanvas);
695 testStep->setAssertMessageFormat(kPictureResourceReuseMessageFormat);
696 AssertFlattenedObjectsEqual(referenceRecord, testRecord,
junov@chromium.org76b9c4b2012-02-22 21:24:41 +0000697 reporter, testStep);
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000698 }
699};
700
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000701static void TestDeferredCanvasStateConsistency(
702 skiatest::Reporter* reporter,
703 CanvasTestStep* testStep,
704 const SkCanvas& referenceCanvas) {
705
706 SkBitmap deferredStore;
707 createBitmap(&deferredStore, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
708 SkDevice deferredDevice(deferredStore);
709 SkDeferredCanvas deferredCanvas(&deferredDevice);
710 testStep->setAssertMessageFormat(kDeferredDrawAssertMessageFormat);
711 testStep->draw(&deferredCanvas, reporter);
712 testStep->setAssertMessageFormat(kDeferredPreFlushAssertMessageFormat);
713 AssertCanvasStatesEqual(reporter, &deferredCanvas, &referenceCanvas,
714 testStep);
715
junov@chromium.orgcff01c52012-07-18 21:50:26 +0000716#if SK_DEFERRED_CANVAS_USES_GPIPE
717 deferredCanvas.flush();
718 testStep->setAssertMessageFormat(
719 kDeferredPostFlushPlaybackAssertMessageFormat);
720 AssertCanvasStatesEqual(reporter,
721 deferredCanvas.getDeferredDevice()->immediateCanvas(),
722 &referenceCanvas, testStep);
723#endif
724
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000725 // Verified that deferred canvas state is not affected by flushing
726 // pending draw operations
727
728 // The following test code is commented out because it currently fails.
729 // Issue: http://code.google.com/p/skia/issues/detail?id=496
730 /*
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000731 testStep->setAssertMessageFormat(kDeferredPostFlushAssertMessageFormat);
732 AssertCanvasStatesEqual(reporter, &deferredCanvas, &referenceCanvas,
733 testStep);
734 */
735}
736
caryclark@google.com42639cd2012-06-06 12:03:39 +0000737// unused
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000738static void TestProxyCanvasStateConsistency(
739 skiatest::Reporter* reporter,
740 CanvasTestStep* testStep,
741 const SkCanvas& referenceCanvas) {
742
743 SkBitmap indirectStore;
744 createBitmap(&indirectStore, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
745 SkDevice indirectDevice(indirectStore);
746 SkCanvas indirectCanvas(&indirectDevice);
747 SkProxyCanvas proxyCanvas(&indirectCanvas);
748 testStep->setAssertMessageFormat(kProxyDrawAssertMessageFormat);
749 testStep->draw(&proxyCanvas, reporter);
750 // Verify that the SkProxyCanvas reports consitent state
751 testStep->setAssertMessageFormat(kProxyStateAssertMessageFormat);
752 AssertCanvasStatesEqual(reporter, &proxyCanvas, &referenceCanvas,
753 testStep);
754 // Verify that the indirect canvas reports consitent state
755 testStep->setAssertMessageFormat(kProxyIndirectStateAssertMessageFormat);
756 AssertCanvasStatesEqual(reporter, &indirectCanvas, &referenceCanvas,
757 testStep);
758}
759
caryclark@google.com42639cd2012-06-06 12:03:39 +0000760// unused
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000761static void TestNWayCanvasStateConsistency(
762 skiatest::Reporter* reporter,
763 CanvasTestStep* testStep,
764 const SkCanvas& referenceCanvas) {
765
766 SkBitmap indirectStore1;
767 createBitmap(&indirectStore1, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
768 SkDevice indirectDevice1(indirectStore1);
769 SkCanvas indirectCanvas1(&indirectDevice1);
770
771 SkBitmap indirectStore2;
772 createBitmap(&indirectStore2, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
773 SkDevice indirectDevice2(indirectStore2);
774 SkCanvas indirectCanvas2(&indirectDevice2);
775
djsollen@google.comf0a062b2012-05-01 16:50:25 +0000776 SkISize canvasSize = referenceCanvas.getDeviceSize();
777 SkNWayCanvas nWayCanvas(canvasSize.width(), canvasSize.height());
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000778 nWayCanvas.addCanvas(&indirectCanvas1);
779 nWayCanvas.addCanvas(&indirectCanvas2);
780
781 testStep->setAssertMessageFormat(kNWayDrawAssertMessageFormat);
782 testStep->draw(&nWayCanvas, reporter);
783 // Verify that the SkProxyCanvas reports consitent state
784 testStep->setAssertMessageFormat(kNWayStateAssertMessageFormat);
785 AssertCanvasStatesEqual(reporter, &nWayCanvas, &referenceCanvas,
786 testStep);
787 // Verify that the indirect canvases report consitent state
788 testStep->setAssertMessageFormat(kNWayIndirect1StateAssertMessageFormat);
789 AssertCanvasStatesEqual(reporter, &indirectCanvas1, &referenceCanvas,
790 testStep);
791 testStep->setAssertMessageFormat(kNWayIndirect2StateAssertMessageFormat);
792 AssertCanvasStatesEqual(reporter, &indirectCanvas2, &referenceCanvas,
793 testStep);
794}
795
796/*
797 * This sub-test verifies that the test step passes when executed
798 * with SkCanvas and with classes derrived from SkCanvas. It also verifies
799 * that the all canvas derivatives report the same state as an SkCanvas
800 * after having executed the test step.
801 */
802static void TestOverrideStateConsistency(skiatest::Reporter* reporter,
803 CanvasTestStep* testStep) {
804 SkBitmap referenceStore;
805 createBitmap(&referenceStore, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
806 SkDevice referenceDevice(referenceStore);
807 SkCanvas referenceCanvas(&referenceDevice);
808 testStep->setAssertMessageFormat(kCanvasDrawAssertMessageFormat);
809 testStep->draw(&referenceCanvas, reporter);
810
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000811 TestDeferredCanvasStateConsistency(reporter, testStep, referenceCanvas);
812
caryclark@google.com42639cd2012-06-06 12:03:39 +0000813 // The following test code is disabled because SkProxyCanvas is
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000814 // missing a lot of virtual overrides on get* methods, which are used
815 // to verify canvas state.
816 // Issue: http://code.google.com/p/skia/issues/detail?id=500
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000817
caryclark@google.com42639cd2012-06-06 12:03:39 +0000818 if (false) { // avoid bit rot, suppress warning
819 TestProxyCanvasStateConsistency(reporter, testStep, referenceCanvas);
820 }
821
822 // The following test code is disabled because SkNWayCanvas does not
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000823 // report correct clipping and device bounds information
824 // Issue: http://code.google.com/p/skia/issues/detail?id=501
caryclark@google.com42639cd2012-06-06 12:03:39 +0000825
826 if (false) { // avoid bit rot, suppress warning
827 TestNWayCanvasStateConsistency(reporter, testStep, referenceCanvas);
828 }
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000829
caryclark@google.com42639cd2012-06-06 12:03:39 +0000830 if (false) { // avoid bit rot, suppress warning
831 test_clipVisitor(reporter, &referenceCanvas);
832 }
reed@google.com7c202932011-12-14 18:48:05 +0000833}
reed@google.com37f3ae02011-11-28 16:06:04 +0000834
835static void TestCanvas(skiatest::Reporter* reporter) {
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000836 // Init global here because bitmap pixels cannot be alocated during
837 // static initialization
838 kTestBitmap = testBitmap();
reed@google.com37f3ae02011-11-28 16:06:04 +0000839
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000840 for (int testStep = 0; testStep < testStepArray().count(); testStep++) {
841 TestOverrideStateConsistency(reporter, testStepArray()[testStep]);
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000842 SkPictureTester::TestPictureFlattenedObjectReuse(reporter,
junov@chromium.org4866cc02012-06-01 21:23:07 +0000843 testStepArray()[testStep], 0);
844 SkPictureTester::TestPictureFlattenedObjectReuse(reporter,
845 testStepArray()[testStep],
846 SkPicture::kFlattenMutableNonTexturePixelRefs_RecordingFlag);
junov@chromium.org1cc8f6f2012-02-22 21:00:42 +0000847 }
reed@google.com37f3ae02011-11-28 16:06:04 +0000848}
849
850#include "TestClassDef.h"
851DEFINE_TESTCLASS("Canvas", TestCanvasClass, TestCanvas)