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

Side by Side Diff: tests/PDFDocumentTest.cpp

Issue 1802033003: SkPDF: SkPDFDocument reorganized so that some objects can be serialized early. (Closed) Base URL: https://skia.googlesource.com/skia.git@SkPdfDumpMethod
Patch Set: 2016-03-21 (Monday) 16:31:34 EDT Created 4 years, 9 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 | « src/pdf/SkPDFDocument.cpp ('k') | no next file » | 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 2013 Google Inc. 2 * Copyright 2013 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 #include "Test.h" 7 #include "Test.h"
8 8
9 #include "Resources.h" 9 #include "Resources.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 15 matching lines...) Expand all
26 static void test_abort(skiatest::Reporter* reporter) { 26 static void test_abort(skiatest::Reporter* reporter) {
27 SkDynamicMemoryWStream stream; 27 SkDynamicMemoryWStream stream;
28 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&stream)); 28 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&stream));
29 29
30 SkCanvas* canvas = doc->beginPage(100, 100); 30 SkCanvas* canvas = doc->beginPage(100, 100);
31 canvas->drawColor(SK_ColorRED); 31 canvas->drawColor(SK_ColorRED);
32 doc->endPage(); 32 doc->endPage();
33 33
34 doc->abort(); 34 doc->abort();
35 35
36 REPORTER_ASSERT(reporter, stream.bytesWritten() == 0); 36 // Test that only the header is written, not the full document.
37 REPORTER_ASSERT(reporter, stream.bytesWritten() < 256);
37 } 38 }
38 39
39 static void test_abortWithFile(skiatest::Reporter* reporter) { 40 static void test_abortWithFile(skiatest::Reporter* reporter) {
40 SkString tmpDir = skiatest::GetTmpDir(); 41 SkString tmpDir = skiatest::GetTmpDir();
41 42
42 if (tmpDir.isEmpty()) { 43 if (tmpDir.isEmpty()) {
43 return; // TODO(edisonn): unfortunatelly this pattern is used in other 44 return; // TODO(edisonn): unfortunatelly this pattern is used in other
44 // tests, but if GetTmpDir() starts returning and empty dir 45 // tests, but if GetTmpDir() starts returning and empty dir
45 // allways, then all these tests will be disabled. 46 // allways, then all these tests will be disabled.
46 } 47 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 REQUIRE_PDF_DOCUMENT(document_skbug_4734, r); 160 REQUIRE_PDF_DOCUMENT(document_skbug_4734, r);
160 SkDynamicMemoryWStream stream; 161 SkDynamicMemoryWStream stream;
161 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&stream)); 162 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&stream));
162 SkCanvas* canvas = doc->beginPage(64, 64); 163 SkCanvas* canvas = doc->beginPage(64, 64);
163 canvas->scale(10000.0f, 10000.0f); 164 canvas->scale(10000.0f, 10000.0f);
164 canvas->translate(20.0f, 10.0f); 165 canvas->translate(20.0f, 10.0f);
165 canvas->rotate(30.0f); 166 canvas->rotate(30.0f);
166 const char text[] = "HELLO"; 167 const char text[] = "HELLO";
167 canvas->drawText(text, strlen(text), 0, 0, SkPaint()); 168 canvas->drawText(text, strlen(text), 0, 0, SkPaint());
168 } 169 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFDocument.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698