| 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" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 SkString SkPathJoin(const char *rootPath, const char *relativePath) { | 37 SkString SkPathJoin(const char *rootPath, const char *relativePath) { |
| 38 SkString result(rootPath); | 38 SkString result(rootPath); |
| 39 if (!result.endsWith(SkPATH_SEPARATOR)) { | 39 if (!result.endsWith(SkPATH_SEPARATOR)) { |
| 40 result.appendUnichar(SkPATH_SEPARATOR); | 40 result.appendUnichar(SkPATH_SEPARATOR); |
| 41 } | 41 } |
| 42 result.append(relativePath); | 42 result.append(relativePath); |
| 43 return result; | 43 return result; |
| 44 } | 44 } |
| 45 | 45 |
| 46 SkString make_filename(const char path[], | |
| 47 const char renderModeDescriptor[], | |
| 48 const char *name, | |
| 49 const char suffix[]) { | |
| 50 SkString filename(name); | |
| 51 filename.append(renderModeDescriptor); | |
| 52 filename.appendUnichar('.'); | |
| 53 filename.append(suffix); | |
| 54 return SkPathJoin(path, filename.c_str()); | |
| 55 } | |
| 56 | |
| 57 // TODO(epoger): This currently assumes that the result SkHashDigest was | 46 // TODO(epoger): This currently assumes that the result SkHashDigest was |
| 58 // generated as an SkHashDigest of an SkBitmap. We'll need to allow for oth
er | 47 // generated as an SkHashDigest of an SkBitmap. We'll need to allow for oth
er |
| 59 // hash types to cover non-bitmaps. | 48 // hash types to cover non-bitmaps. |
| 60 Json::Value ActualResultAsJsonValue(const SkHashDigest& result) { | 49 Json::Value ActualResultAsJsonValue(const SkHashDigest& result) { |
| 61 Json::Value jsonValue; | 50 Json::Value jsonValue; |
| 62 jsonValue[kJsonKey_ActualResults_AnyStatus_BitmapHash] = asJsonValue(res
ult); | 51 jsonValue[kJsonKey_ActualResults_AnyStatus_BitmapHash] = asJsonValue(res
ult); |
| 63 return jsonValue; | 52 return jsonValue; |
| 64 } | 53 } |
| 65 | 54 |
| 66 Json::Value CreateJsonTree(Json::Value expectedResults, | 55 Json::Value CreateJsonTree(Json::Value expectedResults, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 Json::Reader reader; | 224 Json::Reader reader; |
| 236 if (!reader.parse(bytes, bytes+size, *jsonRoot)) { | 225 if (!reader.parse(bytes, bytes+size, *jsonRoot)) { |
| 237 gm_fprintf(stderr, "error parsing JSON file %s\n", jsonPath); | 226 gm_fprintf(stderr, "error parsing JSON file %s\n", jsonPath); |
| 238 DEBUGFAIL_SEE_STDERR; | 227 DEBUGFAIL_SEE_STDERR; |
| 239 return false; | 228 return false; |
| 240 } | 229 } |
| 241 return true; | 230 return true; |
| 242 } | 231 } |
| 243 | 232 |
| 244 } | 233 } |
| OLD | NEW |