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

Unified Diff: tests/CodecAnimTest.cpp

Issue 2447863002: Report repetition count in SkCodec (Closed)
Patch Set: Created 4 years, 2 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
Index: tests/CodecAnimTest.cpp
diff --git a/tests/CodecAnimTest.cpp b/tests/CodecAnimTest.cpp
index e0a446f227cfd2e2442686627164e1b1aa161a06..3866e0cd2c023d5d2a1f37600ca8aea98ab32671 100644
--- a/tests/CodecAnimTest.cpp
+++ b/tests/CodecAnimTest.cpp
@@ -24,20 +24,22 @@ 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) {
@@ -56,7 +58,8 @@ DEF_TEST(Codec_frames, r) {
}
const size_t expected = rec.fFrameCount;
- const auto frameInfos = codec->getFrameInfo();
+ int repetitionCount;
+ const auto frameInfos = codec->getFrameInfo(&repetitionCount);
// getFrameInfo returns empty set for non-animated.
const size_t frameCount = frameInfos.size() == 0 ? 1 : frameInfos.size();
if (frameCount != expected) {
@@ -75,6 +78,7 @@ DEF_TEST(Codec_frames, r) {
}
// 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);

Powered by Google App Engine
This is Rietveld 408576698