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

Side by Side Diff: tests/PDFJpegEmbedTest.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 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 unified diff | Download patch
« no previous file with comments | « tests/PDFGlyphsToUnicodeTest.cpp ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDocument.h" 8 #include "SkDocument.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkImageGenerator.h" 10 #include "SkImageGenerator.h"
(...skipping 28 matching lines...) Expand all
39 39
40 40
41 static SkData* load_resource( 41 static SkData* load_resource(
42 skiatest::Reporter* r, const char* test, const char* filename) { 42 skiatest::Reporter* r, const char* test, const char* filename) {
43 SkString path(GetResourcePath(filename)); 43 SkString path(GetResourcePath(filename));
44 SkData* data = SkData::NewFromFileName(path.c_str()); 44 SkData* data = SkData::NewFromFileName(path.c_str());
45 if (!data && r->verbose()) { 45 if (!data && r->verbose()) {
46 SkDebugf("\n%s: Resource '%s' can not be found.\n", 46 SkDebugf("\n%s: Resource '%s' can not be found.\n",
47 test, filename); 47 test, filename);
48 } 48 }
49 return data; // May return NULL. 49 return data; // May return nullptr.
50 } 50 }
51 51
52 /** 52 /**
53 * Test that for Jpeg files that use the JFIF colorspace, they are 53 * Test that for Jpeg files that use the JFIF colorspace, they are
54 * directly embedded into the PDF (without re-encoding) when that 54 * directly embedded into the PDF (without re-encoding) when that
55 * makes sense. 55 * makes sense.
56 */ 56 */
57 DEF_TEST(PDFJpegEmbedTest, r) { 57 DEF_TEST(PDFJpegEmbedTest, r) {
58 const char test[] = "PDFJpegEmbedTest"; 58 const char test[] = "PDFJpegEmbedTest";
59 SkAutoTUnref<SkData> mandrillData( 59 SkAutoTUnref<SkData> mandrillData(
60 load_resource(r, test, "mandrill_512_q075.jpg")); 60 load_resource(r, test, "mandrill_512_q075.jpg"));
61 SkAutoTUnref<SkData> cmykData(load_resource(r, test, "CMYK.jpg")); 61 SkAutoTUnref<SkData> cmykData(load_resource(r, test, "CMYK.jpg"));
62 if (!mandrillData || !cmykData) { 62 if (!mandrillData || !cmykData) {
63 return; 63 return;
64 } 64 }
65 65
66 SkDynamicMemoryWStream pdf; 66 SkDynamicMemoryWStream pdf;
67 SkAutoTUnref<SkDocument> document(SkDocument::CreatePDF(&pdf)); 67 SkAutoTUnref<SkDocument> document(SkDocument::CreatePDF(&pdf));
68 SkCanvas* canvas = document->beginPage(642, 1028); 68 SkCanvas* canvas = document->beginPage(642, 1028);
69 69
70 canvas->clear(SK_ColorLTGRAY); 70 canvas->clear(SK_ColorLTGRAY);
71 71
72 SkBitmap bm1(bitmap_from_data(mandrillData)); 72 SkBitmap bm1(bitmap_from_data(mandrillData));
73 canvas->drawBitmap(bm1, 65.0, 0.0, NULL); 73 canvas->drawBitmap(bm1, 65.0, 0.0, nullptr);
74 SkBitmap bm2(bitmap_from_data(cmykData)); 74 SkBitmap bm2(bitmap_from_data(cmykData));
75 canvas->drawBitmap(bm2, 0.0, 512.0, NULL); 75 canvas->drawBitmap(bm2, 0.0, 512.0, nullptr);
76 76
77 canvas->flush(); 77 canvas->flush();
78 document->endPage(); 78 document->endPage();
79 document->close(); 79 document->close();
80 SkAutoTUnref<SkData> pdfData(pdf.copyToData()); 80 SkAutoTUnref<SkData> pdfData(pdf.copyToData());
81 SkASSERT(pdfData); 81 SkASSERT(pdfData);
82 pdf.reset(); 82 pdf.reset();
83 83
84 REPORTER_ASSERT(r, is_subset_of(mandrillData, pdfData)); 84 REPORTER_ASSERT(r, is_subset_of(mandrillData, pdfData));
85 85
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (kTests[i].type != info.fType) { 118 if (kTests[i].type != info.fType) {
119 ERRORF(r, "%s failed jfif type test", kTests[i].path); 119 ERRORF(r, "%s failed jfif type test", kTests[i].path);
120 continue; 120 continue;
121 } 121 }
122 if (r->verbose()) { 122 if (r->verbose()) {
123 SkDebugf("\nJpegIdentification: %s [%d x %d]\n", kTests[i].path, 123 SkDebugf("\nJpegIdentification: %s [%d x %d]\n", kTests[i].path,
124 info.fWidth, info.fHeight); 124 info.fWidth, info.fHeight);
125 } 125 }
126 } 126 }
127 } 127 }
OLDNEW
« no previous file with comments | « tests/PDFGlyphsToUnicodeTest.cpp ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698