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

Side by Side Diff: tests/AnnotationTest.cpp

Issue 2333713002: change SkStreams to work with sk_sp<SkData> instead of SkData* (Closed)
Patch Set: fix xpsdevice Created 4 years, 3 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
« no previous file with comments | « src/xps/SkXPSDevice.cpp ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SkAnnotation.h" 7 #include "SkAnnotation.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkDocument.h" 10 #include "SkDocument.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 sk_sp<SkDocument> doc(SkDocument::MakePDF(&outStream)); 44 sk_sp<SkDocument> doc(SkDocument::MakePDF(&outStream));
45 SkCanvas* canvas = doc->beginPage(612.0f, 792.0f); 45 SkCanvas* canvas = doc->beginPage(612.0f, 792.0f);
46 REPORTER_ASSERT(reporter, canvas); 46 REPORTER_ASSERT(reporter, canvas);
47 47
48 SkRect r = SkRect::MakeXYWH(SkIntToScalar(72), SkIntToScalar(72), 48 SkRect r = SkRect::MakeXYWH(SkIntToScalar(72), SkIntToScalar(72),
49 SkIntToScalar(288), SkIntToScalar(72)); 49 SkIntToScalar(288), SkIntToScalar(72));
50 sk_sp<SkData> data(SkData::MakeWithCString("http://www.gooogle.com")); 50 sk_sp<SkData> data(SkData::MakeWithCString("http://www.gooogle.com"));
51 SkAnnotateRectWithURL(canvas, r, data.get()); 51 SkAnnotateRectWithURL(canvas, r, data.get());
52 52
53 REPORTER_ASSERT(reporter, doc->close()); 53 REPORTER_ASSERT(reporter, doc->close());
54 sk_sp<SkData> out(outStream.copyToData()); 54 sk_sp<SkData> out = outStream.detachAsData();
55 const char* rawOutput = (const char*)out->data(); 55 const char* rawOutput = (const char*)out->data();
56 56
57 REPORTER_ASSERT(reporter, ContainsString(rawOutput, out->size(), "/Annots ") ); 57 REPORTER_ASSERT(reporter, ContainsString(rawOutput, out->size(), "/Annots ") );
58 } 58 }
59 59
60 DEF_TEST(Annotation_NamedDestination, reporter) { 60 DEF_TEST(Annotation_NamedDestination, reporter) {
61 REQUIRE_PDF_DOCUMENT(Annotation_NamedDestination, reporter); 61 REQUIRE_PDF_DOCUMENT(Annotation_NamedDestination, reporter);
62 SkDynamicMemoryWStream outStream; 62 SkDynamicMemoryWStream outStream;
63 sk_sp<SkDocument> doc(SkDocument::MakePDF(&outStream)); 63 sk_sp<SkDocument> doc(SkDocument::MakePDF(&outStream));
64 SkCanvas* canvas = doc->beginPage(612.0f, 792.0f); 64 SkCanvas* canvas = doc->beginPage(612.0f, 792.0f);
65 REPORTER_ASSERT(reporter, canvas); 65 REPORTER_ASSERT(reporter, canvas);
66 66
67 SkPoint p = SkPoint::Make(SkIntToScalar(72), SkIntToScalar(72)); 67 SkPoint p = SkPoint::Make(SkIntToScalar(72), SkIntToScalar(72));
68 sk_sp<SkData> data(SkData::MakeWithCString("example")); 68 sk_sp<SkData> data(SkData::MakeWithCString("example"));
69 SkAnnotateNamedDestination(canvas, p, data.get()); 69 SkAnnotateNamedDestination(canvas, p, data.get());
70 70
71 REPORTER_ASSERT(reporter, doc->close()); 71 REPORTER_ASSERT(reporter, doc->close());
72 sk_sp<SkData> out(outStream.copyToData()); 72 sk_sp<SkData> out = outStream.detachAsData();
73 const char* rawOutput = (const char*)out->data(); 73 const char* rawOutput = (const char*)out->data();
74 74
75 REPORTER_ASSERT(reporter, 75 REPORTER_ASSERT(reporter,
76 ContainsString(rawOutput, out->size(), "/example ")); 76 ContainsString(rawOutput, out->size(), "/example "));
77 } 77 }
OLDNEW
« no previous file with comments | « src/xps/SkXPSDevice.cpp ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698