diff options
author | Jay Berkenbilt <ejb@ql.org> | 2019-01-27 14:00:32 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-01-27 15:26:33 +0100 |
commit | c2ae35540e78d4edfbc57d42bfa2fc166c38b8a5 (patch) | |
tree | 1fb98106ee46f8507bcf363a9c78c269a34a8277 /qpdf/test_driver.cc | |
parent | 2d1db060422eabb82aaa1764926a3f9e881116e2 (diff) | |
download | qpdf-c2ae35540e78d4edfbc57d42bfa2fc166c38b8a5.tar.zst |
Add boundary condition test for getUniqueResourceName
Diffstat (limited to 'qpdf/test_driver.cc')
-rw-r--r-- | qpdf/test_driver.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc index 57dad636..a03c4b98 100644 --- a/qpdf/test_driver.cc +++ b/qpdf/test_driver.cc @@ -2016,6 +2016,23 @@ void runtest(int n, char const* filename1, char const* arg2) w.setStaticID(true); w.write(); } + else if (n == 60) + { + // Boundary condition testing for getUniqueResourceName + QPDFObjectHandle r1 = QPDFObjectHandle::newDictionary(); + int min_suffix = 1; + for (int i = 1; i < 3; ++i) + { + std::string name = r1.getUniqueResourceName("/Quack", min_suffix); + r1.mergeResources(QPDFObjectHandle::parse("<< /Z << >> >>")); + r1.getKey("/Z").replaceKey( + name, QPDFObjectHandle::newString("moo")); + } + pdf.getTrailer().replaceKey("/QTest", r1); + QPDFWriter w(pdf, "a.pdf"); + w.setStaticID(true); + w.write(); + } else { throw std::runtime_error(std::string("invalid test ") + |