OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |