Fix test suite failure caused by migration of metadata for PDF 2.0.

This commit is contained in:
Michael R Sweet
2025-10-05 18:14:23 -04:00
parent 3c9a52a824
commit 5699a52127

View File

@@ -1108,11 +1108,9 @@ do_unit_tests(void)
if (do_crypto_tests())
return (1);
// Create a new PDF file...
testBegin("pdfioFileCreate(\"testpdfio-out.pdf\", ...)");
if ((outpdf = pdfioFileCreate("testpdfio-out.pdf", NULL, NULL, NULL, (pdfio_error_cb_t)error_cb, &error)) != NULL)
if ((outpdf = pdfioFileCreate("testpdfio-out.pdf", /*version*/"1.7", /*media_box*/NULL, /*crop_box*/NULL, (pdfio_error_cb_t)error_cb, &error)) != NULL)
testEnd(true);
else
goto fail;
@@ -1131,7 +1129,7 @@ do_unit_tests(void)
}
testBegin("pdfioFileCreateOutput(...)");
if ((outpdf = pdfioFileCreateOutput((pdfio_output_cb_t)output_cb, &outfd, NULL, NULL, NULL, (pdfio_error_cb_t)error_cb, &error)) != NULL)
if ((outpdf = pdfioFileCreateOutput((pdfio_output_cb_t)output_cb, &outfd, /*version*/"1.7", /*media_box*/NULL, /*crop_box*/NULL, (pdfio_error_cb_t)error_cb, &error)) != NULL)
testEnd(true);
else
goto fail;
@@ -1146,7 +1144,7 @@ do_unit_tests(void)
// Create new encrypted PDF files...
testBegin("pdfioFileCreate(\"testpdfio-rc4.pdf\", ...)");
if ((outpdf = pdfioFileCreate("testpdfio-rc4.pdf", NULL, NULL, NULL, (pdfio_error_cb_t)error_cb, &error)) != NULL)
if ((outpdf = pdfioFileCreate("testpdfio-rc4.pdf", /*version*/"2.0", /*media_box*/NULL, /*crop_box*/NULL, (pdfio_error_cb_t)error_cb, &error)) != NULL)
{
testEnd(true);
}
@@ -1175,7 +1173,7 @@ do_unit_tests(void)
// Create new encrypted PDF files...
testBegin("pdfioFileCreate(\"testpdfio-rc4p.pdf\", ...)");
if ((outpdf = pdfioFileCreate("testpdfio-rc4p.pdf", NULL, NULL, NULL, (pdfio_error_cb_t)error_cb, &error)) != NULL)
if ((outpdf = pdfioFileCreate("testpdfio-rc4p.pdf", /*version*/"1.7", /*media_box*/NULL, /*crop_box*/NULL, (pdfio_error_cb_t)error_cb, &error)) != NULL)
{
testEnd(true);
}
@@ -1203,7 +1201,7 @@ do_unit_tests(void)
return (1);
testBegin("pdfioFileCreate(\"testpdfio-aes.pdf\", ...)");
if ((outpdf = pdfioFileCreate("testpdfio-aes.pdf", NULL, NULL, NULL, (pdfio_error_cb_t)error_cb, &error)) != NULL)
if ((outpdf = pdfioFileCreate("testpdfio-aes.pdf", /*version*/"2.0", /*media_box*/NULL, /*crop_box*/NULL, (pdfio_error_cb_t)error_cb, &error)) != NULL)
{
testEnd(true);
}
@@ -1231,7 +1229,7 @@ do_unit_tests(void)
return (1);
testBegin("pdfioFileCreate(\"testpdfio-aesp.pdf\", ...)");
if ((outpdf = pdfioFileCreate("testpdfio-aesp.pdf", NULL, NULL, NULL, (pdfio_error_cb_t)error_cb, &error)) != NULL)
if ((outpdf = pdfioFileCreate("testpdfio-aesp.pdf", /*version*/"2.0", /*media_box*/NULL, /*crop_box*/NULL, (pdfio_error_cb_t)error_cb, &error)) != NULL)
{
testEnd(true);
}
@@ -1259,7 +1257,7 @@ do_unit_tests(void)
return (1);
testBegin("pdfioFileCreateTemporary");
if ((outpdf = pdfioFileCreateTemporary(temppdf, sizeof(temppdf), NULL, NULL, NULL, (pdfio_error_cb_t)error_cb, &error)) != NULL)
if ((outpdf = pdfioFileCreateTemporary(temppdf, sizeof(temppdf), /*version*/"2.0", /*media_box*/NULL, /*crop_box*/NULL, (pdfio_error_cb_t)error_cb, &error)) != NULL)
{
testEndMessage(true, "%s", temppdf);
}
@@ -1559,11 +1557,15 @@ read_unit_file(const char *filename, // I - File to read
testEndMessage(false, "got '%s', expected 'Michael R Sweet'", s);
return (1);
}
else
else if (strcmp(pdfioFileGetVersion(pdf), "2.0"))
{
testEndMessage(false, "got NULL, expected 'Michael R Sweet'");
return (1);
}
else
{
testEnd(true);
}
testBegin("pdfioFileGetCreator");
if ((s = pdfioFileGetCreator(pdf)) != NULL && !strcmp(s, "testpdfio"))
@@ -1575,11 +1577,15 @@ read_unit_file(const char *filename, // I - File to read
testEndMessage(false, "got '%s', expected 'testpdfio'", s);
return (1);
}
else
else if (strcmp(pdfioFileGetVersion(pdf), "2.0"))
{
testEndMessage(false, "got NULL, expected 'testpdfio'");
return (1);
}
else
{
testEnd(true);
}
testBegin("pdfioFileGetKeywords");
if ((s = pdfioFileGetKeywords(pdf)) != NULL && !strcmp(s, "one fish,two fish,red fish,blue fish"))
@@ -1591,11 +1597,15 @@ read_unit_file(const char *filename, // I - File to read
testEndMessage(false, "got '%s', expected 'one fish,two fish,red fish,blue fish'", s);
return (1);
}
else
else if (strcmp(pdfioFileGetVersion(pdf), "2.0"))
{
testEndMessage(false, "got NULL, expected 'one fish,two fish,red fish,blue fish'");
return (1);
}
else
{
testEnd(true);
}
testBegin("pdfioFileGetSubject");
if ((s = pdfioFileGetSubject(pdf)) != NULL && !strcmp(s, "Unit test document"))
@@ -1607,11 +1617,15 @@ read_unit_file(const char *filename, // I - File to read
testEndMessage(false, "got '%s', expected 'Unit test document'", s);
return (1);
}
else
else if (strcmp(pdfioFileGetVersion(pdf), "2.0"))
{
testEndMessage(false, "got NULL, expected 'Unit test document'");
return (1);
}
else
{
testEnd(true);
}
testBegin("pdfioFileGetTitle");
if ((s = pdfioFileGetTitle(pdf)) != NULL && !strcmp(s, "Test Document"))
@@ -1623,11 +1637,15 @@ read_unit_file(const char *filename, // I - File to read
testEndMessage(false, "got '%s', expected 'Test Document'", s);
return (1);
}
else
else if (strcmp(pdfioFileGetVersion(pdf), "2.0"))
{
testEndMessage(false, "got NULL, expected 'Test Document'");
return (1);
}
else
{
testEnd(true);
}
// Verify the number of pages is the same...
testBegin("pdfioFileGetNumPages");