Index: tests/PDFPrimitivesTest.cpp |
diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp |
index 57b0b60b8726ac05ab12deb1e802785ecf1f6351..f618e6f68bf6077ed8d3cf5d72b7dde14abd821a 100644 |
--- a/tests/PDFPrimitivesTest.cpp |
+++ b/tests/PDFPrimitivesTest.cpp |
@@ -83,7 +83,7 @@ |
char streamBytes[] = "Test\nFoo\tBar"; |
SkAutoTDelete<SkMemoryStream> streamData(new SkMemoryStream( |
streamBytes, strlen(streamBytes), true)); |
- sk_sp<SkPDFStream> stream(new SkPDFStream(streamData.get())); |
+ SkAutoTUnref<SkPDFStream> stream(new SkPDFStream(streamData.get())); |
ASSERT_EMIT_EQ(reporter, |
*stream, |
"<</Length 12>> stream\nTest\nFoo\tBar\nendstream"); |
@@ -100,7 +100,7 @@ |
"with an uncompressed string."; |
SkAutoDataUnref streamData2(SkData::NewWithCopy(streamBytes2, |
strlen(streamBytes2))); |
- sk_sp<SkPDFStream> stream(new SkPDFStream(streamData2.get())); |
+ SkAutoTUnref<SkPDFStream> stream(new SkPDFStream(streamData2.get())); |
SkDynamicMemoryWStream compressedByteStream; |
SkDeflateWStream deflateWStream(&compressedByteStream); |
@@ -123,9 +123,9 @@ |
static void TestObjectNumberMap(skiatest::Reporter* reporter) { |
SkPDFObjNumMap objNumMap; |
- sk_sp<SkPDFArray> a1(new SkPDFArray); |
- sk_sp<SkPDFArray> a2(new SkPDFArray); |
- sk_sp<SkPDFArray> a3(new SkPDFArray); |
+ SkAutoTUnref<SkPDFArray> a1(new SkPDFArray); |
+ SkAutoTUnref<SkPDFArray> a2(new SkPDFArray); |
+ SkAutoTUnref<SkPDFArray> a3(new SkPDFArray); |
objNumMap.addObject(a1.get()); |
objNumMap.addObject(a2.get()); |
@@ -142,9 +142,9 @@ |
} |
static void TestObjectRef(skiatest::Reporter* reporter) { |
- sk_sp<SkPDFArray> a1(new SkPDFArray); |
- sk_sp<SkPDFArray> a2(new SkPDFArray); |
- a2->appendObjRef(a1); |
+ SkAutoTUnref<SkPDFArray> a1(new SkPDFArray); |
+ SkAutoTUnref<SkPDFArray> a2(new SkPDFArray); |
+ a2->appendObjRef(SkRef(a1.get())); |
Catalog catalog; |
catalog.numbers.addObject(a1.get()); |
@@ -157,8 +157,8 @@ |
} |
static void TestSubstitute(skiatest::Reporter* reporter) { |
- sk_sp<SkPDFDict> proxy(new SkPDFDict()); |
- sk_sp<SkPDFDict> stub(new SkPDFDict()); |
+ SkAutoTUnref<SkPDFDict> proxy(new SkPDFDict()); |
+ SkAutoTUnref<SkPDFDict> stub(new SkPDFDict()); |
proxy->insertInt("Value", 33); |
stub->insertInt("Value", 44); |
@@ -168,8 +168,8 @@ |
SkPDFObjNumMap catalog; |
catalog.addObject(proxy.get()); |
- REPORTER_ASSERT(reporter, stub.get() == substituteMap.getSubstitute(proxy.get())); |
- REPORTER_ASSERT(reporter, proxy.get() != substituteMap.getSubstitute(stub.get())); |
+ REPORTER_ASSERT(reporter, stub.get() == substituteMap.getSubstitute(proxy)); |
+ REPORTER_ASSERT(reporter, proxy.get() != substituteMap.getSubstitute(stub)); |
} |
// This test used to assert without the fix submitted for |
@@ -178,7 +178,7 @@ |
// and there is no assert on input data in Debug mode. |
static void test_issue1083() { |
SkDynamicMemoryWStream outStream; |
- sk_sp<SkDocument> doc(SkDocument::CreatePDF(&outStream)); |
+ SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&outStream)); |
SkCanvas* canvas = doc->beginPage(100.0f, 100.0f); |
SkPaint paint; |
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
@@ -238,7 +238,7 @@ |
} |
static void TestPDFArray(skiatest::Reporter* reporter) { |
- sk_sp<SkPDFArray> array(new SkPDFArray); |
+ SkAutoTUnref<SkPDFArray> array(new SkPDFArray); |
ASSERT_EMIT_EQ(reporter, *array, "[]"); |
array->appendInt(42); |
@@ -268,19 +268,19 @@ |
"[42 .5 0 true /ThisName /AnotherName (This String) " |
"(Another String)]"); |
- sk_sp<SkPDFArray> innerArray(new SkPDFArray); |
+ SkAutoTUnref<SkPDFArray> innerArray(new SkPDFArray); |
innerArray->appendInt(-1); |
- array->appendObject(std::move(innerArray)); |
+ array->appendObject(innerArray.detach()); |
ASSERT_EMIT_EQ(reporter, *array, |
"[42 .5 0 true /ThisName /AnotherName (This String) " |
"(Another String) [-1]]"); |
- sk_sp<SkPDFArray> referencedArray(new SkPDFArray); |
+ SkAutoTUnref<SkPDFArray> referencedArray(new SkPDFArray); |
Catalog catalog; |
catalog.numbers.addObject(referencedArray.get()); |
REPORTER_ASSERT(reporter, catalog.numbers.getObjectNumber( |
referencedArray.get()) == 1); |
- array->appendObjRef(std::move(referencedArray)); |
+ array->appendObjRef(referencedArray.detach()); |
SkString result = emit_to_string(*array, &catalog); |
ASSERT_EQ(reporter, result, |
@@ -289,7 +289,7 @@ |
} |
static void TestPDFDict(skiatest::Reporter* reporter) { |
- sk_sp<SkPDFDict> dict(new SkPDFDict); |
+ SkAutoTUnref<SkPDFDict> dict(new SkPDFDict); |
ASSERT_EMIT_EQ(reporter, *dict, "<<>>"); |
dict->insertInt("n1", SkToSizeT(42)); |
@@ -304,9 +304,9 @@ |
dict->insertScalar("n2", SK_ScalarHalf); |
SkString n3("n3"); |
- sk_sp<SkPDFArray> innerArray(new SkPDFArray); |
+ SkAutoTUnref<SkPDFArray> innerArray(new SkPDFArray); |
innerArray->appendInt(-100); |
- dict->insertObject(n3, std::move(innerArray)); |
+ dict->insertObject(n3, innerArray.detach()); |
ASSERT_EMIT_EQ(reporter, *dict, "<</n1 42\n/n2 .5\n/n3 [-100]>>"); |
dict.reset(new SkPDFDict); |
@@ -339,12 +339,12 @@ |
dict.reset(new SkPDFDict("DType")); |
ASSERT_EMIT_EQ(reporter, *dict, "<</Type /DType>>"); |
- sk_sp<SkPDFArray> referencedArray(new SkPDFArray); |
+ SkAutoTUnref<SkPDFArray> referencedArray(new SkPDFArray); |
Catalog catalog; |
catalog.numbers.addObject(referencedArray.get()); |
REPORTER_ASSERT(reporter, catalog.numbers.getObjectNumber( |
referencedArray.get()) == 1); |
- dict->insertObjRef("n1", std::move(referencedArray)); |
+ dict->insertObjRef("n1", referencedArray.detach()); |
SkString result = emit_to_string(*dict, &catalog); |
ASSERT_EQ(reporter, result, "<</Type /DType\n/n1 1 0 R>>"); |
} |
@@ -400,10 +400,10 @@ |
// CPU rasterization. |
DEF_TEST(PDFImageFilter, reporter) { |
SkDynamicMemoryWStream stream; |
- sk_sp<SkDocument> doc(SkDocument::CreatePDF(&stream)); |
+ SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&stream)); |
SkCanvas* canvas = doc->beginPage(100.0f, 100.0f); |
- sk_sp<DummyImageFilter> filter(new DummyImageFilter()); |
+ SkAutoTUnref<DummyImageFilter> filter(new DummyImageFilter()); |
// Filter just created; should be unvisited. |
REPORTER_ASSERT(reporter, !filter->visited()); |
@@ -422,15 +422,15 @@ |
SkPDFCanon canon; |
const char resource[] = "fonts/Roboto2-Regular_NoEmbed.ttf"; |
- sk_sp<SkTypeface> noEmbedTypeface(GetResourceAsTypeface(resource)); |
+ SkAutoTUnref<SkTypeface> noEmbedTypeface(GetResourceAsTypeface(resource)); |
if (noEmbedTypeface) { |
REPORTER_ASSERT(reporter, |
- !SkPDFFont::CanEmbedTypeface(noEmbedTypeface.get(), &canon)); |
- } |
- sk_sp<SkTypeface> portableTypeface( |
+ !SkPDFFont::CanEmbedTypeface(noEmbedTypeface, &canon)); |
+ } |
+ SkAutoTUnref<SkTypeface> portableTypeface( |
sk_tool_utils::create_portable_typeface(NULL, SkTypeface::kNormal)); |
REPORTER_ASSERT(reporter, |
- SkPDFFont::CanEmbedTypeface(portableTypeface.get(), &canon)); |
+ SkPDFFont::CanEmbedTypeface(portableTypeface, &canon)); |
} |