aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PDFJpegEmbedTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/PDFJpegEmbedTest.cpp')
-rw-r--r--tests/PDFJpegEmbedTest.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/tests/PDFJpegEmbedTest.cpp b/tests/PDFJpegEmbedTest.cpp
index 812fd3b2c3..5185eb7bd4 100644
--- a/tests/PDFJpegEmbedTest.cpp
+++ b/tests/PDFJpegEmbedTest.cpp
@@ -62,7 +62,7 @@ DEF_TEST(PDFJpegEmbedTest, r) {
if (!mandrillData || !cmykData) {
return;
}
-
+ ////////////////////////////////////////////////////////////////////////////
SkDynamicMemoryWStream pdf;
SkAutoTUnref<SkDocument> document(SkDocument::CreatePDF(&pdf));
SkCanvas* canvas = document->beginPage(642, 1028);
@@ -86,6 +86,30 @@ DEF_TEST(PDFJpegEmbedTest, r) {
// This JPEG uses a nonstandard colorspace - it can not be
// embedded into the PDF directly.
REPORTER_ASSERT(r, !is_subset_of(cmykData, pdfData));
+ ////////////////////////////////////////////////////////////////////////////
+ pdf.reset();
+ document.reset(SkDocument::CreatePDF(&pdf));
+ canvas = document->beginPage(642, 1028);
+
+ canvas->clear(SK_ColorLTGRAY);
+
+ SkAutoTUnref<SkImage> im1(SkImage::NewFromEncoded(mandrillData));
+ canvas->drawImage(im1, 65.0, 0.0, nullptr);
+ SkAutoTUnref<SkImage> im2(SkImage::NewFromEncoded(cmykData));
+ canvas->drawImage(im2, 0.0, 512.0, nullptr);
+
+ canvas->flush();
+ document->endPage();
+ document->close();
+ pdfData.reset(pdf.copyToData());
+ SkASSERT(pdfData);
+ pdf.reset();
+
+ REPORTER_ASSERT(r, is_subset_of(mandrillData, pdfData));
+
+ // This JPEG uses a nonstandard colorspace - it can not be
+ // embedded into the PDF directly.
+ REPORTER_ASSERT(r, !is_subset_of(cmykData, pdfData));
}
#include "SkJpegInfo.h"
@@ -121,7 +145,7 @@ DEF_TEST(JpegIdentification, r) {
}
if (r->verbose()) {
SkDebugf("\nJpegIdentification: %s [%d x %d]\n", kTests[i].path,
- info.fWidth, info.fHeight);
+ info.fSize.width(), info.fSize.height());
}
}
}