diff options
Diffstat (limited to 'qpdf/test_driver.cc')
-rw-r--r-- | qpdf/test_driver.cc | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc index 16b65d8d..812d6c07 100644 --- a/qpdf/test_driver.cc +++ b/qpdf/test_driver.cc @@ -3275,6 +3275,33 @@ test_92(QPDF& pdf, char const* arg2) assert(!root.isIndirect()); } +static void +test_93(QPDF& pdf, char const* arg2) +{ + // Test QPDFObjectHandle equality. Two QPDFObjectHandle objects + // are equal if they point to the same underlying object. + + auto trailer = pdf.getTrailer(); + auto root1 = trailer.getKey("/Root"); + auto root2 = pdf.getRoot(); + assert(root1 == root2); + auto oh1 = "<< /One /Two >>"_qpdf; + auto oh2 = oh1; + assert(oh1 == oh2); + auto oh3 = "<< /One /Two >>"_qpdf; + assert(oh1 != oh3); + oh2.replaceKey("/One", "/Three"_qpdf); + assert(oh1 == oh2); + assert(oh2.unparse() == "<< /One /Three >>"); + assert(!oh1.isIndirect()); + auto oh4 = pdf.makeIndirectObject(oh1); + assert(oh1 == oh4); + assert(oh1.isIndirect()); + assert(oh4.isIndirect()); + trailer.replaceKey("/Potato", oh1); + assert(trailer.getKey("/Potato") == oh2); +} + void runtest(int n, char const* filename1, char const* arg2) { @@ -3384,7 +3411,7 @@ runtest(int n, char const* filename1, char const* arg2) {80, test_80}, {81, test_81}, {82, test_82}, {83, test_83}, {84, test_84}, {85, test_85}, {86, test_86}, {87, test_87}, {88, test_88}, {89, test_89}, {90, test_90}, {91, test_91}, - {92, test_92}}; + {92, test_92}, {93, test_93}}; auto fn = test_functions.find(n); if (fn == test_functions.end()) { |