OLD | NEW |
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 "gm_expectations.h" | 8 #include "gm_expectations.h" |
9 #include "SkBitmapHasher.h" | 9 #include "SkBitmapHasher.h" |
10 #include "SkImageDecoder.h" | 10 #include "SkImageDecoder.h" |
11 | 11 |
12 #define DEBUGFAIL_SEE_STDERR SkDEBUGFAIL("see stderr for message") | 12 #define DEBUGFAIL_SEE_STDERR SkDEBUGFAIL("see stderr for message") |
13 | 13 |
14 const static char kJsonKey_ActualResults[] = "actual-results"; | 14 const static char kJsonKey_ActualResults[] = "actual-results"; |
15 const static char kJsonKey_ActualResults_Failed[] = "failed"; | 15 const static char kJsonKey_ActualResults_Failed[] = "failed"; |
16 const static char kJsonKey_ActualResults_FailureIgnored[]= "failure-ignored"; | 16 const static char kJsonKey_ActualResults_FailureIgnored[]= "failure-ignored"; |
17 const static char kJsonKey_ActualResults_NoComparison[] = "no-comparison"; | 17 const static char kJsonKey_ActualResults_NoComparison[] = "no-comparison"; |
18 const static char kJsonKey_ActualResults_Succeeded[] = "succeeded"; | 18 const static char kJsonKey_ActualResults_Succeeded[] = "succeeded"; |
19 #ifdef BITMAPHASHER_USES_TRUNCATED_MD5 | |
20 const static char kJsonKey_ActualResults_AnyStatus_BitmapHash[] = "bitmap-64bit
MD5"; | 19 const static char kJsonKey_ActualResults_AnyStatus_BitmapHash[] = "bitmap-64bit
MD5"; |
21 #else | |
22 const static char kJsonKey_ActualResults_AnyStatus_BitmapHash[] = "bitmap-cityh
ash"; | |
23 #endif | |
24 | 20 |
25 const static char kJsonKey_ExpectedResults[] = "expected-results"; | 21 const static char kJsonKey_ExpectedResults[] = "expected-results"; |
26 #ifdef BITMAPHASHER_USES_TRUNCATED_MD5 | |
27 const static char kJsonKey_ExpectedResults_AllowedBitmapHashes[] = "allowed-bitm
ap-64bitMD5s"; | 22 const static char kJsonKey_ExpectedResults_AllowedBitmapHashes[] = "allowed-bitm
ap-64bitMD5s"; |
28 #else | |
29 const static char kJsonKey_ExpectedResults_AllowedBitmapHashes[] = "allowed-bitm
ap-cityhashes"; | |
30 #endif | |
31 const static char kJsonKey_ExpectedResults_IgnoreFailure[] = "ignore-f
ailure"; | 23 const static char kJsonKey_ExpectedResults_IgnoreFailure[] = "ignore-f
ailure"; |
32 | 24 |
33 namespace skiagm { | 25 namespace skiagm { |
34 | 26 |
35 // TODO(epoger): This currently assumes that the result SkHashDigest was | 27 // TODO(epoger): This currently assumes that the result SkHashDigest was |
36 // generated as an SkHashDigest of an SkBitmap. We'll need to allow for oth
er | 28 // generated as an SkHashDigest of an SkBitmap. We'll need to allow for oth
er |
37 // hash types to cover non-bitmaps. | 29 // hash types to cover non-bitmaps. |
38 Json::Value ActualResultAsJsonValue(const SkHashDigest& result) { | 30 Json::Value ActualResultAsJsonValue(const SkHashDigest& result) { |
39 Json::Value jsonValue; | 31 Json::Value jsonValue; |
40 jsonValue[kJsonKey_ActualResults_AnyStatus_BitmapHash] = asJsonValue(res
ult); | 32 jsonValue[kJsonKey_ActualResults_AnyStatus_BitmapHash] = asJsonValue(res
ult); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 Json::Reader reader; | 206 Json::Reader reader; |
215 if (!reader.parse(bytes, bytes+size, *jsonRoot)) { | 207 if (!reader.parse(bytes, bytes+size, *jsonRoot)) { |
216 gm_fprintf(stderr, "error parsing JSON file %s\n", jsonPath); | 208 gm_fprintf(stderr, "error parsing JSON file %s\n", jsonPath); |
217 DEBUGFAIL_SEE_STDERR; | 209 DEBUGFAIL_SEE_STDERR; |
218 return false; | 210 return false; |
219 } | 211 } |
220 return true; | 212 return true; |
221 } | 213 } |
222 | 214 |
223 } | 215 } |
OLD | NEW |