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

Side by Side Diff: tests/AnnotationTest.cpp

Issue 1279123007: SkPDF: allow PDF module to be disabled in DM and SampleApp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-11 (Tuesday) 10:04:57 EDT : #if SK_SUPPORT_PDF Created 5 years, 4 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
OLDNEW
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 "SkAnnotation.h" 8 #include "SkAnnotation.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkData.h" 10 #include "SkData.h"
11 #include "SkDocument.h" 11 #include "SkDocument.h"
12 #include "SkStream.h" 12 #include "SkStream.h"
13 #include "Test.h" 13 #include "Test.h"
14 14
15 #if SK_SUPPORT_PDF
16
15 /** Returns true if data (may contain null characters) contains needle (null 17 /** Returns true if data (may contain null characters) contains needle (null
16 * terminated). */ 18 * terminated). */
17 static bool ContainsString(const char* data, size_t dataSize, const char* needle ) { 19 static bool ContainsString(const char* data, size_t dataSize, const char* needle ) {
18 size_t nSize = strlen(needle); 20 size_t nSize = strlen(needle);
19 for (size_t i = 0; i < dataSize - nSize; i++) { 21 for (size_t i = 0; i < dataSize - nSize; i++) {
20 if (strncmp(&data[i], needle, nSize) == 0) { 22 if (strncmp(&data[i], needle, nSize) == 0) {
21 return true; 23 return true;
22 } 24 }
23 } 25 }
24 return false; 26 return false;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 SkAutoDataUnref data(SkData::NewWithCString("example")); 69 SkAutoDataUnref data(SkData::NewWithCString("example"));
68 SkAnnotateNamedDestination(canvas, p, data.get()); 70 SkAnnotateNamedDestination(canvas, p, data.get());
69 71
70 REPORTER_ASSERT(reporter, doc->close()); 72 REPORTER_ASSERT(reporter, doc->close());
71 SkAutoDataUnref out(outStream.copyToData()); 73 SkAutoDataUnref out(outStream.copyToData());
72 const char* rawOutput = (const char*)out->data(); 74 const char* rawOutput = (const char*)out->data();
73 75
74 REPORTER_ASSERT(reporter, 76 REPORTER_ASSERT(reporter,
75 ContainsString(rawOutput, out->size(), "/example ")); 77 ContainsString(rawOutput, out->size(), "/example "));
76 } 78 }
79 #endif // SK_SUPPORT_PDF
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698