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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 Expectations::Expectations(bool ignoreFailure) { | 134 Expectations::Expectations(bool ignoreFailure) { |
135 fIgnoreFailure = ignoreFailure; | 135 fIgnoreFailure = ignoreFailure; |
136 } | 136 } |
137 | 137 |
138 Expectations::Expectations(const SkBitmap& bitmap, bool ignoreFailure) { | 138 Expectations::Expectations(const SkBitmap& bitmap, bool ignoreFailure) { |
139 fBitmap = bitmap; | 139 fBitmap = bitmap; |
140 fIgnoreFailure = ignoreFailure; | 140 fIgnoreFailure = ignoreFailure; |
141 fAllowedResultDigests.push_back(GmResultDigest(bitmap)); | 141 fAllowedResultDigests.push_back(GmResultDigest(bitmap)); |
142 } | 142 } |
143 | 143 |
| 144 Expectations::Expectations(const BitmapAndDigest& bitmapAndDigest) { |
| 145 fBitmap = bitmapAndDigest.fBitmap; |
| 146 fIgnoreFailure = false; |
| 147 fAllowedResultDigests.push_back(bitmapAndDigest.fDigest); |
| 148 } |
| 149 |
144 Expectations::Expectations(Json::Value jsonElement) { | 150 Expectations::Expectations(Json::Value jsonElement) { |
145 if (jsonElement.empty()) { | 151 if (jsonElement.empty()) { |
146 fIgnoreFailure = kDefaultIgnoreFailure; | 152 fIgnoreFailure = kDefaultIgnoreFailure; |
147 } else { | 153 } else { |
148 Json::Value ignoreFailure = jsonElement[kJsonKey_ExpectedResults_Ign
oreFailure]; | 154 Json::Value ignoreFailure = jsonElement[kJsonKey_ExpectedResults_Ign
oreFailure]; |
149 if (ignoreFailure.isNull()) { | 155 if (ignoreFailure.isNull()) { |
150 fIgnoreFailure = kDefaultIgnoreFailure; | 156 fIgnoreFailure = kDefaultIgnoreFailure; |
151 } else if (!ignoreFailure.isBool()) { | 157 } else if (!ignoreFailure.isBool()) { |
152 gm_fprintf(stderr, "found non-boolean json value" | 158 gm_fprintf(stderr, "found non-boolean json value" |
153 " for key '%s' in element '%s'\n", | 159 " for key '%s' in element '%s'\n", |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 Json::Reader reader; | 274 Json::Reader reader; |
269 if (!reader.parse(bytes, bytes+size, *jsonRoot)) { | 275 if (!reader.parse(bytes, bytes+size, *jsonRoot)) { |
270 gm_fprintf(stderr, "error parsing JSON file %s\n", jsonPath); | 276 gm_fprintf(stderr, "error parsing JSON file %s\n", jsonPath); |
271 DEBUGFAIL_SEE_STDERR; | 277 DEBUGFAIL_SEE_STDERR; |
272 return false; | 278 return false; |
273 } | 279 } |
274 return true; | 280 return true; |
275 } | 281 } |
276 | 282 |
277 } | 283 } |
OLD | NEW |