Verify accounting for loop counts in Gif and WebP assets is consistent. (flutter/engine#14321)

Asserts that the Skia fix is pulled into Flutter Engine https://skia-review.googlesource.com/c/skia/+/259161. This should have happened in https://github.com/flutter/engine/pull/14315.

Fixes https://github.com/flutter/flutter/issues/46289
Fixes https://github.com/flutter/flutter/issues/45246
This commit is contained in:
Chinmay Garde
2019-12-10 20:04:15 -08:00
committed by GitHub
parent d140623043
commit 054de2f56d
5 changed files with 27 additions and 0 deletions

View File

@@ -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

View File

@@ -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",
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -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 {
@@ -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