OLD | NEW |
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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 | 759 |
760 if (addToJsonSummary) { | 760 if (addToJsonSummary) { |
761 add_actual_results_to_json_summary(completeName, actualBitmapHash, e
rrors, | 761 add_actual_results_to_json_summary(completeName, actualBitmapHash, e
rrors, |
762 expectations.ignoreFailure()); | 762 expectations.ignoreFailure()); |
763 add_expected_results_to_json_summary(completeName, expectations); | 763 add_expected_results_to_json_summary(completeName, expectations); |
764 } | 764 } |
765 | 765 |
766 return errors; | 766 return errors; |
767 } | 767 } |
768 | 768 |
| 769 // EPOGER: move this into gm_expectations.h (or a .cpp file) to isolate the
code that knows about JSON structure |
769 /** | 770 /** |
770 * Add this result to the appropriate JSON collection of actual results, | 771 * Add this result to the appropriate JSON collection of actual results, |
771 * depending on status. | 772 * depending on status. |
772 */ | 773 */ |
| 774 // EPOGER: replace SkHashDigest actualBitmapHash with a level of indirection
: resultDigest, which may be a BitmapCityhash or a BytewiseCityhash. |
773 void add_actual_results_to_json_summary(const char testName[], | 775 void add_actual_results_to_json_summary(const char testName[], |
774 const SkHashDigest& actualBitmapHash
, | 776 const SkHashDigest& actualBitmapHash
, |
775 ErrorCombination result, | 777 ErrorCombination result, |
776 bool ignoreFailure) { | 778 bool ignoreFailure) { |
777 Json::Value actualResults; | 779 Json::Value actualResults; |
778 actualResults[kJsonKey_ActualResults_AnyStatus_Checksum] = | 780 actualResults[kJsonKey_ActualResults_AnyStatus_BitmapCityhash] = |
779 asJsonValue(actualBitmapHash); | 781 asJsonValue(actualBitmapHash); |
780 if (result.isEmpty()) { | 782 if (result.isEmpty()) { |
781 this->fJsonActualResults_Succeeded[testName] = actualResults; | 783 this->fJsonActualResults_Succeeded[testName] = actualResults; |
782 } else { | 784 } else { |
783 if (ignoreFailure) { | 785 if (ignoreFailure) { |
784 // TODO: Once we have added the ability to compare | 786 // TODO: Once we have added the ability to compare |
785 // actual results against expectations in a JSON file | 787 // actual results against expectations in a JSON file |
786 // (where we can set ignore-failure to either true or | 788 // (where we can set ignore-failure to either true or |
787 // false), add test cases that exercise ignored | 789 // false), add test cases that exercise ignored |
788 // failures (both for kMissingExpectations_ErrorType | 790 // failures (both for kMissingExpectations_ErrorType |
(...skipping 26 matching lines...) Expand all Loading... |
815 | 817 |
816 /** | 818 /** |
817 * Add this test to the JSON collection of expected results. | 819 * Add this test to the JSON collection of expected results. |
818 */ | 820 */ |
819 void add_expected_results_to_json_summary(const char testName[], | 821 void add_expected_results_to_json_summary(const char testName[], |
820 Expectations expectations) { | 822 Expectations expectations) { |
821 // For now, we assume that this collection starts out empty and we | 823 // For now, we assume that this collection starts out empty and we |
822 // just fill it in as we go; once gm accepts a JSON file as input, | 824 // just fill it in as we go; once gm accepts a JSON file as input, |
823 // we'll have to change that. | 825 // we'll have to change that. |
824 Json::Value expectedResults; | 826 Json::Value expectedResults; |
825 expectedResults[kJsonKey_ExpectedResults_Checksums] = | 827 expectedResults[kJsonKey_ExpectedResults_AllowedBitmapCityhashes] = |
826 expectations.allowedChecksumsAsJson(); | 828 expectations.allowedChecksumsAsJson(); |
827 expectedResults[kJsonKey_ExpectedResults_IgnoreFailure] = | 829 expectedResults[kJsonKey_ExpectedResults_IgnoreFailure] = |
828 expectations.ignoreFailure(); | 830 expectations.ignoreFailure(); |
829 this->fJsonExpectedResults[testName] = expectedResults; | 831 this->fJsonExpectedResults[testName] = expectedResults; |
830 } | 832 } |
831 | 833 |
832 /** | 834 /** |
833 * Compare actualBitmap to expectations stored in this->fExpectationsSource. | 835 * Compare actualBitmap to expectations stored in this->fExpectationsSource. |
834 * | 836 * |
835 * @param gm which test generated the actualBitmap | 837 * @param gm which test generated the actualBitmap |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 if (FLAGS_forceBWtext) { | 2004 if (FLAGS_forceBWtext) { |
2003 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2005 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
2004 } | 2006 } |
2005 } | 2007 } |
2006 | 2008 |
2007 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2009 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
2008 int main(int argc, char * const argv[]) { | 2010 int main(int argc, char * const argv[]) { |
2009 return tool_main(argc, (char**) argv); | 2011 return tool_main(argc, (char**) argv); |
2010 } | 2012 } |
2011 #endif | 2013 #endif |
OLD | NEW |