aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/test_driver.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-01-02 20:05:17 +0100
committerJay Berkenbilt <ejb@ql.org>2021-01-02 20:08:53 +0100
commit3be58f49e57da67cf79b61061d8b1a0f7ccf7cff (patch)
tree2d651afb06b9037d5dc8aab2745ea9e65652885f /qpdf/test_driver.cc
parent98da4fd83527f47a28132ff4a120bc043d9e58f6 (diff)
downloadqpdf-3be58f49e57da67cf79b61061d8b1a0f7ccf7cff.tar.zst
Make more QPDFPageObjectHelper methods work with form XObject
Diffstat (limited to 'qpdf/test_driver.cc')
-rw-r--r--qpdf/test_driver.cc23
1 files changed, 22 insertions, 1 deletions
diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc
index ff55e63f..aef46d87 100644
--- a/qpdf/test_driver.cc
+++ b/qpdf/test_driver.cc
@@ -1463,7 +1463,7 @@ void runtest(int n, char const* filename1, char const* arg2)
{
QPDFPageObjectHelper& page(*iter);
ParserCallbacks cb;
- page.parsePageContents(&cb);
+ page.parseContents(&cb);
}
}
else if (n == 38)
@@ -2279,6 +2279,27 @@ void runtest(int n, char const* filename1, char const* arg2)
std::cout << i.first << " -> " << i.second.unparse() << std::endl;
}
}
+ else if (n == 72)
+ {
+ // Call some QPDFPageObjectHelper methods on form XObjects.
+ auto page = QPDFPageDocumentHelper(pdf).getAllPages().at(0);
+ auto fx1 = QPDFPageObjectHelper(
+ page.getObjectHandle()
+ .getKey("/Resources")
+ .getKey("/XObject")
+ .getKey("/Fx1"));
+ std::cout << "--- parseContents ---" << std::endl;
+ ParserCallbacks cb;
+ fx1.parseContents(&cb);
+ Pl_Buffer b("buffer");
+ fx1.addContentTokenFilter(new TokenFilter);
+ fx1.pipeContents(&b);
+ std::unique_ptr<Buffer> buf(b.getBuffer());
+ std::string s(
+ reinterpret_cast<char const*>(buf->getBuffer()),
+ buf->getSize());
+ assert(s.find("/bye") != std::string::npos);
+ }
else
{
throw std::runtime_error(std::string("invalid test ") +