diff options
Diffstat (limited to 'tests/CodecPartialTest.cpp')
| -rw-r--r-- | tests/CodecPartialTest.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/CodecPartialTest.cpp b/tests/CodecPartialTest.cpp index c029922f71..13cea8a298 100644 --- a/tests/CodecPartialTest.cpp +++ b/tests/CodecPartialTest.cpp @@ -401,3 +401,28 @@ DEF_TEST(Codec_GifPreMap, r) { compare_bitmaps(r, truth, bm); } } + +DEF_TEST(Codec_emptyIDAT, r) { + const char* name = "baby_tux.png"; + sk_sp<SkData> file = GetResourceAsData(name); + if (!file) { + SkDebugf("REMOVE\n"); + return; + } + + // Truncate to the beginning of the IDAT, immediately after the IDAT tag. + file = SkData::MakeSubset(file.get(), 0, 80); + + std::unique_ptr<SkCodec> codec(SkCodec::NewFromData(std::move(file))); + if (!codec) { + ERRORF(r, "Failed to create a codec for %s", name); + return; + } + + SkBitmap bm; + const auto info = standardize_info(codec.get()); + bm.allocPixels(info); + + const auto result = codec->getPixels(info, bm.getPixels(), bm.rowBytes()); + REPORTER_ASSERT(r, SkCodec::kIncompleteInput == result); +} |
