diff options
Diffstat (limited to 'tests/BitmapTest.cpp')
-rw-r--r-- | tests/BitmapTest.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp index 4d68e73dbe..2bd8490b77 100644 --- a/tests/BitmapTest.cpp +++ b/tests/BitmapTest.cpp @@ -122,3 +122,26 @@ DEF_TEST(Bitmap, reporter) { test_bigalloc(reporter); test_peekpixels(reporter); } + +/** + * This test checks that getColor works for both swizzles. + */ +DEF_TEST(Bitmap_getColor_Swizzle, r) { + SkBitmap source; + source.allocN32Pixels(1,1); + source.eraseColor(SK_ColorRED); + SkColorType colorTypes[] = { + kRGBA_8888_SkColorType, + kBGRA_8888_SkColorType, + }; + for (SkColorType ct : colorTypes) { + SkBitmap copy; + if (!source.copyTo(©, ct)) { + ERRORF(r, "SkBitmap::copy failed %d", (int)ct); + continue; + } + SkAutoLockPixels autoLockPixels1(copy); + SkAutoLockPixels autoLockPixels2(source); + REPORTER_ASSERT(r, source.getColor(0, 0) == copy.getColor(0, 0)); + } +} |