| 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 #ifndef gm_expectations_DEFINED | 7 #ifndef gm_expectations_DEFINED |
| 8 #define gm_expectations_DEFINED | 8 #define gm_expectations_DEFINED |
| 9 | 9 |
| 10 #include "gm.h" | 10 #include "gm.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 Expectations(Json::Value jsonElement); | 94 Expectations(Json::Value jsonElement); |
| 95 | 95 |
| 96 /** | 96 /** |
| 97 * Returns true iff we want to ignore failed expectations. | 97 * Returns true iff we want to ignore failed expectations. |
| 98 */ | 98 */ |
| 99 bool ignoreFailure() const { return this->fIgnoreFailure; } | 99 bool ignoreFailure() const { return this->fIgnoreFailure; } |
| 100 | 100 |
| 101 /** | 101 /** |
| 102 * Returns true iff there are no allowed checksums. | 102 * Returns true iff there are no allowed checksums. |
| 103 */ | 103 */ |
| 104 bool empty() const { return this->fAllowedBitmapCityhashes.empty(); } | 104 bool empty() const { return this->fAllowedBitmapChecksums.empty(); } |
| 105 | 105 |
| 106 /** | 106 /** |
| 107 * Returns true iff actualChecksum matches any allowedChecksum, | 107 * Returns true iff actualChecksum matches any allowedChecksum, |
| 108 * regardless of fIgnoreFailure. (The caller can check | 108 * regardless of fIgnoreFailure. (The caller can check |
| 109 * that separately.) | 109 * that separately.) |
| 110 */ | 110 */ |
| 111 bool match(Checksum actualChecksum) const; | 111 bool match(Checksum actualChecksum) const; |
| 112 | 112 |
| 113 /** | 113 /** |
| 114 * If this Expectation is based on a single SkBitmap, return a | 114 * If this Expectation is based on a single SkBitmap, return a |
| 115 * pointer to that SkBitmap. Otherwise (if the Expectation is | 115 * pointer to that SkBitmap. Otherwise (if the Expectation is |
| 116 * empty, or if it was based on a list of checksums rather | 116 * empty, or if it was based on a list of checksums rather |
| 117 * than a single bitmap), returns NULL. | 117 * than a single bitmap), returns NULL. |
| 118 */ | 118 */ |
| 119 const SkBitmap *asBitmap() const { | 119 const SkBitmap *asBitmap() const { |
| 120 return (SkBitmap::kNo_Config == fBitmap.config()) ? NULL : &fBitmap; | 120 return (SkBitmap::kNo_Config == fBitmap.config()) ? NULL : &fBitmap; |
| 121 } | 121 } |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * Return a JSON representation of the expectations. | 124 * Return a JSON representation of the expectations. |
| 125 */ | 125 */ |
| 126 Json::Value asJsonValue() const; | 126 Json::Value asJsonValue() const; |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 const static bool kDefaultIgnoreFailure = false; | 129 const static bool kDefaultIgnoreFailure = false; |
| 130 | 130 |
| 131 SkTArray<Checksum> fAllowedBitmapCityhashes; | 131 SkTArray<Checksum> fAllowedBitmapChecksums; |
| 132 bool fIgnoreFailure; | 132 bool fIgnoreFailure; |
| 133 SkBitmap fBitmap; | 133 SkBitmap fBitmap; |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 /** | 136 /** |
| 137 * Abstract source of Expectations objects for individual tests. | 137 * Abstract source of Expectations objects for individual tests. |
| 138 */ | 138 */ |
| 139 class ExpectationsSource : public SkRefCnt { | 139 class ExpectationsSource : public SkRefCnt { |
| 140 public: | 140 public: |
| 141 virtual Expectations get(const char *testName) = 0; | 141 virtual Expectations get(const char *testName) = 0; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 * Returns true if successful. | 225 * Returns true if successful. |
| 226 */ | 226 */ |
| 227 static bool parse(const char *jsonPath, Json::Value *jsonRoot); | 227 static bool parse(const char *jsonPath, Json::Value *jsonRoot); |
| 228 | 228 |
| 229 Json::Value fJsonRoot; | 229 Json::Value fJsonRoot; |
| 230 Json::Value fJsonExpectedResults; | 230 Json::Value fJsonExpectedResults; |
| 231 }; | 231 }; |
| 232 | 232 |
| 233 } | 233 } |
| 234 #endif | 234 #endif |
| OLD | NEW |