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

Side by Side Diff: tests/FlatDataTest.cpp

Issue 100113004: Use DEFINE_TESTCLASS_SHORT macro in tests. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « tests/FitsInTest.cpp ('k') | tests/FlateTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1
2 /* 1 /*
3 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
4 * 3 *
5 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 7
8 #include "Test.h"
9 #include "TestClassDef.h"
9 #include "SkBitmap.h" 10 #include "SkBitmap.h"
10 #include "SkCanvas.h" 11 #include "SkCanvas.h"
11 #include "SkColor.h" 12 #include "SkColor.h"
12 #include "SkColorFilter.h" 13 #include "SkColorFilter.h"
13 #include "SkGradientShader.h" 14 #include "SkGradientShader.h"
14 #include "SkPaint.h" 15 #include "SkPaint.h"
15 #include "SkPictureFlat.h" 16 #include "SkPictureFlat.h"
16 #include "SkShader.h" 17 #include "SkShader.h"
17 #include "SkXfermode.h" 18 #include "SkXfermode.h"
18 #include "Test.h"
19 19
20 static void flattenFlattenableProc(SkOrderedWriteBuffer& buffer, 20 static void flattenFlattenableProc(SkOrderedWriteBuffer& buffer,
21 const void* obj) { 21 const void* obj) {
22 buffer.writeFlattenable((SkFlattenable*)obj); 22 buffer.writeFlattenable((SkFlattenable*)obj);
23 } 23 }
24 24
25 class Controller : public SkChunkFlatController { 25 class Controller : public SkChunkFlatController {
26 public: 26 public:
27 Controller() : INHERITED(1024) { 27 Controller() : INHERITED(1024) {
28 this->INHERITED::setNamedFactorySet(SkNEW(SkNamedFactorySet))->unref(); 28 this->INHERITED::setNamedFactorySet(SkNEW(SkNamedFactorySet))->unref();
(...skipping 12 matching lines...) Expand all
41 static void testCreate(skiatest::Reporter* reporter, const void* obj, 41 static void testCreate(skiatest::Reporter* reporter, const void* obj,
42 void (*flattenProc)(SkOrderedWriteBuffer&, const void*)) { 42 void (*flattenProc)(SkOrderedWriteBuffer&, const void*)) {
43 Controller controller; 43 Controller controller;
44 // No need to delete data because that will be taken care of by the 44 // No need to delete data because that will be taken care of by the
45 // controller. 45 // controller.
46 SkFlatData* data1 = SkFlatData::Create(&controller, obj, 0, flattenProc); 46 SkFlatData* data1 = SkFlatData::Create(&controller, obj, 0, flattenProc);
47 SkFlatData* data2 = SkFlatData::Create(&controller, obj, 1, flattenProc); 47 SkFlatData* data2 = SkFlatData::Create(&controller, obj, 1, flattenProc);
48 REPORTER_ASSERT(reporter, *data1 == *data2); 48 REPORTER_ASSERT(reporter, *data1 == *data2);
49 } 49 }
50 50
51 static void Tests(skiatest::Reporter* reporter) { 51 DEF_TEST(FlatData, reporter) {
52 // Test flattening SkShader 52 // Test flattening SkShader
53 SkPoint points[2]; 53 SkPoint points[2];
54 points[0].set(0, 0); 54 points[0].set(0, 0);
55 points[1].set(SkIntToScalar(20), SkIntToScalar(20)); 55 points[1].set(SkIntToScalar(20), SkIntToScalar(20));
56 SkColor colors[2]; 56 SkColor colors[2];
57 colors[0] = SK_ColorRED; 57 colors[0] = SK_ColorRED;
58 colors[1] = SK_ColorBLUE; 58 colors[1] = SK_ColorBLUE;
59 SkShader* shader = SkGradientShader::CreateLinear(points, colors, NULL, 59 SkShader* shader = SkGradientShader::CreateLinear(points, colors, NULL,
60 2, SkShader::kRepeat_TileMode); 60 2, SkShader::kRepeat_TileMode);
61 SkAutoUnref aur(shader); 61 SkAutoUnref aur(shader);
(...skipping 16 matching lines...) Expand all
78 SK_ColorRED); 78 SK_ColorRED);
79 SkAutoUnref aurcf(cf); 79 SkAutoUnref aurcf(cf);
80 testCreate(reporter, cf, &flattenFlattenableProc); 80 testCreate(reporter, cf, &flattenFlattenableProc);
81 81
82 // Test SkXfermode 82 // Test SkXfermode
83 SkXfermode* xfer = SkXfermode::Create(SkXfermode::kDstOver_Mode); 83 SkXfermode* xfer = SkXfermode::Create(SkXfermode::kDstOver_Mode);
84 SkAutoUnref aurxf(xfer); 84 SkAutoUnref aurxf(xfer);
85 testCreate(reporter, xfer, &flattenFlattenableProc); 85 testCreate(reporter, xfer, &flattenFlattenableProc);
86 } 86 }
87 87
88 #include "TestClassDef.h"
89 DEFINE_TESTCLASS("FlatData", FlatDataClass, Tests)
OLDNEW
« no previous file with comments | « tests/FitsInTest.cpp ('k') | tests/FlateTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698