| 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkDocument.h" | 10 #include "SkDocument.h" |
| 11 #include "SkOSFile.h" | 11 #include "SkOSFile.h" |
| 12 #include "SkStream.h" | 12 #include "SkStream.h" |
| 13 #if SK_SUPPORT_PDF | |
| 14 | 13 |
| 15 static void test_empty(skiatest::Reporter* reporter) { | 14 static void test_empty(skiatest::Reporter* reporter) { |
| 16 SkDynamicMemoryWStream stream; | 15 SkDynamicMemoryWStream stream; |
| 17 | 16 |
| 18 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&stream)); | 17 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&stream)); |
| 19 | 18 |
| 20 doc->close(); | 19 doc->close(); |
| 21 | 20 |
| 22 REPORTER_ASSERT(reporter, stream.bytesWritten() == 0); | 21 REPORTER_ASSERT(reporter, stream.bytesWritten() == 0); |
| 23 } | 22 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 SkCanvas* canvas = doc->beginPage(100, 100); | 96 SkCanvas* canvas = doc->beginPage(100, 100); |
| 98 canvas->drawColor(SK_ColorRED); | 97 canvas->drawColor(SK_ColorRED); |
| 99 doc->endPage(); | 98 doc->endPage(); |
| 100 | 99 |
| 101 doc->close(); | 100 doc->close(); |
| 102 | 101 |
| 103 REPORTER_ASSERT(reporter, stream.bytesWritten() != 0); | 102 REPORTER_ASSERT(reporter, stream.bytesWritten() != 0); |
| 104 } | 103 } |
| 105 | 104 |
| 106 DEF_TEST(document_tests, reporter) { | 105 DEF_TEST(document_tests, reporter) { |
| 106 REQUIRE_PDF_DOCUMENT(document_tests, reporter); |
| 107 test_empty(reporter); | 107 test_empty(reporter); |
| 108 test_abort(reporter); | 108 test_abort(reporter); |
| 109 test_abortWithFile(reporter); | 109 test_abortWithFile(reporter); |
| 110 test_file(reporter); | 110 test_file(reporter); |
| 111 test_close(reporter); | 111 test_close(reporter); |
| 112 } | 112 } |
| 113 #endif // SK_SUPPORT_PDF | |
| OLD | NEW |