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

Unified Diff: tests/PDFPrimitivesTest.cpp

Issue 1069103003: SkPDF: Refactor SkPDFObject heiararchy. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-04-25 (Saturday) 09:40:48 EDT Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFTypes.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PDFPrimitivesTest.cpp
diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp
index 99bf7ac3afb9e62d31dd8f11ee7d0dd22fb2c240..7f92e43631421a9a33e368df276bf9719d7bd187 100644
--- a/tests/PDFPrimitivesTest.cpp
+++ b/tests/PDFPrimitivesTest.cpp
@@ -69,8 +69,12 @@ static void CheckObjectOutput(skiatest::Reporter* reporter, SkPDFObject* obj,
SkDynamicMemoryWStream buffer;
emit_object(obj, &buffer, catalog, substituteMap, false);
REPORTER_ASSERT(reporter, directSize == buffer.getOffset());
- REPORTER_ASSERT(reporter, stream_equals(buffer, 0, expectedData,
- directSize));
+ if (!stream_equals(buffer, 0, expectedData, directSize)) {
+ SkAutoTDelete<SkStreamAsset> asset(buffer.detachAsStream());
+ SkString s(asset->getLength());
+ asset->read(s.writable_str(), s.size());
+ ERRORF(reporter, "!stream_equals() '%s' '%s'", expectedData, s.c_str());
+ }
if (indirect) {
// Indirect output.
@@ -272,13 +276,11 @@ DEF_TEST(PDFPrimitives, reporter) {
SkAutoTUnref<SkPDFDict> dict(new SkPDFDict);
SimpleCheckObjectOutput(reporter, dict.get(), "<<>>");
- SkAutoTUnref<SkPDFName> n1(new SkPDFName("n1"));
- dict->insert(n1.get(), int42.get());
+ dict->insert("n1", int42.get());
SimpleCheckObjectOutput(reporter, dict.get(), "<</n1 42>>");
- SkAutoTUnref<SkPDFName> n2(new SkPDFName("n2"));
- SkAutoTUnref<SkPDFName> n3(new SkPDFName("n3"));
- dict->insert(n2.get(), realHalf.get());
- dict->insert(n3.get(), array.get());
+ SkString n3("n3");
+ dict->insert("n2", realHalf.get());
+ dict->insertObject(n3, array.detach());
SimpleCheckObjectOutput(reporter, dict.get(),
"<</n1 42\n/n2 0.5\n/n3 [42 0.5 0]>>");
« no previous file with comments | « src/pdf/SkPDFTypes.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698