Commit 36ee4ecc6ee15520ef792d52f48ae7dcb7d37c30

Authored by m-holger
1 parent a047d549

Add test for QPDFObjectHandle::isDirectNull

Showing 1 changed file with 3 additions and 0 deletions
qpdf/test_driver.cc
@@ -1191,6 +1191,7 @@ test_31(QPDF& pdf, char const* arg2) @@ -1191,6 +1191,7 @@ test_31(QPDF& pdf, char const* arg2)
1191 std::cout << "trailing data: " << e.what() << std::endl; 1191 std::cout << "trailing data: " << e.what() << std::endl;
1192 } 1192 }
1193 assert(QPDFObjectHandle::parse(&pdf, "[5 0 R]").getArrayItem(0).isInteger()); 1193 assert(QPDFObjectHandle::parse(&pdf, "[5 0 R]").getArrayItem(0).isInteger());
  1194 + assert(!QPDFObjectHandle::parse(&pdf, "[5 0 R]").getArrayItem(0).isDirectNull());
1194 // Make sure an indirect integer followed by "0 R" is not 1195 // Make sure an indirect integer followed by "0 R" is not
1195 // mistakenly parsed as an indirect object. 1196 // mistakenly parsed as an indirect object.
1196 assert(QPDFObjectHandle::parse(&pdf, "[5 0 R 0 R /X]").unparse() == "[ 5 0 R 0 (R) /X ]"); 1197 assert(QPDFObjectHandle::parse(&pdf, "[5 0 R 0 R /X]").unparse() == "[ 5 0 R 0 (R) /X ]");
@@ -1202,6 +1203,8 @@ test_31(QPDF&amp; pdf, char const* arg2) @@ -1202,6 +1203,8 @@ test_31(QPDF&amp; pdf, char const* arg2)
1202 assert(QPDFObjectHandle::parse(&pdf, ">>").unparse() == "null"); 1203 assert(QPDFObjectHandle::parse(&pdf, ">>").unparse() == "null");
1203 // TC:QPDFParser eof in parse 1204 // TC:QPDFParser eof in parse
1204 assert(QPDFObjectHandle::parse(&pdf, "[7 0 R]").getArrayItem(0).isNull()); 1205 assert(QPDFObjectHandle::parse(&pdf, "[7 0 R]").getArrayItem(0).isNull());
  1206 + assert(!QPDFObjectHandle::parse(&pdf, "[7 0 R]").getArrayItem(0).isDirectNull());
  1207 + assert(QPDFObjectHandle::parse(&pdf, "null").isDirectNull());
1205 // TC:QPDFParser invalid objgen 1208 // TC:QPDFParser invalid objgen
1206 assert( 1209 assert(
1207 QPDFObjectHandle::parse(&pdf, "[0 0 R -1 0 R 1 65535 R 1 100000 R 1 -1 R]").unparse() == 1210 QPDFObjectHandle::parse(&pdf, "[0 0 R -1 0 R 1 65535 R 1 100000 R 1 -1 R]").unparse() ==