blob: 6e7d61676decc081b140b90bbe21356984756ed7 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
vandebo@chromium.orgf66025d2010-10-01 23:26:55 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2010 The Android Open Source Project
vandebo@chromium.orgf66025d2010-10-01 23:26:55 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
vandebo@chromium.orgf66025d2010-10-01 23:26:55 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +000010#include "Test.h"
vandebo@chromium.org4e1cc6a2013-01-25 19:27:23 +000011#include "SkCanvas.h"
reed@google.com8a85d0c2011-06-24 19:12:12 +000012#include "SkData.h"
vandebo@chromium.org421d6442011-07-20 17:39:01 +000013#include "SkFlate.h"
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +000014#include "SkPDFCatalog.h"
vandebo@chromium.org4e1cc6a2013-01-25 19:27:23 +000015#include "SkPDFDevice.h"
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +000016#include "SkPDFStream.h"
17#include "SkPDFTypes.h"
18#include "SkScalar.h"
19#include "SkStream.h"
vandebo@chromium.org421d6442011-07-20 17:39:01 +000020#include "SkTypes.h"
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +000021
vandebo@chromium.org2ef12d42011-07-06 23:31:24 +000022class SkPDFTestDict : public SkPDFDict {
23public:
24 void getResources(SkTDArray<SkPDFObject*>* resourceList) {
25 resourceList->setReserve(resourceList->count() + fResources.count());
26 for (int i = 0; i < fResources.count(); i++) {
27 resourceList->push(fResources[i]);
28 fResources[i]->ref();
29 }
30 }
31
32 void addResource(SkPDFObject* object) {
33 fResources.append(1, &object);
34 }
35
36private:
37 SkTDArray<SkPDFObject*> fResources;
38};
39
reed@google.com8a85d0c2011-06-24 19:12:12 +000040static bool stream_equals(const SkDynamicMemoryWStream& stream, size_t offset,
41 const void* buffer, size_t len) {
42 SkAutoDataUnref data(stream.copyToData());
robertphillips@google.com59f46b82012-07-10 17:30:58 +000043 if (offset + len > data->size()) {
reed@google.com8a85d0c2011-06-24 19:12:12 +000044 return false;
45 }
robertphillips@google.com59f46b82012-07-10 17:30:58 +000046 return memcmp(data->bytes() + offset, buffer, len) == 0;
reed@google.com8a85d0c2011-06-24 19:12:12 +000047}
48
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +000049static void CheckObjectOutput(skiatest::Reporter* reporter, SkPDFObject* obj,
vandebo@chromium.org421d6442011-07-20 17:39:01 +000050 const char* expectedData, size_t expectedSize,
51 bool indirect, bool compression) {
52 SkPDFDocument::Flags docFlags = (SkPDFDocument::Flags) 0;
53 if (!compression) {
vandebo@chromium.org238be8c2012-07-13 20:06:02 +000054 docFlags = SkTBitOr(docFlags, SkPDFDocument::kNoCompression_Flags);
vandebo@chromium.org421d6442011-07-20 17:39:01 +000055 }
56 SkPDFCatalog catalog(docFlags);
vandebo@chromium.org2ef12d42011-07-06 23:31:24 +000057 size_t directSize = obj->getOutputSize(&catalog, false);
vandebo@chromium.org421d6442011-07-20 17:39:01 +000058 REPORTER_ASSERT(reporter, directSize == expectedSize);
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +000059
60 SkDynamicMemoryWStream buffer;
vandebo@chromium.org2ef12d42011-07-06 23:31:24 +000061 obj->emit(&buffer, &catalog, false);
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +000062 REPORTER_ASSERT(reporter, directSize == buffer.getOffset());
vandebo@chromium.org421d6442011-07-20 17:39:01 +000063 REPORTER_ASSERT(reporter, stream_equals(buffer, 0, expectedData,
reed@google.com8a85d0c2011-06-24 19:12:12 +000064 directSize));
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +000065
66 if (indirect) {
67 // Indirect output.
68 static char header[] = "1 0 obj\n";
69 static size_t headerLen = strlen(header);
70 static char footer[] = "\nendobj\n";
71 static size_t footerLen = strlen(footer);
72
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +000073 catalog.addObject(obj, false);
74
75 size_t indirectSize = obj->getOutputSize(&catalog, true);
76 REPORTER_ASSERT(reporter,
77 indirectSize == directSize + headerLen + footerLen);
78
79 buffer.reset();
vandebo@chromium.org2ef12d42011-07-06 23:31:24 +000080 obj->emit(&buffer, &catalog, true);
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +000081 REPORTER_ASSERT(reporter, indirectSize == buffer.getOffset());
reed@google.com8a85d0c2011-06-24 19:12:12 +000082 REPORTER_ASSERT(reporter, stream_equals(buffer, 0, header, headerLen));
vandebo@chromium.org421d6442011-07-20 17:39:01 +000083 REPORTER_ASSERT(reporter, stream_equals(buffer, headerLen, expectedData,
reed@google.com8a85d0c2011-06-24 19:12:12 +000084 directSize));
85 REPORTER_ASSERT(reporter, stream_equals(buffer, headerLen + directSize,
86 footer, footerLen));
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +000087 }
88}
89
vandebo@chromium.org421d6442011-07-20 17:39:01 +000090static void SimpleCheckObjectOutput(skiatest::Reporter* reporter,
91 SkPDFObject* obj,
robertphillips@google.com4debcac2012-05-14 16:33:36 +000092 const char* expectedResult) {
93 CheckObjectOutput(reporter, obj, expectedResult,
94 strlen(expectedResult), true, false);
vandebo@chromium.org421d6442011-07-20 17:39:01 +000095}
96
97static void TestPDFStream(skiatest::Reporter* reporter) {
98 char streamBytes[] = "Test\nFoo\tBar";
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +000099 SkAutoTUnref<SkMemoryStream> streamData(new SkMemoryStream(
100 streamBytes, strlen(streamBytes), true));
101 SkAutoTUnref<SkPDFStream> stream(new SkPDFStream(streamData.get()));
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000102 SimpleCheckObjectOutput(
103 reporter, stream.get(),
104 "<</Length 12\n>> stream\nTest\nFoo\tBar\nendstream");
105 stream->insert("Attribute", new SkPDFInt(42))->unref();
106 SimpleCheckObjectOutput(reporter, stream.get(),
107 "<</Length 12\n/Attribute 42\n>> stream\n"
108 "Test\nFoo\tBar\nendstream");
109
110 if (SkFlate::HaveFlate()) {
111 char streamBytes2[] = "This is a longer string, so that compression "
112 "can do something with it. With shorter strings, "
113 "the short circuit logic cuts in and we end up "
114 "with an uncompressed string.";
115 SkAutoDataUnref streamData2(SkData::NewWithCopy(streamBytes2,
116 strlen(streamBytes2)));
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000117 SkAutoTUnref<SkPDFStream> stream(new SkPDFStream(streamData2.get()));
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000118
119 SkDynamicMemoryWStream compressedByteStream;
120 SkFlate::Deflate(streamData2.get(), &compressedByteStream);
121 SkAutoDataUnref compressedData(compressedByteStream.copyToData());
122
123 // Check first without compression.
124 SkDynamicMemoryWStream expectedResult1;
125 expectedResult1.writeText("<</Length 167\n>> stream\n");
126 expectedResult1.writeText(streamBytes2);
127 expectedResult1.writeText("\nendstream");
128 SkAutoDataUnref expectedResultData1(expectedResult1.copyToData());
129 CheckObjectOutput(reporter, stream.get(),
robertphillips@google.com59f46b82012-07-10 17:30:58 +0000130 (const char*) expectedResultData1->data(),
131 expectedResultData1->size(), true, false);
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000132
133 // Then again with compression.
134 SkDynamicMemoryWStream expectedResult2;
135 expectedResult2.writeText("<</Filter /FlateDecode\n/Length 116\n"
136 ">> stream\n");
robertphillips@google.com59f46b82012-07-10 17:30:58 +0000137 expectedResult2.write(compressedData->data(), compressedData->size());
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000138 expectedResult2.writeText("\nendstream");
139 SkAutoDataUnref expectedResultData2(expectedResult2.copyToData());
140 CheckObjectOutput(reporter, stream.get(),
robertphillips@google.com59f46b82012-07-10 17:30:58 +0000141 (const char*) expectedResultData2->data(),
142 expectedResultData2->size(), true, true);
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000143 }
144}
145
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000146static void TestCatalog(skiatest::Reporter* reporter) {
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000147 SkPDFCatalog catalog((SkPDFDocument::Flags)0);
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000148 SkAutoTUnref<SkPDFInt> int1(new SkPDFInt(1));
149 SkAutoTUnref<SkPDFInt> int2(new SkPDFInt(2));
150 SkAutoTUnref<SkPDFInt> int3(new SkPDFInt(3));
151 int1.get()->ref();
152 SkAutoTUnref<SkPDFInt> int1Again(int1.get());
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000153
154 catalog.addObject(int1.get(), false);
155 catalog.addObject(int2.get(), false);
156 catalog.addObject(int3.get(), false);
157
158 REPORTER_ASSERT(reporter, catalog.getObjectNumberSize(int1.get()) == 3);
159 REPORTER_ASSERT(reporter, catalog.getObjectNumberSize(int2.get()) == 3);
160 REPORTER_ASSERT(reporter, catalog.getObjectNumberSize(int3.get()) == 3);
161
162 SkDynamicMemoryWStream buffer;
163 catalog.emitObjectNumber(&buffer, int1.get());
164 catalog.emitObjectNumber(&buffer, int2.get());
165 catalog.emitObjectNumber(&buffer, int3.get());
166 catalog.emitObjectNumber(&buffer, int1Again.get());
167 char expectedResult[] = "1 02 03 01 0";
reed@google.com8a85d0c2011-06-24 19:12:12 +0000168 REPORTER_ASSERT(reporter, stream_equals(buffer, 0, expectedResult,
169 strlen(expectedResult)));
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000170}
171
172static void TestObjectRef(skiatest::Reporter* reporter) {
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000173 SkAutoTUnref<SkPDFInt> int1(new SkPDFInt(1));
174 SkAutoTUnref<SkPDFInt> int2(new SkPDFInt(2));
175 SkAutoTUnref<SkPDFObjRef> int2ref(new SkPDFObjRef(int2.get()));
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000176
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000177 SkPDFCatalog catalog((SkPDFDocument::Flags)0);
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000178 catalog.addObject(int1.get(), false);
179 catalog.addObject(int2.get(), false);
180 REPORTER_ASSERT(reporter, catalog.getObjectNumberSize(int1.get()) == 3);
181 REPORTER_ASSERT(reporter, catalog.getObjectNumberSize(int2.get()) == 3);
182
183 char expectedResult[] = "2 0 R";
184 SkDynamicMemoryWStream buffer;
185 int2ref->emitObject(&buffer, &catalog, false);
186 REPORTER_ASSERT(reporter, buffer.getOffset() == strlen(expectedResult));
reed@google.com8a85d0c2011-06-24 19:12:12 +0000187 REPORTER_ASSERT(reporter, stream_equals(buffer, 0, expectedResult,
188 buffer.getOffset()));
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000189}
190
vandebo@chromium.org2ef12d42011-07-06 23:31:24 +0000191static void TestSubstitute(skiatest::Reporter* reporter) {
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000192 SkAutoTUnref<SkPDFTestDict> proxy(new SkPDFTestDict());
193 SkAutoTUnref<SkPDFTestDict> stub(new SkPDFTestDict());
194 SkAutoTUnref<SkPDFInt> int33(new SkPDFInt(33));
195 SkAutoTUnref<SkPDFDict> stubResource(new SkPDFDict());
196 SkAutoTUnref<SkPDFInt> int44(new SkPDFInt(44));
vandebo@chromium.org2ef12d42011-07-06 23:31:24 +0000197
198 stub->insert("Value", int33.get());
199 stubResource->insert("InnerValue", int44.get());
200 stub->addResource(stubResource.get());
201
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000202 SkPDFCatalog catalog((SkPDFDocument::Flags)0);
vandebo@chromium.org2ef12d42011-07-06 23:31:24 +0000203 catalog.addObject(proxy.get(), false);
204 catalog.setSubstitute(proxy.get(), stub.get());
205
206 SkDynamicMemoryWStream buffer;
207 proxy->emit(&buffer, &catalog, false);
208 catalog.emitSubstituteResources(&buffer, false);
209
vandebo@chromium.orgd3a094c2011-07-25 22:22:25 +0000210 char objectResult[] = "2 0 obj\n<</Value 33\n>>\nendobj\n";
211 REPORTER_ASSERT(
212 reporter,
213 catalog.setFileOffset(proxy.get(), 0) == strlen(objectResult));
214
vandebo@chromium.org2ef12d42011-07-06 23:31:24 +0000215 char expectedResult[] =
216 "<</Value 33\n>>1 0 obj\n<</InnerValue 44\n>>\nendobj\n";
217 REPORTER_ASSERT(reporter, buffer.getOffset() == strlen(expectedResult));
218 REPORTER_ASSERT(reporter, stream_equals(buffer, 0, expectedResult,
219 buffer.getOffset()));
220}
221
vandebo@chromium.org4e1cc6a2013-01-25 19:27:23 +0000222// This test used to assert without the fix submitted for
223// http://code.google.com/p/skia/issues/detail?id=1083.
224// SKP files might have invalid glyph ids. This test ensures they are ignored,
225// and there is no assert on input data in Debug mode.
226static void test_issue1083(skiatest::Reporter* reporter) {
227 SkISize pageSize = SkISize::Make(100, 100);
228 SkPDFDevice* dev = new SkPDFDevice(pageSize, pageSize, SkMatrix::I());
229
230 SkCanvas c(dev);
231 SkPaint paint;
232 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
233
234 uint16_t glyphID = 65000;
235 c.drawText(&glyphID, 2, 0, 0, paint);
236
237 SkPDFDocument doc;
238 doc.appendPage(dev);
239
240 SkDynamicMemoryWStream stream;
241 doc.emitPDF(&stream);
242}
243
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000244static void TestPDFPrimitives(skiatest::Reporter* reporter) {
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000245 SkAutoTUnref<SkPDFInt> int42(new SkPDFInt(42));
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000246 SimpleCheckObjectOutput(reporter, int42.get(), "42");
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000247
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000248 SkAutoTUnref<SkPDFScalar> realHalf(new SkPDFScalar(SK_ScalarHalf));
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000249 SimpleCheckObjectOutput(reporter, realHalf.get(), "0.5");
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000250
vandebo@chromium.org6cc26da2011-05-18 17:08:05 +0000251#if defined(SK_SCALAR_IS_FLOAT)
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000252 SkAutoTUnref<SkPDFScalar> bigScalar(new SkPDFScalar(110999.75f));
vandebo@chromium.org6cc26da2011-05-18 17:08:05 +0000253#if !defined(SK_ALLOW_LARGE_PDF_SCALARS)
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000254 SimpleCheckObjectOutput(reporter, bigScalar.get(), "111000");
vandebo@chromium.org094316b2011-03-04 03:15:13 +0000255#else
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000256 SimpleCheckObjectOutput(reporter, bigScalar.get(), "110999.75");
vandebo@chromium.org094316b2011-03-04 03:15:13 +0000257
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000258 SkAutoTUnref<SkPDFScalar> biggerScalar(new SkPDFScalar(50000000.1));
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000259 SimpleCheckObjectOutput(reporter, biggerScalar.get(), "50000000");
vandebo@chromium.org094316b2011-03-04 03:15:13 +0000260
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000261 SkAutoTUnref<SkPDFScalar> smallestScalar(new SkPDFScalar(1.0/65536));
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000262 SimpleCheckObjectOutput(reporter, smallestScalar.get(), "0.00001526");
vandebo@chromium.org094316b2011-03-04 03:15:13 +0000263#endif
vandebo@chromium.org6cc26da2011-05-18 17:08:05 +0000264#endif
vandebo@chromium.org094316b2011-03-04 03:15:13 +0000265
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000266 SkAutoTUnref<SkPDFString> stringSimple(
267 new SkPDFString("test ) string ( foo"));
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000268 SimpleCheckObjectOutput(reporter, stringSimple.get(),
269 "(test \\) string \\( foo)");
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000270 SkAutoTUnref<SkPDFString> stringComplex(
271 new SkPDFString("\ttest ) string ( foo"));
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000272 SimpleCheckObjectOutput(reporter, stringComplex.get(),
273 "<0974657374202920737472696E67202820666F6F>");
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000274
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000275 SkAutoTUnref<SkPDFName> name(new SkPDFName("Test name\twith#tab"));
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000276 const char expectedResult[] = "/Test#20name#09with#23tab";
277 CheckObjectOutput(reporter, name.get(), expectedResult,
278 strlen(expectedResult), false, false);
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000279
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000280 SkAutoTUnref<SkPDFName> escapedName(new SkPDFName("A#/%()<>[]{}B"));
vandebo@chromium.org251a7662012-09-21 17:50:50 +0000281 const char escapedNameExpected[] = "/A#23#2F#25#28#29#3C#3E#5B#5D#7B#7DB";
282 CheckObjectOutput(reporter, escapedName.get(), escapedNameExpected,
283 strlen(escapedNameExpected), false, false);
284
vandebo@chromium.orgc0376fe2012-03-05 18:44:33 +0000285 // Test that we correctly handle characters with the high-bit set.
bungeman@google.comf8aa18c2012-03-19 21:04:52 +0000286 const unsigned char highBitCString[] = {0xDE, 0xAD, 'b', 'e', 0xEF, 0};
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000287 SkAutoTUnref<SkPDFName> highBitName(
288 new SkPDFName((const char*)highBitCString));
vandebo@chromium.orgc0376fe2012-03-05 18:44:33 +0000289 const char highBitExpectedResult[] = "/#DE#ADbe#EF";
290 CheckObjectOutput(reporter, highBitName.get(), highBitExpectedResult,
291 strlen(highBitExpectedResult), false, false);
292
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000293 SkAutoTUnref<SkPDFArray> array(new SkPDFArray);
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000294 SimpleCheckObjectOutput(reporter, array.get(), "[]");
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000295 array->append(int42.get());
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000296 SimpleCheckObjectOutput(reporter, array.get(), "[42]");
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000297 array->append(realHalf.get());
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000298 SimpleCheckObjectOutput(reporter, array.get(), "[42 0.5]");
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000299 SkAutoTUnref<SkPDFInt> int0(new SkPDFInt(0));
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000300 array->append(int0.get());
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000301 SimpleCheckObjectOutput(reporter, array.get(), "[42 0.5 0]");
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000302 SkAutoTUnref<SkPDFInt> int1(new SkPDFInt(1));
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000303 array->setAt(0, int1.get());
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000304 SimpleCheckObjectOutput(reporter, array.get(), "[1 0.5 0]");
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000305
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000306 SkAutoTUnref<SkPDFDict> dict(new SkPDFDict);
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000307 SimpleCheckObjectOutput(reporter, dict.get(), "<<>>");
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000308 SkAutoTUnref<SkPDFName> n1(new SkPDFName("n1"));
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000309 dict->insert(n1.get(), int42.get());
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000310 SimpleCheckObjectOutput(reporter, dict.get(), "<</n1 42\n>>");
vandebo@chromium.orgd96d17b2013-01-04 19:31:24 +0000311 SkAutoTUnref<SkPDFName> n2(new SkPDFName("n2"));
312 SkAutoTUnref<SkPDFName> n3(new SkPDFName("n3"));
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000313 dict->insert(n2.get(), realHalf.get());
314 dict->insert(n3.get(), array.get());
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000315 SimpleCheckObjectOutput(reporter, dict.get(),
316 "<</n1 42\n/n2 0.5\n/n3 [1 0.5 0]\n>>");
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000317
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000318 TestPDFStream(reporter);
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000319
320 TestCatalog(reporter);
321
322 TestObjectRef(reporter);
vandebo@chromium.org2ef12d42011-07-06 23:31:24 +0000323
324 TestSubstitute(reporter);
vandebo@chromium.org4e1cc6a2013-01-25 19:27:23 +0000325
326 test_issue1083(reporter);
vandebo@chromium.org8459d4e2010-09-24 22:25:30 +0000327}
328
329#include "TestClassDef.h"
330DEFINE_TESTCLASS("PDFPrimitives", PDFPrimitivesTestClass, TestPDFPrimitives)