Index: tests/ImageTest.cpp |
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp |
index 0b27af97807664a3a3beaa118c8ab9958af8ee6c..7cdf5b4c05d0f1ffdf0702a2388c51830e9b4f22 100644 |
--- a/tests/ImageTest.cpp |
+++ b/tests/ImageTest.cpp |
@@ -5,6 +5,7 @@ |
* found in the LICENSE file. |
*/ |
+#include "SkBitmap.h" |
#include "SkCanvas.h" |
#include "SkData.h" |
#include "SkDevice.h" |
@@ -345,3 +346,18 @@ DEF_GPUTEST(SkImage_Gpu2Cpu, reporter, factory) { |
} |
} |
#endif |
+ |
+// http://skbug.com/4390 |
+DEF_TEST(ImageFromIndex8Bitmap, r) { |
+ SkPMColor pmColors[1] = {SkPreMultiplyColor(SK_ColorWHITE)}; |
+ SkBitmap bm; |
+ SkAutoTUnref<SkColorTable> ctable( |
+ new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors))); |
+ SkImageInfo info = |
+ SkImageInfo::Make(1, 1, kIndex_8_SkColorType, kPremul_SkAlphaType); |
+ bm.allocPixels(info, nullptr, ctable); |
+ SkAutoLockPixels autoLockPixels(bm); |
+ *bm.getAddr8(0, 0) = 0; |
+ SkAutoTUnref<SkImage> img(SkImage::NewFromBitmap(bm)); |
+ REPORTER_ASSERT(r, img.get() != nullptr); |
+} |