diff options
author | halcanary <halcanary@google.com> | 2014-07-28 08:23:55 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-07-28 08:23:55 -0700 |
commit | 7f8aad84de1661727b467940a4f0e6f6531fc0a1 (patch) | |
tree | f0ebd95b2180c3692dd8ca7eb9058efdd72d2872 /tests | |
parent | edb10e79f5cd1b48baa77f82705d4e711fb35ba4 (diff) |
SkDiscardablePixelRef returns correct indexed color on relock.
R=djsollen@google.com
Author: halcanary@google.com
Review URL: https://codereview.chromium.org/428603002
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ImageDecodingTest.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp index d070f615b3..d8e813d10e 100644 --- a/tests/ImageDecodingTest.cpp +++ b/tests/ImageDecodingTest.cpp @@ -723,3 +723,27 @@ DEF_TEST(ImageDecoderOptions, reporter) { } } } + +DEF_TEST(DiscardablePixelRef_SecondLockColorTableCheck, r) { + SkString resourceDir = GetResourcePath(); + SkString path = SkOSPath::SkPathJoin(resourceDir.c_str(), "randPixels.gif"); + if (!sk_exists(path.c_str())) { + return; + } + SkAutoDataUnref encoded(SkData::NewFromFileName(path.c_str())); + SkBitmap bitmap; + if (!SkInstallDiscardablePixelRef( + SkDecodingImageGenerator::Create( + encoded, SkDecodingImageGenerator::Options()), &bitmap)) { + ERRORF(r, "SkInstallDiscardablePixelRef [randPixels.gif] failed."); + return; + } + { + SkAutoLockPixels alp(bitmap); + REPORTER_ASSERT(r, bitmap.getColorTable() && "first pass"); + } + { + SkAutoLockPixels alp(bitmap); + REPORTER_ASSERT(r, bitmap.getColorTable() && "second pass"); + } +} |