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

Unified Diff: tests/PDFJpegEmbedTest.cpp

Issue 1372783003: SkPDF: Implement drawImage*() properly (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-09-30 (Wednesday) 21:22:24 EDT Created 5 years, 3 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/SkPDFTypes.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 812fd3b2c3392279bc40450f77efde9fa1595f07..5185eb7bd4169efa97fe1772d2dd87c0a081856b 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());
}
}
}
« no previous file with comments | « src/pdf/SkPDFTypes.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698