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 // See gm_json.py for descriptions of each of these JSON keys. | 14 // See gm_json.py for descriptions of each of these JSON keys. |
15 // These constants must be kept in sync with the ones in that Python file! | 15 // These constants must be kept in sync with the ones in that Python file! |
16 const static char kJsonKey_ActualResults[] = "actual-results"; | 16 const static char kJsonKey_ActualResults[] = "actual-results"; |
17 const static char kJsonKey_ActualResults_Failed[] = "failed"; | 17 const static char kJsonKey_ActualResults_Failed[] = "failed"; |
18 const static char kJsonKey_ActualResults_FailureIgnored[]= "failure-ignored"; | 18 const static char kJsonKey_ActualResults_FailureIgnored[]= "failure-ignored"; |
19 const static char kJsonKey_ActualResults_NoComparison[] = "no-comparison"; | 19 const static char kJsonKey_ActualResults_NoComparison[] = "no-comparison"; |
20 const static char kJsonKey_ActualResults_Succeeded[] = "succeeded"; | 20 const static char kJsonKey_ActualResults_Succeeded[] = "succeeded"; |
21 const static char kJsonKey_ExpectedResults[] = "expected-results"; | 21 const static char kJsonKey_ExpectedResults[] = "expected-results"; |
22 const static char kJsonKey_ExpectedResults_AllowedDigests[] = "allowed-digests"; | 22 const static char kJsonKey_ExpectedResults_AllowedDigests[] = "allowed-digests"; |
23 const static char kJsonKey_ExpectedResults_IgnoreFailure[] = "ignore-failure"; | 23 const static char kJsonKey_ExpectedResults_IgnoreFailure[] = "ignore-failure"; |
24 | 24 |
25 // Types of result hashes we support in the JSON file. | 25 // Types of result hashes we support in the JSON file. |
26 const static char kJsonKey_Hashtype_Bitmap_64bitMD5[] = "bitmap-64bitMD5"; | 26 const static char kJsonKey_Hashtype_Bitmap_64bitMD5[] = "bitmap-64bitMD5"; |
27 | 27 |
28 | 28 |
29 namespace skiagm { | 29 namespace skiagm { |
30 SK_DEFINE_INST_COUNT(ExpectationsSource) | |
31 | |
32 void gm_fprintf(FILE *stream, const char format[], ...) { | 30 void gm_fprintf(FILE *stream, const char format[], ...) { |
33 va_list args; | 31 va_list args; |
34 va_start(args, format); | 32 va_start(args, format); |
35 fprintf(stream, "GM: "); | 33 fprintf(stream, "GM: "); |
36 vfprintf(stream, format, args); | 34 vfprintf(stream, format, args); |
37 #ifdef SK_BUILD_FOR_WIN | 35 #ifdef SK_BUILD_FOR_WIN |
38 if (stderr == stream || stdout == stream) { | 36 if (stderr == stream || stdout == stream) { |
39 fflush(stream); | 37 fflush(stream); |
40 } | 38 } |
41 #endif | 39 #endif |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 Json::Reader reader; | 272 Json::Reader reader; |
275 if (!reader.parse(bytes, bytes+size, *jsonRoot)) { | 273 if (!reader.parse(bytes, bytes+size, *jsonRoot)) { |
276 gm_fprintf(stderr, "error parsing JSON file %s\n", jsonPath); | 274 gm_fprintf(stderr, "error parsing JSON file %s\n", jsonPath); |
277 DEBUGFAIL_SEE_STDERR; | 275 DEBUGFAIL_SEE_STDERR; |
278 return false; | 276 return false; |
279 } | 277 } |
280 return true; | 278 return true; |
281 } | 279 } |
282 | 280 |
283 } | 281 } |
OLD | NEW |