Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1161)

Unified Diff: third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp

Issue 1769343002: GIF decoding: Add a unit test for repetition count (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@test_file
Patch Set: decode all frames Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
index de0dcb6788e8c2f287e2feb866cfa0321f2e304b..7e9d0cf23347076588268ba618b9a509e22c2490 100644
--- a/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
@@ -115,6 +115,16 @@ public:
m_image->advanceAnimation(0);
}
+ int repetitionCount()
+ {
+ return m_image->repetitionCount(true);
+ }
+
+ int animationFinished()
+ {
+ return m_image->m_animationFinished;
+ }
+
PassRefPtr<Image> imageForDefaultFrame()
{
return m_image->imageForDefaultFrame();
@@ -167,6 +177,22 @@ TEST_F(BitmapImageTest, maybeAnimated)
EXPECT_FALSE(m_image->maybeAnimated());
}
+TEST_F(BitmapImageTest, animationRepetitions)
+{
+ loadImage("/LayoutTests/fast/images/resources/full2loop.gif");
+ int expectedRepetitionCount = 2;
+ EXPECT_EQ(expectedRepetitionCount, repetitionCount());
+
+ // We actually loop once more than stored repetition count.
+ for (int repeat = 0; repeat < expectedRepetitionCount + 1; ++repeat) {
+ for (size_t i = 0; i < frameCount(); ++i) {
+ EXPECT_FALSE(animationFinished());
+ advanceAnimation();
+ }
+ }
+ EXPECT_TRUE(animationFinished());
+}
+
TEST_F(BitmapImageTest, isAllDataReceived)
{
RefPtr<SharedBuffer> imageData = readFile("/LayoutTests/fast/images/resources/green.jpg");
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698