| Index: tests/CodecAnimTest.cpp
|
| diff --git a/tests/CodecAnimTest.cpp b/tests/CodecAnimTest.cpp
|
| index fee6879a90a29b8218ed716e2c38606b3be8aa10..1dec9a9b0008df1096d100b792462fc8208754ab 100644
|
| --- a/tests/CodecAnimTest.cpp
|
| +++ b/tests/CodecAnimTest.cpp
|
| @@ -25,23 +25,25 @@ 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 } },
|
| -
|
| - { "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 },
|
| +
|
| + { "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) {
|
| + for (const auto& rec : gRecs) {
|
| std::unique_ptr<SkStream> stream(GetResourceAsStream(rec.fName));
|
| if (!stream) {
|
| // Useful error statement, but sometimes people run tests without
|
| @@ -56,10 +58,22 @@ DEF_TEST(Codec_frames, r) {
|
| continue;
|
| }
|
|
|
| + std::vector<SkCodec::FrameInfo> frameInfos;
|
| + int repetitionCount;
|
| + const bool isAnimated = codec->getFrameInfo(&frameInfos, &repetitionCount);
|
| + if (!isAnimated) {
|
| + REPORTER_ASSERT(r, rec.fFrameCount == 1);
|
| + continue;
|
| + }
|
| +
|
| + if (rec.fFrameCount == 1) {
|
| + // SkGifCodec still returns true even if there is only one frame.
|
| + continue;
|
| + }
|
| +
|
| + // From here on, we are only concerned with animated images.
|
| const size_t expected = rec.fFrameCount;
|
| - const auto frameInfos = codec->getFrameInfo();
|
| - // getFrameInfo returns empty set for non-animated.
|
| - const size_t frameCount = frameInfos.size() == 0 ? 1 : frameInfos.size();
|
| + const size_t frameCount = frameInfos.size();
|
| if (frameCount != expected) {
|
| ERRORF(r, "'%s' expected frame count: %i\tactual: %i", rec.fName, expected, frameCount);
|
| continue;
|
| @@ -71,11 +85,7 @@ DEF_TEST(Codec_frames, r) {
|
| continue;
|
| }
|
|
|
| - if (1 == frameCount) {
|
| - continue;
|
| - }
|
| -
|
| - // From here on, we are only concerned with animated images.
|
| + REPORTER_ASSERT(r, repetitionCount == rec.fRepetitionCount);
|
| REPORTER_ASSERT(r, frameInfos[0].fRequiredFrame == SkCodec::kNone);
|
| for (size_t i = 1; i < frameCount; i++) {
|
| REPORTER_ASSERT(r, rec.fRequiredFrames[i-1] == frameInfos[i].fRequiredFrame);
|
|
|