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

Side by Side Diff: gm/gm_expectations.h

Issue 14080003: GM: remove enableMissingWarning in favor of verbose flag, and trim output in nonverbose mode (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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
OLDNEW
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 #ifndef gm_expectations_DEFINED 7 #ifndef gm_expectations_DEFINED
8 #define gm_expectations_DEFINED 8 #define gm_expectations_DEFINED
9 9
10 #include <stdarg.h> 10 #include <stdarg.h>
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 * Return Expectations based on individual image files on disk. 218 * Return Expectations based on individual image files on disk.
219 */ 219 */
220 class IndividualImageExpectationsSource : public ExpectationsSource { 220 class IndividualImageExpectationsSource : public ExpectationsSource {
221 public: 221 public:
222 /** 222 /**
223 * Create an ExpectationsSource that will return Expectations based on 223 * Create an ExpectationsSource that will return Expectations based on
224 * image files found within rootDir. 224 * image files found within rootDir.
225 * 225 *
226 * rootDir: directory under which to look for image files 226 * rootDir: directory under which to look for image files
227 * (this string will be copied to storage within this object) 227 * (this string will be copied to storage within this object)
228 * notifyOfMissingFiles: whether to log a message to stderr if an image
229 * file cannot be found
230 */ 228 */
231 IndividualImageExpectationsSource(const char *rootDir, 229 IndividualImageExpectationsSource(const char *rootDir) : fRootDir(rootDi r) {}
232 bool notifyOfMissingFiles) :
233 fRootDir(rootDir), fNotifyOfMissingFiles(notifyOfMissingFiles) {}
234 230
235 Expectations get(const char *testName) SK_OVERRIDE { 231 Expectations get(const char *testName) SK_OVERRIDE {
236 SkString path = make_filename(fRootDir.c_str(), "", testName, 232 SkString path = make_filename(fRootDir.c_str(), "", testName,
237 "png"); 233 "png");
238 SkBitmap referenceBitmap; 234 SkBitmap referenceBitmap;
239 bool decodedReferenceBitmap = 235 bool decodedReferenceBitmap =
240 SkImageDecoder::DecodeFile(path.c_str(), &referenceBitmap, 236 SkImageDecoder::DecodeFile(path.c_str(), &referenceBitmap,
241 SkBitmap::kARGB_8888_Config, 237 SkBitmap::kARGB_8888_Config,
242 SkImageDecoder::kDecodePixels_Mode, 238 SkImageDecoder::kDecodePixels_Mode,
243 NULL); 239 NULL);
244 if (decodedReferenceBitmap) { 240 if (decodedReferenceBitmap) {
245 return Expectations(referenceBitmap); 241 return Expectations(referenceBitmap);
246 } else { 242 } else {
247 if (fNotifyOfMissingFiles) {
248 gm_fprintf(stderr, "FAILED to read %s\n", path.c_str());
249 }
250 return Expectations(); 243 return Expectations();
251 } 244 }
252 } 245 }
253 246
254 private: 247 private:
255 const SkString fRootDir; 248 const SkString fRootDir;
256 const bool fNotifyOfMissingFiles;
257 }; 249 };
258 250
259 /** 251 /**
260 * Return Expectations based on JSON summary file. 252 * Return Expectations based on JSON summary file.
261 */ 253 */
262 class JsonExpectationsSource : public ExpectationsSource { 254 class JsonExpectationsSource : public ExpectationsSource {
263 public: 255 public:
264 /** 256 /**
265 * Create an ExpectationsSource that will return Expectations based on 257 * Create an ExpectationsSource that will return Expectations based on
266 * a JSON file. 258 * a JSON file.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 357 }
366 return true; 358 return true;
367 } 359 }
368 360
369 Json::Value fJsonRoot; 361 Json::Value fJsonRoot;
370 Json::Value fJsonExpectedResults; 362 Json::Value fJsonExpectedResults;
371 }; 363 };
372 364
373 } 365 }
374 #endif 366 #endif
OLDNEW
« no previous file with comments | « no previous file | gm/gmmain.cpp » ('j') | gm/tests/outputs/compared-against-empty-dir/output-expected/stderr » ('J')

Powered by Google App Engine
This is Rietveld 408576698