mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 19:08:59 +00:00
Add testing for new array mutators
This commit is contained in:
parent
db7474e0fa
commit
91d175452d
@ -14,9 +14,12 @@ endobj
|
|||||||
2 0 obj
|
2 0 obj
|
||||||
<<
|
<<
|
||||||
/A [
|
/A [
|
||||||
|
9
|
||||||
1
|
1
|
||||||
5
|
5
|
||||||
3
|
10
|
||||||
|
12
|
||||||
|
6
|
||||||
]
|
]
|
||||||
/Author (Mr. Potato Head)
|
/Author (Mr. Potato Head)
|
||||||
/B <<
|
/B <<
|
||||||
@ -134,15 +137,15 @@ xref
|
|||||||
0000000000 65535 f
|
0000000000 65535 f
|
||||||
0000000052 00000 n
|
0000000052 00000 n
|
||||||
0000000134 00000 n
|
0000000134 00000 n
|
||||||
0000000333 00000 n
|
0000000353 00000 n
|
||||||
0000000455 00000 n
|
0000000475 00000 n
|
||||||
0000000555 00000 n
|
0000000575 00000 n
|
||||||
0000000615 00000 n
|
0000000635 00000 n
|
||||||
0000000694 00000 n
|
0000000714 00000 n
|
||||||
0000000938 00000 n
|
0000000958 00000 n
|
||||||
0000001037 00000 n
|
0000001057 00000 n
|
||||||
0000001083 00000 n
|
0000001103 00000 n
|
||||||
0000001229 00000 n
|
0000001249 00000 n
|
||||||
trailer <<
|
trailer <<
|
||||||
/Info 2 0 R
|
/Info 2 0 R
|
||||||
/QTest 3 0 R
|
/QTest 3 0 R
|
||||||
@ -151,5 +154,5 @@ trailer <<
|
|||||||
/ID [<c61bd35bada064f61e0a56aa9588064e><31415926535897932384626433832795>]
|
/ID [<c61bd35bada064f61e0a56aa9588064e><31415926535897932384626433832795>]
|
||||||
>>
|
>>
|
||||||
startxref
|
startxref
|
||||||
1265
|
1285
|
||||||
%%EOF
|
%%EOF
|
||||||
|
@ -30,7 +30,7 @@ endobj
|
|||||||
|
|
||||||
4 0 obj
|
4 0 obj
|
||||||
[
|
[
|
||||||
1
|
100
|
||||||
2
|
2
|
||||||
3
|
3
|
||||||
]
|
]
|
||||||
@ -106,12 +106,12 @@ xref
|
|||||||
0000000079 00000 n
|
0000000079 00000 n
|
||||||
0000000174 00000 n
|
0000000174 00000 n
|
||||||
0000000246 00000 n
|
0000000246 00000 n
|
||||||
0000000278 00000 n
|
0000000280 00000 n
|
||||||
0000000330 00000 n
|
0000000332 00000 n
|
||||||
0000000546 00000 n
|
0000000548 00000 n
|
||||||
0000000645 00000 n
|
0000000647 00000 n
|
||||||
0000000664 00000 n
|
0000000666 00000 n
|
||||||
0000000782 00000 n
|
0000000784 00000 n
|
||||||
trailer <<
|
trailer <<
|
||||||
/QTest 2 0 R
|
/QTest 2 0 R
|
||||||
/Root 1 0 R
|
/Root 1 0 R
|
||||||
@ -119,5 +119,5 @@ trailer <<
|
|||||||
/ID [<c61bd35bada064f61e0a56aa9588064e><c893e7330be149468080ad6518819868>]
|
/ID [<c61bd35bada064f61e0a56aa9588064e><c893e7330be149468080ad6518819868>]
|
||||||
>>
|
>>
|
||||||
startxref
|
startxref
|
||||||
818
|
820
|
||||||
%%EOF
|
%%EOF
|
||||||
|
@ -14,14 +14,14 @@ endobj
|
|||||||
2 0 obj
|
2 0 obj
|
||||||
<<
|
<<
|
||||||
/A [
|
/A [
|
||||||
1
|
14
|
||||||
5
|
15
|
||||||
3
|
9
|
||||||
]
|
]
|
||||||
/Author (Mr. Potato Head)
|
/Author (Mr. Potato Head)
|
||||||
/B <<
|
/B <<
|
||||||
/A [
|
/A [
|
||||||
1
|
100
|
||||||
2
|
2
|
||||||
3
|
3
|
||||||
]
|
]
|
||||||
@ -55,7 +55,7 @@ endobj
|
|||||||
%% Original object ID: 4 0
|
%% Original object ID: 4 0
|
||||||
5 0 obj
|
5 0 obj
|
||||||
[
|
[
|
||||||
1
|
100
|
||||||
2
|
2
|
||||||
3
|
3
|
||||||
]
|
]
|
||||||
@ -134,15 +134,15 @@ xref
|
|||||||
0000000000 65535 f
|
0000000000 65535 f
|
||||||
0000000052 00000 n
|
0000000052 00000 n
|
||||||
0000000134 00000 n
|
0000000134 00000 n
|
||||||
0000000333 00000 n
|
0000000337 00000 n
|
||||||
0000000455 00000 n
|
0000000459 00000 n
|
||||||
0000000554 00000 n
|
0000000558 00000 n
|
||||||
0000000613 00000 n
|
0000000619 00000 n
|
||||||
0000000692 00000 n
|
0000000698 00000 n
|
||||||
0000000936 00000 n
|
0000000942 00000 n
|
||||||
0000001035 00000 n
|
0000001041 00000 n
|
||||||
0000001081 00000 n
|
0000001087 00000 n
|
||||||
0000001228 00000 n
|
0000001234 00000 n
|
||||||
trailer <<
|
trailer <<
|
||||||
/Info 2 0 R
|
/Info 2 0 R
|
||||||
/QTest 3 0 R
|
/QTest 3 0 R
|
||||||
@ -151,5 +151,5 @@ trailer <<
|
|||||||
/ID [<c61bd35bada064f61e0a56aa9588064e><31415926535897932384626433832795>]
|
/ID [<c61bd35bada064f61e0a56aa9588064e><31415926535897932384626433832795>]
|
||||||
>>
|
>>
|
||||||
startxref
|
startxref
|
||||||
1264
|
1270
|
||||||
%%EOF
|
%%EOF
|
||||||
|
@ -284,8 +284,28 @@ void runtest(int n, char const* filename)
|
|||||||
QPDFObjectHandle::newString("Mr. Potato Head"));
|
QPDFObjectHandle::newString("Mr. Potato Head"));
|
||||||
// qtest.A and qtest.B.A were originally the same object.
|
// qtest.A and qtest.B.A were originally the same object.
|
||||||
// They no longer are after makeDirect(). Mutate one of them
|
// They no longer are after makeDirect(). Mutate one of them
|
||||||
// and ensure the other is not changed.
|
// and ensure the other is not changed. These test cases are
|
||||||
qtest.getKey("/A").setArrayItem(1, QPDFObjectHandle::newInteger(5));
|
// crafted around a specific set of input files.
|
||||||
|
QPDFObjectHandle A = qtest.getKey("/A");
|
||||||
|
if (A.getArrayItem(0).getIntValue() == 1)
|
||||||
|
{
|
||||||
|
// Test mutators
|
||||||
|
A.setArrayItem(1, QPDFObjectHandle::newInteger(5)); // 1 5 3
|
||||||
|
A.insertItem(2, QPDFObjectHandle::newInteger(10)); // 1 5 10 3
|
||||||
|
A.appendItem(QPDFObjectHandle::newInteger(12)); // 1 5 10 3 12
|
||||||
|
A.eraseItem(3); // 1 5 10 12
|
||||||
|
A.insertItem(4, QPDFObjectHandle::newInteger(6)); // 1 5 10 12 6
|
||||||
|
A.insertItem(0, QPDFObjectHandle::newInteger(9)); // 9 1 5 10 12 6
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::vector<QPDFObjectHandle> items;
|
||||||
|
items.push_back(QPDFObjectHandle::newInteger(14));
|
||||||
|
items.push_back(QPDFObjectHandle::newInteger(15));
|
||||||
|
items.push_back(QPDFObjectHandle::newInteger(9));
|
||||||
|
A.setArrayFromVector(items);
|
||||||
|
}
|
||||||
|
|
||||||
trailer.replaceKey("/Info", pdf.makeIndirectObject(qtest));
|
trailer.replaceKey("/Info", pdf.makeIndirectObject(qtest));
|
||||||
QPDFWriter w(pdf, 0);
|
QPDFWriter w(pdf, 0);
|
||||||
w.setQDFMode(true);
|
w.setQDFMode(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user