Add test for QPDFObjectHandle::isDirectNull

This commit is contained in:
m-holger 2024-02-20 13:02:16 +00:00
parent a047d5497e
commit 36ee4ecc6e
1 changed files with 3 additions and 0 deletions

View File

@ -1191,6 +1191,7 @@ test_31(QPDF& pdf, char const* arg2)
std::cout << "trailing data: " << e.what() << std::endl;
}
assert(QPDFObjectHandle::parse(&pdf, "[5 0 R]").getArrayItem(0).isInteger());
assert(!QPDFObjectHandle::parse(&pdf, "[5 0 R]").getArrayItem(0).isDirectNull());
// Make sure an indirect integer followed by "0 R" is not
// mistakenly parsed as an indirect object.
assert(QPDFObjectHandle::parse(&pdf, "[5 0 R 0 R /X]").unparse() == "[ 5 0 R 0 (R) /X ]");
@ -1202,6 +1203,8 @@ test_31(QPDF& pdf, char const* arg2)
assert(QPDFObjectHandle::parse(&pdf, ">>").unparse() == "null");
// TC:QPDFParser eof in parse
assert(QPDFObjectHandle::parse(&pdf, "[7 0 R]").getArrayItem(0).isNull());
assert(!QPDFObjectHandle::parse(&pdf, "[7 0 R]").getArrayItem(0).isDirectNull());
assert(QPDFObjectHandle::parse(&pdf, "null").isDirectNull());
// TC:QPDFParser invalid objgen
assert(
QPDFObjectHandle::parse(&pdf, "[0 0 R -1 0 R 1 65535 R 1 100000 R 1 -1 R]").unparse() ==