Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify accounting for loop counts in Gif and WebP assets is consistent. #14321

Merged
merged 2 commits into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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