| 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 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 if (addToJsonSummary) { | 814 if (addToJsonSummary) { |
| 815 add_actual_results_to_json_summary(completeName, actualBitmapAndDige
st.fDigest, errors, | 815 add_actual_results_to_json_summary(completeName, actualBitmapAndDige
st.fDigest, errors, |
| 816 expectations.ignoreFailure()); | 816 expectations.ignoreFailure()); |
| 817 add_expected_results_to_json_summary(completeName, expectations); | 817 add_expected_results_to_json_summary(completeName, expectations); |
| 818 } | 818 } |
| 819 | 819 |
| 820 return errors; | 820 return errors; |
| 821 } | 821 } |
| 822 | 822 |
| 823 /** | 823 /** |
| 824 * Add this result to the appropriate JSON collection of actual results, | 824 * Add this result to the appropriate JSON collection of actual results (but
just ONE), |
| 825 * depending on errors encountered. | 825 * depending on errors encountered. |
| 826 */ | 826 */ |
| 827 void add_actual_results_to_json_summary(const char testName[], | 827 void add_actual_results_to_json_summary(const char testName[], |
| 828 const GmResultDigest &actualResultDi
gest, | 828 const GmResultDigest &actualResultDi
gest, |
| 829 ErrorCombination errors, | 829 ErrorCombination errors, |
| 830 bool ignoreFailure) { | 830 bool ignoreFailure) { |
| 831 Json::Value jsonActualResults = actualResultDigest.asJsonTypeValuePair()
; | 831 Json::Value jsonActualResults = actualResultDigest.asJsonTypeValuePair()
; |
| 832 Json::Value *resultCollection = NULL; |
| 833 |
| 832 if (errors.isEmpty()) { | 834 if (errors.isEmpty()) { |
| 833 this->fJsonActualResults_Succeeded[testName] = jsonActualResults; | 835 resultCollection = &this->fJsonActualResults_Succeeded; |
| 834 } else { | 836 } else if (errors.includes(kRenderModeMismatch_ErrorType)) { |
| 837 resultCollection = &this->fJsonActualResults_Failed; |
| 838 } else if (errors.includes(kExpectationsMismatch_ErrorType)) { |
| 835 if (ignoreFailure) { | 839 if (ignoreFailure) { |
| 836 this->fJsonActualResults_FailureIgnored[testName] = | 840 resultCollection = &this->fJsonActualResults_FailureIgnored; |
| 837 jsonActualResults; | |
| 838 } else { | 841 } else { |
| 839 if (errors.includes(kMissingExpectations_ErrorType)) { | 842 resultCollection = &this->fJsonActualResults_Failed; |
| 840 // TODO: What about the case where there IS an | |
| 841 // expected image hash digest, but that gm test | |
| 842 // doesn't actually run? For now, those cases | |
| 843 // will always be ignored, because gm only looks | |
| 844 // at expectations that correspond to gm tests | |
| 845 // that were actually run. | |
| 846 // | |
| 847 // Once we have the ability to express | |
| 848 // expectations as a JSON file, we should fix this | |
| 849 // (and add a test case for which an expectation | |
| 850 // is given but the test is never run). | |
| 851 this->fJsonActualResults_NoComparison[testName] = | |
| 852 jsonActualResults; | |
| 853 } | |
| 854 if (errors.includes(kExpectationsMismatch_ErrorType) || | |
| 855 errors.includes(kRenderModeMismatch_ErrorType)) { | |
| 856 this->fJsonActualResults_Failed[testName] = jsonActualResult
s; | |
| 857 } | |
| 858 } | 843 } |
| 844 } else if (errors.includes(kMissingExpectations_ErrorType)) { |
| 845 // TODO: What about the case where there IS an expected |
| 846 // image hash digest, but that gm test doesn't actually |
| 847 // run? For now, those cases will always be ignored, |
| 848 // because gm only looks at expectations that correspond |
| 849 // to gm tests that were actually run. |
| 850 // |
| 851 // Once we have the ability to express expectations as a |
| 852 // JSON file, we should fix this (and add a test case for |
| 853 // which an expectation is given but the test is never |
| 854 // run). |
| 855 resultCollection = &this->fJsonActualResults_NoComparison; |
| 856 } |
| 857 |
| 858 // If none of the above cases match, we don't add it to ANY tally of act
ual results. |
| 859 if (resultCollection) { |
| 860 (*resultCollection)[testName] = jsonActualResults; |
| 859 } | 861 } |
| 860 } | 862 } |
| 861 | 863 |
| 862 /** | 864 /** |
| 863 * Add this test to the JSON collection of expected results. | 865 * Add this test to the JSON collection of expected results. |
| 864 */ | 866 */ |
| 865 void add_expected_results_to_json_summary(const char testName[], | 867 void add_expected_results_to_json_summary(const char testName[], |
| 866 Expectations expectations) { | 868 Expectations expectations) { |
| 867 this->fJsonExpectedResults[testName] = expectations.asJsonValue(); | 869 this->fJsonExpectedResults[testName] = expectations.asJsonValue(); |
| 868 } | 870 } |
| (...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2296 if (FLAGS_forceBWtext) { | 2298 if (FLAGS_forceBWtext) { |
| 2297 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2299 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
| 2298 } | 2300 } |
| 2299 } | 2301 } |
| 2300 | 2302 |
| 2301 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2303 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 2302 int main(int argc, char * const argv[]) { | 2304 int main(int argc, char * const argv[]) { |
| 2303 return tool_main(argc, (char**) argv); | 2305 return tool_main(argc, (char**) argv); |
| 2304 } | 2306 } |
| 2305 #endif | 2307 #endif |
| OLD | NEW |