diff options
author | scroggo <scroggo@chromium.org> | 2016-11-01 08:28:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-01 08:28:28 -0700 |
commit | e71b1a1496738ebce4a8cac4ffa5ee1413996542 (patch) | |
tree | 725838575056d43c89536794e9e4f0c8c063f749 /tests/CodecAnimTest.cpp | |
parent | c25c5d73e9f4d840dc758c399496d5690709ad58 (diff) |
Report repetition count in SkCodec
Add a new accessor to retrieve the repetition count.
Remove constants (and corresponding copyright) in SkCodecAnimation.
These may make sense for the calling code, but are not needed here.
kRepetitionCountInfinite corresponds to Blink's kAnimationLoopInfinite.
Move cLoopCountNotSeen to private. It is used to determine whether we
still need to parse. Add a new enum to the parse query - only parse
enough to determine the repetition count.
Unlike Chromium, SkGifCodec does not account for deleting the reader
(which SkGifCodec does not do) or failed decodes.
Add a test.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2447863002
Review-Url: https://codereview.chromium.org/2447863002
Diffstat (limited to 'tests/CodecAnimTest.cpp')
-rw-r--r-- | tests/CodecAnimTest.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/tests/CodecAnimTest.cpp b/tests/CodecAnimTest.cpp index de36ce65d0..762cd477a7 100644 --- a/tests/CodecAnimTest.cpp +++ b/tests/CodecAnimTest.cpp @@ -25,21 +25,23 @@ DEF_TEST(Codec_frames, r) { // The size of this one should match fFrameCount for animated, empty // otherwise. std::vector<size_t> fDurations; + int fRepetitionCount; } gRecs[] = { - { "box.gif", 1, {}, {} }, - { "color_wheel.gif", 1, {}, {} }, - { "test640x479.gif", 4, { 0, 1, 2 }, { 200, 200, 200, 200 } }, - { "colorTables.gif", 2, { 0 }, { 1000, 1000 } }, - - { "arrow.png", 1, {}, {} }, - { "google_chrome.ico", 1, {}, {} }, - { "brickwork-texture.jpg", 1, {}, {} }, + { "box.gif", 1, {}, {}, 0 }, + { "color_wheel.gif", 1, {}, {}, 0 }, + { "test640x479.gif", 4, { 0, 1, 2 }, { 200, 200, 200, 200 }, + SkCodec::kRepetitionCountInfinite }, + { "colorTables.gif", 2, { 0 }, { 1000, 1000 }, 5 }, + + { "arrow.png", 1, {}, {}, 0 }, + { "google_chrome.ico", 1, {}, {}, 0 }, + { "brickwork-texture.jpg", 1, {}, {}, 0 }, #if defined(SK_CODEC_DECODES_RAW) && (!defined(_WIN32)) - { "dng_with_preview.dng", 1, {}, {} }, + { "dng_with_preview.dng", 1, {}, {}, 0 }, #endif - { "mandrill.wbmp", 1, {}, {} }, - { "randPixels.bmp", 1, {}, {} }, - { "yellow_rose.webp", 1, {}, {} }, + { "mandrill.wbmp", 1, {}, {}, 0 }, + { "randPixels.bmp", 1, {}, {}, 0 }, + { "yellow_rose.webp", 1, {}, {}, 0 }, }; for (auto rec : gRecs) { @@ -57,6 +59,12 @@ DEF_TEST(Codec_frames, r) { continue; } + const int repetitionCount = codec->getRepetitionCount(); + if (repetitionCount != rec.fRepetitionCount) { + ERRORF(r, "%s repetition count does not match! expected: %i\tactual: %i", + rec.fName, rec.fRepetitionCount, repetitionCount); + } + const size_t expected = rec.fFrameCount; const auto frameInfos = codec->getFrameInfo(); // getFrameInfo returns empty set for non-animated. |