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

Side by Side Diff: tests/BitmapHasherTest.cpp

Issue 15883004: GM: create GmResultDigest that encapsulates digest type ("bitmap-64bitMD5") and value (12345) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: add_isValid Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/utils/SkBitmapHasher.cpp ('k') | tools/skimage_main.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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "Test.h" 8 #include "Test.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 20 matching lines...) Expand all
31 SkColor color) { 31 SkColor color) {
32 bitmap.setConfig(config, width, height); 32 bitmap.setConfig(config, width, height);
33 REPORTER_ASSERT(fReporter, bitmap.allocPixels()); 33 REPORTER_ASSERT(fReporter, bitmap.allocPixels());
34 bitmap.setIsOpaque(true); 34 bitmap.setIsOpaque(true);
35 bitmap.eraseColor(color); 35 bitmap.eraseColor(color);
36 } 36 }
37 37
38 void RunTest() { 38 void RunTest() {
39 // Test SkBitmapHasher 39 // Test SkBitmapHasher
40 SkBitmap bitmap; 40 SkBitmap bitmap;
41 SkHashDigest digest; 41 uint64_t digest;
42 // initial test case 42 // initial test case
43 CreateTestBitmap(bitmap, SkBitmap::kARGB_8888_Config, 333, 555, SK_C olorBLUE); 43 CreateTestBitmap(bitmap, SkBitmap::kARGB_8888_Config, 333, 555, SK_C olorBLUE);
44 REPORTER_ASSERT(fReporter, SkBitmapHasher::ComputeDigest(bitmap, &di gest)); 44 REPORTER_ASSERT(fReporter, SkBitmapHasher::ComputeDigest(bitmap, &di gest));
45 REPORTER_ASSERT(fReporter, digest == 0xfb2903562766ef87ULL); 45 REPORTER_ASSERT(fReporter, digest == 0xfb2903562766ef87ULL);
46 // same pixel data but different dimensions should yield a different checksum 46 // same pixel data but different dimensions should yield a different checksum
47 CreateTestBitmap(bitmap, SkBitmap::kARGB_8888_Config, 555, 333, SK_C olorBLUE); 47 CreateTestBitmap(bitmap, SkBitmap::kARGB_8888_Config, 555, 333, SK_C olorBLUE);
48 REPORTER_ASSERT(fReporter, SkBitmapHasher::ComputeDigest(bitmap, &di gest)); 48 REPORTER_ASSERT(fReporter, SkBitmapHasher::ComputeDigest(bitmap, &di gest));
49 REPORTER_ASSERT(fReporter, digest == 0xfe04023fb97d0f61ULL); 49 REPORTER_ASSERT(fReporter, digest == 0xfe04023fb97d0f61ULL);
50 // same dimensions but different color should yield a different chec ksum 50 // same dimensions but different color should yield a different chec ksum
51 CreateTestBitmap(bitmap, SkBitmap::kARGB_8888_Config, 555, 333, SK_C olorGREEN); 51 CreateTestBitmap(bitmap, SkBitmap::kARGB_8888_Config, 555, 333, SK_C olorGREEN);
52 REPORTER_ASSERT(fReporter, SkBitmapHasher::ComputeDigest(bitmap, &di gest)); 52 REPORTER_ASSERT(fReporter, SkBitmapHasher::ComputeDigest(bitmap, &di gest));
53 REPORTER_ASSERT(fReporter, digest == 0x2423c51cad6d1edcULL); 53 REPORTER_ASSERT(fReporter, digest == 0x2423c51cad6d1edcULL);
54 // same pixel colors in a different config should yield the same che cksum 54 // same pixel colors in a different config should yield the same che cksum
55 CreateTestBitmap(bitmap, SkBitmap::kARGB_4444_Config, 555, 333, SK_C olorGREEN); 55 CreateTestBitmap(bitmap, SkBitmap::kARGB_4444_Config, 555, 333, SK_C olorGREEN);
56 REPORTER_ASSERT(fReporter, SkBitmapHasher::ComputeDigest(bitmap, &di gest)); 56 REPORTER_ASSERT(fReporter, SkBitmapHasher::ComputeDigest(bitmap, &di gest));
57 REPORTER_ASSERT(fReporter, digest == 0x2423c51cad6d1edcULL); 57 REPORTER_ASSERT(fReporter, digest == 0x2423c51cad6d1edcULL);
58 } 58 }
59 59
60 Reporter* fReporter; 60 Reporter* fReporter;
61 }; 61 };
62 62
63 static TestRegistry gReg(BitmapHasherTestClass::Factory); 63 static TestRegistry gReg(BitmapHasherTestClass::Factory);
64 } 64 }
OLDNEW
« no previous file with comments | « src/utils/SkBitmapHasher.cpp ('k') | tools/skimage_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698