diff options
author | Jay Berkenbilt <ejb@ql.org> | 2012-07-05 05:19:32 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2012-07-05 05:19:32 +0200 |
commit | c227249ef157f8db4437f8a1993e25d4bc349a4d (patch) | |
tree | 35949e29821dfdcbe50e44fe69e5ed8621f3a4dc /qpdf | |
parent | abb53ac36913fe56c404bf1748a230300c9a5c4a (diff) | |
download | qpdf-c227249ef157f8db4437f8a1993e25d4bc349a4d.tar.zst |
Added test code for Tobias's changes
Diffstat (limited to 'qpdf')
-rw-r--r-- | qpdf/qtest/qpdf.test | 6 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/lin-special.disable.exp | bin | 3198 -> 3178 bytes | |||
-rw-r--r-- | qpdf/qtest/qpdf/lin-special.generate.exp | bin | 2832 -> 2808 bytes | |||
-rw-r--r-- | qpdf/qtest/qpdf/lin-special.pdf | 71 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/lin-special.preserve.exp | bin | 3198 -> 3178 bytes | |||
-rw-r--r-- | qpdf/qtest/qpdf/pages-warning.out | 2 | ||||
-rw-r--r-- | qpdf/test_driver.cc | 6 |
7 files changed, 52 insertions, 33 deletions
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test index fa26597d..9a7f7b99 100644 --- a/qpdf/qtest/qpdf.test +++ b/qpdf/qtest/qpdf.test @@ -149,7 +149,7 @@ $td->runtest("remove page we don't have", $td->NORMALIZE_NEWLINES); # ---------- $td->notify("--- Miscellaneous Tests ---"); -$n_tests += 40; +$n_tests += 41; $td->runtest("qpdf version", {$td->COMMAND => "qpdf --version"}, @@ -354,6 +354,10 @@ $td->runtest("shallow copy a stream", {$td->COMMAND => "test_driver 21 shallow_array.pdf"}, {$td->FILE => "shallow_stream.out", $td->EXIT_STATUS => 2}, $td->NORMALIZE_NEWLINES); +$td->runtest("warn for unknown key in Pages", + {$td->COMMAND => "test_driver 23 lin-special.pdf"}, + {$td->FILE => "pages-warning.out", $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); show_ntests(); # ---------- diff --git a/qpdf/qtest/qpdf/lin-special.disable.exp b/qpdf/qtest/qpdf/lin-special.disable.exp Binary files differindex fbafd01f..852c0083 100644 --- a/qpdf/qtest/qpdf/lin-special.disable.exp +++ b/qpdf/qtest/qpdf/lin-special.disable.exp diff --git a/qpdf/qtest/qpdf/lin-special.generate.exp b/qpdf/qtest/qpdf/lin-special.generate.exp Binary files differindex c810f02e..c07bab2c 100644 --- a/qpdf/qtest/qpdf/lin-special.generate.exp +++ b/qpdf/qtest/qpdf/lin-special.generate.exp diff --git a/qpdf/qtest/qpdf/lin-special.pdf b/qpdf/qtest/qpdf/lin-special.pdf index 6dcff293..804e8ed2 100644 --- a/qpdf/qtest/qpdf/lin-special.pdf +++ b/qpdf/qtest/qpdf/lin-special.pdf @@ -22,13 +22,16 @@ % +---- page 5 % % Node (A) defines /MediaBox (direct) and /Resources (indirect) -% Node (B) overrides /MediaBox +% Node (B) overrides /MediaBox and defines /Rotate +% Node (B) defines /Quack, a non-standard key, which is not inherited % Page 1 overrides /Resources % Page 4 overrides /Resources -% Page 5 overrides /MediaBox +% Page 5 overrides /MediaBox and /Rotate % % Page 5 provides the case of two levels of shadowing on a resource. % +% Node (B)'s overriding of /Rotate exercises inheriting a scalar. +% % The /MediaBox defined in node (B) is shared between pages 3 and 4 % but not page 1. The /MediaBox defined in node (A) is shared between % pages 1 and 2 only. @@ -58,6 +61,7 @@ endobj >> endobj +% Node (A) 3 0 obj << /Count 5 @@ -73,7 +77,6 @@ endobj 792 ] /Resources 7 0 R - /Quack 16059 /Type /Pages >> endobj @@ -97,6 +100,7 @@ endobj >> endobj +% Node (B) 6 0 obj << /Count 3 @@ -112,6 +116,8 @@ endobj 396 ] /Parent 3 0 R + /Rotate 0 + /Quack 16059 /Type /Pages >> endobj @@ -205,6 +211,7 @@ endobj 306 396 ] + /Rotate 180 /Parent 6 0 R /Type /Page >> @@ -316,39 +323,39 @@ endobj xref 0 29 0000000000 65535 f -0000001161 00000 n -0000001244 00000 n -0000001319 00000 n -0000001501 00000 n -0000001601 00000 n -0000001672 00000 n -0000001829 00000 n -0000001923 00000 n -0000002024 00000 n -0000002043 00000 n -0000002138 00000 n -0000002241 00000 n -0000002271 00000 n -0000002366 00000 n -0000002526 00000 n -0000002644 00000 n -0000002763 00000 n -0000002799 00000 n -0000002947 00000 n -0000003050 00000 n -0000003093 00000 n -0000003196 00000 n -0000003216 00000 n -0000003359 00000 n -0000003462 00000 n -0000003482 00000 n -0000003504 00000 n -0000003526 00000 n +0000001331 00000 n +0000001414 00000 n +0000001500 00000 n +0000001667 00000 n +0000001767 00000 n +0000001849 00000 n +0000002033 00000 n +0000002127 00000 n +0000002228 00000 n +0000002247 00000 n +0000002342 00000 n +0000002445 00000 n +0000002475 00000 n +0000002570 00000 n +0000002730 00000 n +0000002862 00000 n +0000002981 00000 n +0000003017 00000 n +0000003165 00000 n +0000003268 00000 n +0000003311 00000 n +0000003414 00000 n +0000003434 00000 n +0000003577 00000 n +0000003680 00000 n +0000003700 00000 n +0000003722 00000 n +0000003744 00000 n trailer << /Root 1 0 R /Size 29 /ID [<ce9551b56c5a7e3b5b0ba6fa0d281296><a74aa55a69070b600e39f9ed1ed6c4df>] >> startxref -3545 +3763 %%EOF diff --git a/qpdf/qtest/qpdf/lin-special.preserve.exp b/qpdf/qtest/qpdf/lin-special.preserve.exp Binary files differindex fbafd01f..852c0083 100644 --- a/qpdf/qtest/qpdf/lin-special.preserve.exp +++ b/qpdf/qtest/qpdf/lin-special.preserve.exp diff --git a/qpdf/qtest/qpdf/pages-warning.out b/qpdf/qtest/qpdf/pages-warning.out new file mode 100644 index 00000000..219390ad --- /dev/null +++ b/qpdf/qtest/qpdf/pages-warning.out @@ -0,0 +1,2 @@ +WARNING: lin-special.pdf (Pages object: object 6 0): Unknown key /Quack in /Pages object is being discarded as a result of flattening the /Pages tree +test 23 done diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc index e9c63d8f..bbf9a414 100644 --- a/qpdf/test_driver.cc +++ b/qpdf/test_driver.cc @@ -832,6 +832,12 @@ void runtest(int n, char const* filename) pdf.removePage(page); std::cout << "you can't see this" << std::endl; } + else if (n == 23) + { + // Try to remove a page we don't have + std::vector<QPDFObjectHandle> const& pages = pdf.getAllPages(); + pdf.removePage(pages.back()); + } else { throw std::runtime_error(std::string("invalid test ") + |