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

Side by Side Diff: gm/gmmain.cpp

Issue 15014011: GM: include filename extension (.png) of each output file in JSON summary (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: add_file_extension_to_json Created 7 years, 7 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 2011 Google Inc. 2 * Copyright 2011 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 /* 8 /*
9 * Code for the "gm" (Golden Master) rendering comparison tool. 9 * Code for the "gm" (Golden Master) rendering comparison tool.
10 * 10 *
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 bool addToJsonSummary) { 720 bool addToJsonSummary) {
721 ErrorCombination errors; 721 ErrorCombination errors;
722 SkHashDigest actualBitmapHash; 722 SkHashDigest actualBitmapHash;
723 // TODO(epoger): Better handling for error returned by ComputeDigest()? 723 // TODO(epoger): Better handling for error returned by ComputeDigest()?
724 // For now, we just report a digest of 0 in error cases, like before. 724 // For now, we just report a digest of 0 in error cases, like before.
725 if (!SkBitmapHasher::ComputeDigest(actualBitmap, &actualBitmapHash)) { 725 if (!SkBitmapHasher::ComputeDigest(actualBitmap, &actualBitmapHash)) {
726 actualBitmapHash = 0; 726 actualBitmapHash = 0;
727 } 727 }
728 SkString completeNameString = baseNameString; 728 SkString completeNameString = baseNameString;
729 completeNameString.append(renderModeDescriptor); 729 completeNameString.append(renderModeDescriptor);
730 completeNameString.append(".png");
730 const char* completeName = completeNameString.c_str(); 731 const char* completeName = completeNameString.c_str();
731 732
732 if (expectations.empty()) { 733 if (expectations.empty()) {
733 errors.add(kMissingExpectations_ErrorType); 734 errors.add(kMissingExpectations_ErrorType);
734 } else if (!expectations.match(actualBitmapHash)) { 735 } else if (!expectations.match(actualBitmapHash)) {
735 addToJsonSummary = true; 736 addToJsonSummary = true;
736 // The error mode we record depends on whether this was running 737 // The error mode we record depends on whether this was running
737 // in a non-standard renderMode. 738 // in a non-standard renderMode.
738 if ('\0' == *renderModeDescriptor) { 739 if ('\0' == *renderModeDescriptor) {
739 errors.add(kExpectationsMismatch_ErrorType); 740 errors.add(kExpectationsMismatch_ErrorType);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 name, "", true)); 859 name, "", true));
859 } else { 860 } else {
860 // If we are running without expectations, we still want to 861 // If we are running without expectations, we still want to
861 // record the actual results. 862 // record the actual results.
862 SkHashDigest actualBitmapHash; 863 SkHashDigest actualBitmapHash;
863 // TODO(epoger): Better handling for error returned by ComputeDigest ()? 864 // TODO(epoger): Better handling for error returned by ComputeDigest ()?
864 // For now, we just report a digest of 0 in error cases, like before . 865 // For now, we just report a digest of 0 in error cases, like before .
865 if (!SkBitmapHasher::ComputeDigest(actualBitmap, &actualBitmapHash)) { 866 if (!SkBitmapHasher::ComputeDigest(actualBitmap, &actualBitmapHash)) {
866 actualBitmapHash = 0; 867 actualBitmapHash = 0;
867 } 868 }
868 add_actual_results_to_json_summary(name.c_str(), actualBitmapHash, 869 SkString nameWithExtension(name);
870 nameWithExtension.append(".png");
871 add_actual_results_to_json_summary(nameWithExtension.c_str(), actual BitmapHash,
869 ErrorCombination(kMissingExpectat ions_ErrorType), 872 ErrorCombination(kMissingExpectat ions_ErrorType),
870 false); 873 false);
871 RecordTestResults(ErrorCombination(kMissingExpectations_ErrorType), name, ""); 874 RecordTestResults(ErrorCombination(kMissingExpectations_ErrorType), name, "");
872 } 875 }
873 876
874 // TODO: Consider moving this into compare_to_expectations(), 877 // TODO: Consider moving this into compare_to_expectations(),
875 // similar to fMismatchPath... for now, we don't do that, because 878 // similar to fMismatchPath... for now, we don't do that, because
876 // we don't want to write out the actual bitmaps for all 879 // we don't want to write out the actual bitmaps for all
877 // renderModes of all tests! That would be a lot of files. 880 // renderModes of all tests! That would be a lot of files.
878 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) { 881 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) {
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 if (FLAGS_forceBWtext) { 2011 if (FLAGS_forceBWtext) {
2009 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2012 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2010 } 2013 }
2011 } 2014 }
2012 2015
2013 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2016 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2014 int main(int argc, char * const argv[]) { 2017 int main(int argc, char * const argv[]) {
2015 return tool_main(argc, (char**) argv); 2018 return tool_main(argc, (char**) argv);
2016 } 2019 }
2017 #endif 2020 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698