| 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 #include "SkBlurMask.h" | 8 #include "SkBlurMask.h" |
| 9 #include "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
| 10 #include "SkLayerDrawLooper.h" | 10 #include "SkLayerDrawLooper.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 ASSERT(other.getTextScaleX() == paint.getTextScaleX()); | 336 ASSERT(other.getTextScaleX() == paint.getTextScaleX()); |
| 337 ASSERT(other.getTextSize() == paint.getTextSize()); | 337 ASSERT(other.getTextSize() == paint.getTextSize()); |
| 338 ASSERT(other.getLooper() == paint.getLooper()); | 338 ASSERT(other.getLooper() == paint.getLooper()); |
| 339 | 339 |
| 340 // We have to be a little looser and compare just the modes. Pointers might
not be the same. | 340 // We have to be a little looser and compare just the modes. Pointers might
not be the same. |
| 341 SkXfermode::Mode otherMode, paintMode; | 341 SkXfermode::Mode otherMode, paintMode; |
| 342 ASSERT(other.getXfermode()->asMode(&otherMode)); | 342 ASSERT(other.getXfermode()->asMode(&otherMode)); |
| 343 ASSERT(paint.getXfermode()->asMode(&paintMode)); | 343 ASSERT(paint.getXfermode()->asMode(&paintMode)); |
| 344 ASSERT(otherMode == paintMode); | 344 ASSERT(otherMode == paintMode); |
| 345 } | 345 } |
| 346 |
| 347 DEF_TEST(Paint_getHash, r) { |
| 348 // Try not to inspect the actual hash values in here. |
| 349 // We might want to change the hash function. |
| 350 |
| 351 SkPaint paint; |
| 352 const uint32_t defaultHash = paint.getHash(); |
| 353 |
| 354 // Check that some arbitrary field affects the hash. |
| 355 paint.setColor(0xFF00FF00); |
| 356 REPORTER_ASSERT(r, paint.getHash() != defaultHash); |
| 357 paint.setColor(SK_ColorBLACK); // Reset to default value. |
| 358 REPORTER_ASSERT(r, paint.getHash() == defaultHash); |
| 359 |
| 360 // SkTypeface is the first field we hash, so test it specially. |
| 361 paint.setTypeface(SkTypeface::RefDefault())->unref(); |
| 362 REPORTER_ASSERT(r, paint.getHash() != defaultHash); |
| 363 paint.setTypeface(NULL); |
| 364 REPORTER_ASSERT(r, paint.getHash() == defaultHash); |
| 365 |
| 366 // This is part of fBitfields, the last field we hash. |
| 367 paint.setHinting(SkPaint::kSlight_Hinting); |
| 368 REPORTER_ASSERT(r, paint.getHash() != defaultHash); |
| 369 paint.setHinting(SkPaint::kNormal_Hinting); |
| 370 REPORTER_ASSERT(r, paint.getHash() == defaultHash); |
| 371 } |
| OLD | NEW |