Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: tests/GifTest.cpp

Issue 1091053002: Add a test for decoding a gif with sampleSize 4. (Closed) Base URL: https://skia.googlesource.com/skia.git@zoran
Patch Set: Use a test image provided by SonyMobile Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « resources/test640x479.gif ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/GifTest.cpp
diff --git a/tests/GifTest.cpp b/tests/GifTest.cpp
index e2e03845cad5f2c9a18f9b9f64c4b0e149b7120d..978e3745394dffe291ee662770e5fa903a531eee 100644
--- a/tests/GifTest.cpp
+++ b/tests/GifTest.cpp
@@ -5,12 +5,15 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+
// This tests out GIF decoder (SkImageDecoder_libgif.cpp)
// It is not used on these platforms:
#if (!defined(SK_BUILD_FOR_WIN32)) && \
(!defined(SK_BUILD_FOR_IOS)) && \
(!defined(SK_BUILD_FOR_MAC))
+#include "Resources.h"
#include "SkBitmap.h"
#include "SkData.h"
#include "SkForceLinking.h"
@@ -197,4 +200,25 @@ DEF_TEST(Gif, reporter) {
// "libgif warning [interlace DGifGetLine]"
}
+// Regression test for decoding a gif image with sampleSize of 4, which was
+// previously crashing.
+DEF_TEST(Gif_Sampled, r) {
+ SkFILEStream fileStream(GetResourcePath("test640x479.gif").c_str());
+ REPORTER_ASSERT(r, fileStream.isValid());
+ if (!fileStream.isValid()) {
+ return;
+ }
+
+ SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&fileStream));
+ REPORTER_ASSERT(r, decoder);
+ if (!decoder) {
+ return;
+ }
+ decoder->setSampleSize(4);
+ SkBitmap bm;
+ const SkImageDecoder::Result result = decoder->decode(&fileStream, &bm,
+ SkImageDecoder::kDecodePixels_Mode);
+ REPORTER_ASSERT(r, result == SkImageDecoder::kSuccess);
+}
+
#endif // !(SK_BUILD_FOR_WIN32||SK_BUILD_FOR_IOS||SK_BUILD_FOR_MAC)
« no previous file with comments | « resources/test640x479.gif ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698