Add SkAnimatedImage::getRepetitionCount
Bug: b/63908092
Android does not need to have its end listener attached if the
repetition count is infinite. Provide an accessor so it will know.
Change-Id: I481b048994a6e86ae88c913a5dcca3788b92bae2
Reviewed-on: https://skia-review.googlesource.com/99883
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
diff --git a/tests/AnimatedImageTest.cpp b/tests/AnimatedImageTest.cpp
index cbbef2d..95d7fc6 100644
--- a/tests/AnimatedImageTest.cpp
+++ b/tests/AnimatedImageTest.cpp
@@ -82,6 +82,8 @@
continue;
}
+ REPORTER_ASSERT(r, defaultRepetitionCount == animatedImage->getRepetitionCount());
+
auto testDraw = [r, &frames, &imageInfo, file](const sk_sp<SkAnimatedImage>& animatedImage,
int expectedFrame) {
SkBitmap test;
@@ -216,6 +218,8 @@
SkCodec::MakeFromData(data)));
animatedImage->start();
animatedImage->setRepetitionCount(loopCount);
+ REPORTER_ASSERT(r, animatedImage->getRepetitionCount() == loopCount);
+
for (int loops = 0; loops <= loopCount; loops++) {
REPORTER_ASSERT(r, animatedImage->isRunning());
REPORTER_ASSERT(r, !animatedImage->isFinished());