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

Unified Diff: tests/PDFJpegEmbedTest.cpp

Issue 1133443003: SkPDF: detect YUV-JPEG without relying on ImageGenerator (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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 | « src/pdf/SkPDFBitmap.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PDFJpegEmbedTest.cpp
diff --git a/tests/PDFJpegEmbedTest.cpp b/tests/PDFJpegEmbedTest.cpp
index 133d84a3ff745e9b5177739c59f48c55e43a2975..cfe6776bf5b22f8dedd3cbfd35c66ac7fd79fe56 100644
--- a/tests/PDFJpegEmbedTest.cpp
+++ b/tests/PDFJpegEmbedTest.cpp
@@ -87,3 +87,41 @@ DEF_TEST(PDFJpegEmbedTest, r) {
// embedded into the PDF directly.
REPORTER_ASSERT(r, !is_subset_of(cmykData, pdfData));
}
+
+#include "SkJpegInfo.h"
+
+DEF_TEST(JpegIdentification, r) {
+ static struct {
+ const char* path;
+ bool isJfif;
+ SkJFIFInfo::Type type;
+ } kTests[] = {{"CMYK.jpg", false, SkJFIFInfo::kGrayscale},
+ {"color_wheel.jpg", true, SkJFIFInfo::kYCbCr},
+ {"grayscale.jpg", true, SkJFIFInfo::kGrayscale},
+ {"mandrill_512_q075.jpg", true, SkJFIFInfo::kYCbCr},
+ {"randPixels.jpg", true, SkJFIFInfo::kYCbCr}};
+ for (size_t i = 0; i < SK_ARRAY_COUNT(kTests); ++i) {
+ SkAutoTUnref<SkData> data(
+ load_resource(r, "JpegIdentification", kTests[i].path));
+ if (!data) {
+ continue;
+ }
+ SkJFIFInfo info;
+ bool isJfif = SkIsJFIF(data, &info);
+ if (isJfif != kTests[i].isJfif) {
+ ERRORF(r, "%s failed isJfif test", kTests[i].path);
+ continue;
+ }
+ if (!isJfif) {
+ continue; // not applicable
+ }
+ if (kTests[i].type != info.fType) {
+ ERRORF(r, "%s failed jfif type test", kTests[i].path);
+ continue;
+ }
+ if (r->verbose()) {
+ SkDebugf("\nJpegIdentification: %s [%d x %d]\n", kTests[i].path,
+ info.fWidth, info.fHeight);
+ }
+ }
+}
« no previous file with comments | « src/pdf/SkPDFBitmap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698