| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "Test.h" | |
| 9 #include "SkAnnotation.h" | 8 #include "SkAnnotation.h" |
| 9 #include "SkCanvas.h" |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| 11 #include "SkCanvas.h" | |
| 12 #include "SkPDFDevice.h" | 11 #include "SkPDFDevice.h" |
| 13 #include "SkPDFDocument.h" | 12 #include "SkPDFDocument.h" |
| 13 #include "Test.h" |
| 14 | 14 |
| 15 /** Returns true if data (may contain null characters) contains needle (null | 15 /** Returns true if data (may contain null characters) contains needle (null |
| 16 * terminated). */ | 16 * terminated). */ |
| 17 static bool ContainsString(const char* data, size_t dataSize, const char* needle
) { | 17 static bool ContainsString(const char* data, size_t dataSize, const char* needle
) { |
| 18 size_t nSize = strlen(needle); | 18 size_t nSize = strlen(needle); |
| 19 for (size_t i = 0; i < dataSize - nSize; i++) { | 19 for (size_t i = 0; i < dataSize - nSize; i++) { |
| 20 if (strncmp(&data[i], needle, nSize) == 0) { | 20 if (strncmp(&data[i], needle, nSize) == 0) { |
| 21 return true; | 21 return true; |
| 22 } | 22 } |
| 23 } | 23 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 SkPDFDocument doc; | 87 SkPDFDocument doc; |
| 88 doc.appendPage(&device); | 88 doc.appendPage(&device); |
| 89 SkDynamicMemoryWStream outStream; | 89 SkDynamicMemoryWStream outStream; |
| 90 doc.emitPDF(&outStream); | 90 doc.emitPDF(&outStream); |
| 91 SkAutoDataUnref out(outStream.copyToData()); | 91 SkAutoDataUnref out(outStream.copyToData()); |
| 92 const char* rawOutput = (const char*)out->data(); | 92 const char* rawOutput = (const char*)out->data(); |
| 93 | 93 |
| 94 REPORTER_ASSERT(reporter, | 94 REPORTER_ASSERT(reporter, |
| 95 ContainsString(rawOutput, out->size(), "/example ")); | 95 ContainsString(rawOutput, out->size(), "/example ")); |
| 96 } | 96 } |
| OLD | NEW |