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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 * represent identical results. | 69 * represent identical results. |
70 */ | 70 */ |
71 bool equals(const GmResultDigest &other) const; | 71 bool equals(const GmResultDigest &other) const; |
72 | 72 |
73 /** | 73 /** |
74 * Returns a JSON type/value pair representing this result, | 74 * Returns a JSON type/value pair representing this result, |
75 * such as ["bitmap-64bitMD5", 12345]. | 75 * such as ["bitmap-64bitMD5", 12345]. |
76 */ | 76 */ |
77 Json::Value asJsonTypeValuePair() const; | 77 Json::Value asJsonTypeValuePair() const; |
78 | 78 |
| 79 /** |
| 80 * Returns the hashtype, such as "bitmap-64bitMD5", as an SkString. |
| 81 */ |
| 82 SkString getHashType() const; |
| 83 |
| 84 /** |
| 85 * Returns the hash digest value, such as "12345", as an SkString. |
| 86 */ |
| 87 SkString getDigestValue() const; |
| 88 |
79 private: | 89 private: |
80 bool fIsValid; // always check this first--if it's false, other fields a
re meaningless | 90 bool fIsValid; // always check this first--if it's false, other fields a
re meaningless |
81 uint64_t fHashDigest; | 91 uint64_t fHashDigest; |
82 }; | 92 }; |
83 | 93 |
84 /** | 94 /** |
| 95 * Encapsulates an SkBitmap and its GmResultDigest, guaranteed to keep them
in sync. |
| 96 */ |
| 97 class BitmapAndDigest { |
| 98 public: |
| 99 BitmapAndDigest(const SkBitmap &bitmap) : fBitmap(bitmap), fDigest(bitma
p) {} |
| 100 |
| 101 const SkBitmap fBitmap; |
| 102 const GmResultDigest fDigest; |
| 103 }; |
| 104 |
| 105 /** |
85 * Test expectations (allowed image results, etc.) | 106 * Test expectations (allowed image results, etc.) |
86 */ | 107 */ |
87 class Expectations { | 108 class Expectations { |
88 public: | 109 public: |
89 /** | 110 /** |
90 * No expectations at all. | 111 * No expectations at all. |
91 */ | 112 */ |
92 Expectations(bool ignoreFailure=kDefaultIgnoreFailure); | 113 Expectations(bool ignoreFailure=kDefaultIgnoreFailure); |
93 | 114 |
94 /** | 115 /** |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 * Returns true if successful. | 259 * Returns true if successful. |
239 */ | 260 */ |
240 static bool Parse(const char *jsonPath, Json::Value *jsonRoot); | 261 static bool Parse(const char *jsonPath, Json::Value *jsonRoot); |
241 | 262 |
242 Json::Value fJsonRoot; | 263 Json::Value fJsonRoot; |
243 Json::Value fJsonExpectedResults; | 264 Json::Value fJsonExpectedResults; |
244 }; | 265 }; |
245 | 266 |
246 } | 267 } |
247 #endif | 268 #endif |
OLD | NEW |