Skip to content

Commit 49d6552

Browse files
authored
Verify accounting for loop counts in Gif and WebP assets is consistent. (flutter#14321)
Asserts that the Skia fix is pulled into Flutter Engine https://skia-review.googlesource.com/c/skia/+/259161. This should have happened in flutter/engine#14315. Fixes flutter#46289 Fixes flutter#45246
1 parent 6430ecf commit 49d6552

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ FILE: ../../../flutter/lib/ui/dart_ui.h
269269
FILE: ../../../flutter/lib/ui/dart_wrapper.h
270270
FILE: ../../../flutter/lib/ui/fixtures/DashInNooglerHat.jpg
271271
FILE: ../../../flutter/lib/ui/fixtures/Horizontal.jpg
272+
FILE: ../../../flutter/lib/ui/fixtures/hello_loop_2.gif
273+
FILE: ../../../flutter/lib/ui/fixtures/hello_loop_2.webp
272274
FILE: ../../../flutter/lib/ui/fixtures/ui_test.dart
273275
FILE: ../../../flutter/lib/ui/geometry.dart
274276
FILE: ../../../flutter/lib/ui/hash_codes.dart

lib/ui/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ if (current_toolchain == host_toolchain) {
155155
fixtures = [
156156
"fixtures/DashInNooglerHat.jpg",
157157
"fixtures/Horizontal.jpg",
158+
"fixtures/hello_loop_2.gif",
159+
"fixtures/hello_loop_2.webp",
158160
]
159161
}
160162

lib/ui/fixtures/hello_loop_2.gif

28.6 KB
Loading

lib/ui/fixtures/hello_loop_2.webp

17.6 KB
Loading

lib/ui/painting/image_decoder_unittests.cc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "flutter/testing/test_gl_surface.h"
1010
#include "flutter/testing/testing.h"
1111
#include "flutter/testing/thread_test.h"
12+
#include "third_party/skia/include/codec/SkCodec.h"
1213

1314
namespace flutter {
1415
namespace testing {
@@ -496,5 +497,27 @@ TEST_F(ImageDecoderFixtureTest, CanResizeWithoutDecode) {
496497
latch.Wait();
497498
}
498499

500+
// Verifies https://skia-review.googlesource.com/c/skia/+/259161 is present in
501+
// Flutter.
502+
TEST(ImageDecoderTest,
503+
VerifyCodecRepeatCountsForGifAndWebPAreConsistentWithLoopCounts) {
504+
auto gif_mapping = OpenFixtureAsSkData("hello_loop_2.gif");
505+
auto webp_mapping = OpenFixtureAsSkData("hello_loop_2.webp");
506+
507+
ASSERT_TRUE(gif_mapping);
508+
ASSERT_TRUE(webp_mapping);
509+
510+
auto gif_codec = SkCodec::MakeFromData(gif_mapping);
511+
auto webp_codec = SkCodec::MakeFromData(webp_mapping);
512+
513+
ASSERT_TRUE(gif_codec);
514+
ASSERT_TRUE(webp_codec);
515+
516+
// Both fixtures have a loop count of 2 which should lead to the repeat count
517+
// of 1
518+
ASSERT_EQ(gif_codec->getRepetitionCount(), 1);
519+
ASSERT_EQ(webp_codec->getRepetitionCount(), 1);
520+
}
521+
499522
} // namespace testing
500523
} // namespace flutter

0 commit comments

Comments
 (0)