aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-04-25 06:45:07 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-25 06:45:07 -0700
commit130444fdaf737c5931a934018ab50b0c91a3499e (patch)
tree9e853af14d9b8b3e38b344340379b74e1a27e475 /tests
parent8e71d38126df1ed40ee88107e681c8b62f726e30 (diff)
SkPDF: Refactor SkPDFObject heiararchy.
Flatten and use a tagged union type Δmemory ~= -2.4% ± 0.5% Δtime ~= -1.2% ± 0.2% BUG=skia:3585 Review URL: https://codereview.chromium.org/1069103003
Diffstat (limited to 'tests')
-rw-r--r--tests/PDFPrimitivesTest.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp
index 99bf7ac3af..7f92e43631 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]>>");