| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
| 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 "SkData.h" | 8 #include "SkData.h" |
| 9 #include "SkPDFFont.h" | 9 #include "SkPDFFont.h" |
| 10 #include "SkPDFTypes.h" | 10 #include "SkPDFTypes.h" |
| 11 #include "SkStream.h" | 11 #include "SkStream.h" |
| 12 #include "Test.h" | 12 #include "Test.h" |
| 13 | 13 |
| 14 #if SK_SUPPORT_PDF |
| 15 |
| 14 static bool stream_equals(const SkDynamicMemoryWStream& stream, size_t offset, | 16 static bool stream_equals(const SkDynamicMemoryWStream& stream, size_t offset, |
| 15 const char* buffer, size_t len) { | 17 const char* buffer, size_t len) { |
| 16 SkAutoDataUnref data(stream.copyToData()); | 18 SkAutoDataUnref data(stream.copyToData()); |
| 17 if (offset + len > data->size()) { | 19 if (offset + len > data->size()) { |
| 18 return false; | 20 return false; |
| 19 } | 21 } |
| 20 if (len != strlen(buffer)) { | 22 if (len != strlen(buffer)) { |
| 21 return false; | 23 return false; |
| 22 } | 24 } |
| 23 return memcmp(data->bytes() + offset, buffer, len) == 0; | 25 return memcmp(data->bytes() + offset, buffer, len) == 0; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 <004F> <006C>\n\ | 173 <004F> <006C>\n\ |
| 172 <0051> <006E>\n\ | 174 <0051> <006E>\n\ |
| 173 endbfchar\n\ | 175 endbfchar\n\ |
| 174 1 beginbfrange\n\ | 176 1 beginbfrange\n\ |
| 175 <0056> <0057> <0073>\n\ | 177 <0056> <0057> <0073>\n\ |
| 176 endbfrange\n"; | 178 endbfrange\n"; |
| 177 | 179 |
| 178 REPORTER_ASSERT(reporter, stream_equals(buffer2, 0, expectedResult2, | 180 REPORTER_ASSERT(reporter, stream_equals(buffer2, 0, expectedResult2, |
| 179 buffer2.getOffset())); | 181 buffer2.getOffset())); |
| 180 } | 182 } |
| 183 #endif // SK_SUPPORT_PDF |
| OLD | NEW |