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

Side by Side Diff: tests/SerializationTest.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/ScalarTest.cpp ('k') | tests/ShaderImageFilterTest.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 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * 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
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Test.h"
9 #include "TestClassDef.h"
8 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
9 #include "SkBitmapSource.h" 11 #include "SkBitmapSource.h"
10 #include "SkCanvas.h" 12 #include "SkCanvas.h"
11 #include "SkMallocPixelRef.h" 13 #include "SkMallocPixelRef.h"
12 #include "SkOrderedWriteBuffer.h" 14 #include "SkOrderedWriteBuffer.h"
13 #include "SkValidatingReadBuffer.h" 15 #include "SkValidatingReadBuffer.h"
14 #include "SkXfermodeImageFilter.h" 16 #include "SkXfermodeImageFilter.h"
15 #include "Test.h"
16 17
17 static const uint32_t kArraySize = 64; 18 static const uint32_t kArraySize = 64;
18 19
19 template<typename T> 20 template<typename T>
20 static void TestAlignment(T* testObj, skiatest::Reporter* reporter) { 21 static void TestAlignment(T* testObj, skiatest::Reporter* reporter) {
21 // Test memory read/write functions directly 22 // Test memory read/write functions directly
22 unsigned char dataWritten[1024]; 23 unsigned char dataWritten[1024];
23 size_t bytesWrittenToMemory = testObj->writeToMemory(dataWritten); 24 size_t bytesWrittenToMemory = testObj->writeToMemory(dataWritten);
24 REPORTER_ASSERT(reporter, SkAlign4(bytesWrittenToMemory) == bytesWrittenToMe mory); 25 REPORTER_ASSERT(reporter, SkAlign4(bytesWrittenToMemory) == bytesWrittenToMe mory);
25 size_t bytesReadFromMemory = testObj->readFromMemory(dataWritten, bytesWritt enToMemory); 26 size_t bytesReadFromMemory = testObj->readFromMemory(dataWritten, bytesWritt enToMemory);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 SkBitmapDevice device(bitmap); 226 SkBitmapDevice device(bitmap);
226 SkCanvas canvas(&device); 227 SkCanvas canvas(&device);
227 canvas.clear(0x00000000); 228 canvas.clear(0x00000000);
228 SkPaint paint; 229 SkPaint paint;
229 paint.setImageFilter(deserializedFilter); 230 paint.setImageFilter(deserializedFilter);
230 canvas.clipRect(SkRect::MakeXYWH(0, 0, SkIntToScalar(24), SkIntToScalar( 24))); 231 canvas.clipRect(SkRect::MakeXYWH(0, 0, SkIntToScalar(24), SkIntToScalar( 24)));
231 canvas.drawBitmap(bitmap, 0, 0, &paint); 232 canvas.drawBitmap(bitmap, 0, 0, &paint);
232 } 233 }
233 } 234 }
234 235
235 static void Tests(skiatest::Reporter* reporter) { 236 DEF_TEST(Serialization, reporter) {
236 // Test matrix serialization 237 // Test matrix serialization
237 { 238 {
238 SkMatrix matrix = SkMatrix::I(); 239 SkMatrix matrix = SkMatrix::I();
239 TestObjectSerialization(&matrix, reporter); 240 TestObjectSerialization(&matrix, reporter);
240 } 241 }
241 242
242 // Test path serialization 243 // Test path serialization
243 { 244 {
244 SkPath path; 245 SkPath path;
245 TestObjectSerialization(&path, reporter); 246 TestObjectSerialization(&path, reporter);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // Create a bitmap with a pixel ref too small 310 // Create a bitmap with a pixel ref too small
310 SkBitmap invalidBitmap2; 311 SkBitmap invalidBitmap2;
311 invalidBitmap2.setConfig(SkBitmap::kARGB_8888_Config, 256, 256); 312 invalidBitmap2.setConfig(SkBitmap::kARGB_8888_Config, 256, 256);
312 invalidBitmap2.setPixelRef(SkNEW_ARGS(SkMallocPixelRef, 313 invalidBitmap2.setPixelRef(SkNEW_ARGS(SkMallocPixelRef,
313 (NULL, 256, NULL)))->unref(); 314 (NULL, 256, NULL)))->unref();
314 315
315 // The deserialization should detect the pixel ref being too small and f ail 316 // The deserialization should detect the pixel ref being too small and f ail
316 TestBitmapSerialization(validBitmap, invalidBitmap2, false, reporter); 317 TestBitmapSerialization(validBitmap, invalidBitmap2, false, reporter);
317 } 318 }
318 } 319 }
319
320 #include "TestClassDef.h"
321 DEFINE_TESTCLASS("Serialization", SerializationClass, Tests)
OLDNEW
« no previous file with comments | « tests/ScalarTest.cpp ('k') | tests/ShaderImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698