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

Side by Side Diff: tests/PDFPrimitivesTest.cpp

Issue 849103004: Make SkStream *not* ref counted. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase, just in case. Created 5 years, 11 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 | « tests/KtxTest.cpp ('k') | tests/SerializationTest.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 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 static void SimpleCheckObjectOutput(skiatest::Reporter* reporter, 113 static void SimpleCheckObjectOutput(skiatest::Reporter* reporter,
114 SkPDFObject* obj, 114 SkPDFObject* obj,
115 const char* expectedResult) { 115 const char* expectedResult) {
116 CheckObjectOutput(reporter, obj, expectedResult, 116 CheckObjectOutput(reporter, obj, expectedResult,
117 strlen(expectedResult), true, false); 117 strlen(expectedResult), true, false);
118 } 118 }
119 119
120 static void TestPDFStream(skiatest::Reporter* reporter) { 120 static void TestPDFStream(skiatest::Reporter* reporter) {
121 char streamBytes[] = "Test\nFoo\tBar"; 121 char streamBytes[] = "Test\nFoo\tBar";
122 SkAutoTUnref<SkMemoryStream> streamData(new SkMemoryStream( 122 SkAutoTDelete<SkMemoryStream> streamData(new SkMemoryStream(
123 streamBytes, strlen(streamBytes), true)); 123 streamBytes, strlen(streamBytes), true));
124 SkAutoTUnref<SkPDFStream> stream(new SkPDFStream(streamData.get())); 124 SkAutoTUnref<SkPDFStream> stream(new SkPDFStream(streamData.get()));
125 SimpleCheckObjectOutput( 125 SimpleCheckObjectOutput(
126 reporter, stream.get(), 126 reporter, stream.get(),
127 "<</Length 12\n>> stream\nTest\nFoo\tBar\nendstream"); 127 "<</Length 12\n>> stream\nTest\nFoo\tBar\nendstream");
128 stream->insert("Attribute", new SkPDFInt(42))->unref(); 128 stream->insert("Attribute", new SkPDFInt(42))->unref();
129 SimpleCheckObjectOutput(reporter, stream.get(), 129 SimpleCheckObjectOutput(reporter, stream.get(),
130 "<</Length 12\n/Attribute 42\n>> stream\n" 130 "<</Length 12\n/Attribute 42\n>> stream\n"
131 "Test\nFoo\tBar\nendstream"); 131 "Test\nFoo\tBar\nendstream");
132 132
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 482
483 // Filter just created; should be unvisited. 483 // Filter just created; should be unvisited.
484 REPORTER_ASSERT(reporter, !filter->visited()); 484 REPORTER_ASSERT(reporter, !filter->visited());
485 SkPaint paint; 485 SkPaint paint;
486 paint.setImageFilter(filter.get()); 486 paint.setImageFilter(filter.get());
487 canvas.drawRect(SkRect::MakeWH(100, 100), paint); 487 canvas.drawRect(SkRect::MakeWH(100, 100), paint);
488 488
489 // Filter was used in rendering; should be visited. 489 // Filter was used in rendering; should be visited.
490 REPORTER_ASSERT(reporter, filter->visited()); 490 REPORTER_ASSERT(reporter, filter->visited());
491 } 491 }
OLDNEW
« no previous file with comments | « tests/KtxTest.cpp ('k') | tests/SerializationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698