Skip to content

Commit

Permalink
Verify accounting for loop counts in Gif and WebP assets is consisten…
Browse files Browse the repository at this point in the history
…t. (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#14315.

Fixes flutter/flutter#46289
Fixes flutter/flutter#45246
  • Loading branch information
chinmaygarde authored and filmil committed Mar 13, 2020
1 parent 8674fc8 commit d7cc18c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ FILE: ../../../flutter/lib/ui/dart_ui.h
FILE: ../../../flutter/lib/ui/dart_wrapper.h
FILE: ../../../flutter/lib/ui/fixtures/DashInNooglerHat.jpg
FILE: ../../../flutter/lib/ui/fixtures/Horizontal.jpg
FILE: ../../../flutter/lib/ui/fixtures/hello_loop_2.gif
FILE: ../../../flutter/lib/ui/fixtures/hello_loop_2.webp
FILE: ../../../flutter/lib/ui/fixtures/ui_test.dart
FILE: ../../../flutter/lib/ui/geometry.dart
FILE: ../../../flutter/lib/ui/hash_codes.dart
Expand Down
2 changes: 2 additions & 0 deletions lib/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ if (current_toolchain == host_toolchain) {
fixtures = [
"fixtures/DashInNooglerHat.jpg",
"fixtures/Horizontal.jpg",
"fixtures/hello_loop_2.gif",
"fixtures/hello_loop_2.webp",
]
}

Expand Down
Binary file added lib/ui/fixtures/hello_loop_2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib/ui/fixtures/hello_loop_2.webp
Binary file not shown.
23 changes: 23 additions & 0 deletions lib/ui/painting/image_decoder_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "flutter/testing/test_gl_surface.h"
#include "flutter/testing/testing.h"
#include "flutter/testing/thread_test.h"
#include "third_party/skia/include/codec/SkCodec.h"

namespace flutter {
namespace testing {
Expand Down Expand Up @@ -496,5 +497,27 @@ TEST_F(ImageDecoderFixtureTest, CanResizeWithoutDecode) {
latch.Wait();
}

// Verifies https://skia-review.googlesource.com/c/skia/+/259161 is present in
// Flutter.
TEST(ImageDecoderTest,
VerifyCodecRepeatCountsForGifAndWebPAreConsistentWithLoopCounts) {
auto gif_mapping = OpenFixtureAsSkData("hello_loop_2.gif");
auto webp_mapping = OpenFixtureAsSkData("hello_loop_2.webp");

ASSERT_TRUE(gif_mapping);
ASSERT_TRUE(webp_mapping);

auto gif_codec = SkCodec::MakeFromData(gif_mapping);
auto webp_codec = SkCodec::MakeFromData(webp_mapping);

ASSERT_TRUE(gif_codec);
ASSERT_TRUE(webp_codec);

// Both fixtures have a loop count of 2 which should lead to the repeat count
// of 1
ASSERT_EQ(gif_codec->getRepetitionCount(), 1);
ASSERT_EQ(webp_codec->getRepetitionCount(), 1);
}

} // namespace testing
} // namespace flutter

0 comments on commit d7cc18c

Please sign in to comment.