aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-12-10 19:37:01 +0100
committerJay Berkenbilt <ejb@ql.org>2021-12-10 19:37:07 +0100
commit8e0b15333228ab973571eec498af41d3cbb8ab63 (patch)
tree4b1e62c5e6f77e0dfea19c1208a1deee9c2514a1 /qpdf
parent72c10d8617c799432e28dabf1679b1a6f5245c02 (diff)
downloadqpdf-8e0b15333228ab973571eec498af41d3cbb8ab63.tar.zst
Expose QPDFObjectHandle::addTokenFilter (fixes #580)
Diffstat (limited to 'qpdf')
-rw-r--r--qpdf/test_driver.cc29
1 files changed, 21 insertions, 8 deletions
diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc
index 613dc5bd..d4bfe2af 100644
--- a/qpdf/test_driver.cc
+++ b/qpdf/test_driver.cc
@@ -2704,14 +2704,27 @@ void runtest(int n, char const* filename1, char const* arg2)
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);
+ // Do this once with addContentTokenFilter and once with
+ // addTokenFilter to show that they are the same and to ensure
+ // that addTokenFilter is directly exercised in testing.
+ for (int i = 0; i < 2; i++)
+ {
+ Pl_Buffer b("buffer");
+ if (i == 0)
+ {
+ fx1.addContentTokenFilter(new TokenFilter);
+ }
+ else
+ {
+ fx1.getObjectHandle().addTokenFilter(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 if (n == 73)
{