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

Side by Side Diff: tests/AnnotationTest.cpp

Issue 1916093002: SkDocument/PDF: new API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-04-26 (Tuesday) 15:55:33 EDT Created 4 years, 7 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/SkDocument_XPS_None.cpp ('k') | tests/CanvasTest.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 23 matching lines...) Expand all
34 SkAutoDataUnref data(SkData::NewWithCString("http://www.gooogle.com")); 34 SkAutoDataUnref data(SkData::NewWithCString("http://www.gooogle.com"));
35 35
36 REPORTER_ASSERT(reporter, 0 == *bm.getAddr32(0, 0)); 36 REPORTER_ASSERT(reporter, 0 == *bm.getAddr32(0, 0));
37 SkAnnotateRectWithURL(&canvas, r, data.get()); 37 SkAnnotateRectWithURL(&canvas, r, data.get());
38 REPORTER_ASSERT(reporter, 0 == *bm.getAddr32(0, 0)); 38 REPORTER_ASSERT(reporter, 0 == *bm.getAddr32(0, 0));
39 } 39 }
40 40
41 DEF_TEST(Annotation_PdfLink, reporter) { 41 DEF_TEST(Annotation_PdfLink, reporter) {
42 REQUIRE_PDF_DOCUMENT(Annotation_PdfLink, reporter); 42 REQUIRE_PDF_DOCUMENT(Annotation_PdfLink, reporter);
43 SkDynamicMemoryWStream outStream; 43 SkDynamicMemoryWStream outStream;
44 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&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 SkAutoDataUnref data(SkData::NewWithCString("http://www.gooogle.com")); 50 SkAutoDataUnref data(SkData::NewWithCString("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 SkAutoDataUnref out(outStream.copyToData()); 54 SkAutoDataUnref out(outStream.copyToData());
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 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&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 SkAutoDataUnref data(SkData::NewWithCString("example")); 68 SkAutoDataUnref data(SkData::NewWithCString("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 SkAutoDataUnref out(outStream.copyToData()); 72 SkAutoDataUnref out(outStream.copyToData());
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/SkDocument_XPS_None.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698