mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-12-23 21:46:24 +01:00
Fix test suite failure caused by migration of metadata for PDF 2.0.
This commit is contained in:
46
testpdfio.c
46
testpdfio.c
@@ -1108,11 +1108,9 @@ do_unit_tests(void)
|
|||||||
if (do_crypto_tests())
|
if (do_crypto_tests())
|
||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Create a new PDF file...
|
// Create a new PDF file...
|
||||||
testBegin("pdfioFileCreate(\"testpdfio-out.pdf\", ...)");
|
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);
|
testEnd(true);
|
||||||
else
|
else
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -1131,7 +1129,7 @@ do_unit_tests(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
testBegin("pdfioFileCreateOutput(...)");
|
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);
|
testEnd(true);
|
||||||
else
|
else
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -1146,7 +1144,7 @@ do_unit_tests(void)
|
|||||||
|
|
||||||
// Create new encrypted PDF files...
|
// Create new encrypted PDF files...
|
||||||
testBegin("pdfioFileCreate(\"testpdfio-rc4.pdf\", ...)");
|
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);
|
testEnd(true);
|
||||||
}
|
}
|
||||||
@@ -1175,7 +1173,7 @@ do_unit_tests(void)
|
|||||||
|
|
||||||
// Create new encrypted PDF files...
|
// Create new encrypted PDF files...
|
||||||
testBegin("pdfioFileCreate(\"testpdfio-rc4p.pdf\", ...)");
|
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);
|
testEnd(true);
|
||||||
}
|
}
|
||||||
@@ -1203,7 +1201,7 @@ do_unit_tests(void)
|
|||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
testBegin("pdfioFileCreate(\"testpdfio-aes.pdf\", ...)");
|
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);
|
testEnd(true);
|
||||||
}
|
}
|
||||||
@@ -1231,7 +1229,7 @@ do_unit_tests(void)
|
|||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
testBegin("pdfioFileCreate(\"testpdfio-aesp.pdf\", ...)");
|
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);
|
testEnd(true);
|
||||||
}
|
}
|
||||||
@@ -1259,7 +1257,7 @@ do_unit_tests(void)
|
|||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
testBegin("pdfioFileCreateTemporary");
|
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);
|
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);
|
testEndMessage(false, "got '%s', expected 'Michael R Sweet'", s);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
else
|
else if (strcmp(pdfioFileGetVersion(pdf), "2.0"))
|
||||||
{
|
{
|
||||||
testEndMessage(false, "got NULL, expected 'Michael R Sweet'");
|
testEndMessage(false, "got NULL, expected 'Michael R Sweet'");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
testEnd(true);
|
||||||
|
}
|
||||||
|
|
||||||
testBegin("pdfioFileGetCreator");
|
testBegin("pdfioFileGetCreator");
|
||||||
if ((s = pdfioFileGetCreator(pdf)) != NULL && !strcmp(s, "testpdfio"))
|
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);
|
testEndMessage(false, "got '%s', expected 'testpdfio'", s);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
else
|
else if (strcmp(pdfioFileGetVersion(pdf), "2.0"))
|
||||||
{
|
{
|
||||||
testEndMessage(false, "got NULL, expected 'testpdfio'");
|
testEndMessage(false, "got NULL, expected 'testpdfio'");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
testEnd(true);
|
||||||
|
}
|
||||||
|
|
||||||
testBegin("pdfioFileGetKeywords");
|
testBegin("pdfioFileGetKeywords");
|
||||||
if ((s = pdfioFileGetKeywords(pdf)) != NULL && !strcmp(s, "one fish,two fish,red fish,blue fish"))
|
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);
|
testEndMessage(false, "got '%s', expected 'one fish,two fish,red fish,blue fish'", s);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
else
|
else if (strcmp(pdfioFileGetVersion(pdf), "2.0"))
|
||||||
{
|
{
|
||||||
testEndMessage(false, "got NULL, expected 'one fish,two fish,red fish,blue fish'");
|
testEndMessage(false, "got NULL, expected 'one fish,two fish,red fish,blue fish'");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
testEnd(true);
|
||||||
|
}
|
||||||
|
|
||||||
testBegin("pdfioFileGetSubject");
|
testBegin("pdfioFileGetSubject");
|
||||||
if ((s = pdfioFileGetSubject(pdf)) != NULL && !strcmp(s, "Unit test document"))
|
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);
|
testEndMessage(false, "got '%s', expected 'Unit test document'", s);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
else
|
else if (strcmp(pdfioFileGetVersion(pdf), "2.0"))
|
||||||
{
|
{
|
||||||
testEndMessage(false, "got NULL, expected 'Unit test document'");
|
testEndMessage(false, "got NULL, expected 'Unit test document'");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
testEnd(true);
|
||||||
|
}
|
||||||
|
|
||||||
testBegin("pdfioFileGetTitle");
|
testBegin("pdfioFileGetTitle");
|
||||||
if ((s = pdfioFileGetTitle(pdf)) != NULL && !strcmp(s, "Test Document"))
|
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);
|
testEndMessage(false, "got '%s', expected 'Test Document'", s);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
else
|
else if (strcmp(pdfioFileGetVersion(pdf), "2.0"))
|
||||||
{
|
{
|
||||||
testEndMessage(false, "got NULL, expected 'Test Document'");
|
testEndMessage(false, "got NULL, expected 'Test Document'");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
testEnd(true);
|
||||||
|
}
|
||||||
|
|
||||||
// Verify the number of pages is the same...
|
// Verify the number of pages is the same...
|
||||||
testBegin("pdfioFileGetNumPages");
|
testBegin("pdfioFileGetNumPages");
|
||||||
|
|||||||
Reference in New Issue
Block a user