Index: Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp |
diff --git a/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp b/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp |
index db39a29bfc4c3c35fdb767c8285ea3a882eae7cd..f7844879994b9c5f83ec8b67b717940ebf68a84e 100644 |
--- a/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp |
+++ b/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp |
@@ -499,3 +499,31 @@ TEST(GIFImageDecoderTest, invalidDisposalMethod) |
// Disposal method 5 is ignored. |
EXPECT_EQ(ImageFrame::DisposeNotSpecified, decoder->frameBufferAtIndex(1)->disposalMethod()); |
} |
+ |
+TEST(GIFImageDecoderTest, firstFrameHasGreaterSizeThanScreenSize) |
+{ |
+ RefPtr<SharedBuffer> fullData = readFile("/Source/platform/image-decoders/testing/first-frame-has-greater-size-than-screen-size.gif"); |
+ ASSERT_TRUE(fullData.get()); |
+ const size_t fullLength = fullData->size(); |
Peter Kasting
2015/01/08 06:56:18
Nit: I'd probably omit this temp and just do the c
Alpha Left Google
2015/01/12 22:12:49
Done.
|
+ |
+ OwnPtr<GIFImageDecoder> decoder; |
+ IntSize frameSize; |
+ |
+ // Compute hashes when the file is truncated. |
+ const size_t increment = 1; |
Peter Kasting
2015/01/08 06:56:18
If you're not going to use a random increment size
Alpha Left Google
2015/01/12 22:12:49
Done.
|
+ for (size_t i = 1; i <= fullLength; i += increment) { |
+ decoder = createDecoder(); |
+ RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), i); |
+ decoder->setData(data.get(), i == fullLength); |
+ |
+ if (decoder->isSizeAvailable() && !frameSize.width() && !frameSize.height()) |
+ frameSize = decoder->decodedSize(); |
Peter Kasting
2015/01/08 06:56:18
It seems like this should just continue, since thi
Alpha Left Google
2015/01/12 22:12:49
Done.
|
+ |
+ EXPECT_EQ(frameSize.width(), decoder->decodedSize().width()); |
+ EXPECT_EQ(frameSize.height(), decoder->decodedSize().height()); |
+ |
+ if (frameSize.width() != decoder->decodedSize().width() |
+ || frameSize.height() != decoder->decodedSize().height()) |
+ break; |
Peter Kasting
2015/01/08 06:56:18
Why not just ASSERT_EQ above and omit this conditi
Alpha Left Google
2015/01/12 22:12:49
Done.
|
+ } |
+} |