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

Unified Diff: tests/CodexTest.cpp

Issue 1254483004: Scanline decoding for wbmp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase on new design of SkScanlineDecoder Created 5 years, 4 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
« src/codec/SkScanlineDecoder.cpp ('K') | « src/codec/SkSwizzler.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/CodexTest.cpp
diff --git a/tests/CodexTest.cpp b/tests/CodexTest.cpp
index 1dd64d9a6dacb5a6b4fa7b91721da6c39d84a057..b1ff6a9874a917ea9280e0b8c99b9c9610252795 100644
--- a/tests/CodexTest.cpp
+++ b/tests/CodexTest.cpp
@@ -152,7 +152,7 @@ static void check(skiatest::Reporter* r,
DEF_TEST(Codec, r) {
// WBMP
- check(r, "mandrill.wbmp", SkISize::Make(512, 512), false, false);
+ check(r, "mandrill.wbmp", SkISize::Make(512, 512), true, false);
// WEBP
check(r, "baby_tux.webp", SkISize::Make(386, 395), false, true);
@@ -289,3 +289,23 @@ DEF_TEST(Codec_Empty, r) {
test_empty(r, "empty_images/zero-width.wbmp");
test_empty(r, "empty_images/zero-height.wbmp");
}
+
+static void test_invalid_parameters(skiatest::Reporter* r, const char path[]) {
+ SkAutoTDelete<SkStream> stream(resource(path));
+ if (!stream) {
+ SkDebugf("Missing resource '%s'\n", path);
+ return;
+ }
+ SkAutoTDelete<SkScanlineDecoder> decoder(SkScanlineDecoder::NewFromStream(stream.detach()));
+ // This should return kInvalidConversion because, in kIndex_8 mode, we must pass in a valid
+ // colorPtr and a valid colorCountPtr.
+ SkCodec::Result result = decoder->start(
+ decoder->getInfo().makeColorType(kIndex_8_SkColorType), NULL, NULL, NULL);
scroggo 2015/08/04 20:24:11 FWIW, you could leave off the last three NULLs and
msarett 2015/08/04 21:21:26 I put the SkASSERT back in. This means we will cr
+ REPORTER_ASSERT(r, SkCodec::kInvalidConversion == result);
+}
+
+DEF_TEST(Codec_Params, r) {
+ test_invalid_parameters(r, "mandrill_512.png");
scroggo 2015/08/04 20:24:11 Is this a kIndex8 image? It might be interesting t
msarett 2015/08/04 21:21:26 Yes kInvalidParameters is better! Yes it is better
+ test_invalid_parameters(r, "mandrill.wbmp");
+ test_invalid_parameters(r, "CMYK.jpg");
+}
« src/codec/SkScanlineDecoder.cpp ('K') | « src/codec/SkSwizzler.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698