Add pdfioFileGet/SetLanguage functions (Issue #124)

This commit is contained in:
Michael R Sweet
2025-04-13 20:21:23 -04:00
parent c75611e274
commit 1116e929f7
7 changed files with 133 additions and 4 deletions

View File

@@ -1399,18 +1399,18 @@ read_unit_file(const char *filename, // I - File to read
}
fputs("pdfioDictGetString(Lang): ", stdout);
if ((s = pdfioDictGetString(catalog, "Lang")) != NULL && !strcmp(s, "en"))
if ((s = pdfioDictGetString(catalog, "Lang")) != NULL && !strcmp(s, "en-CA"))
{
puts("PASS");
}
else if (s)
{
printf("FAIL (got '%s', expected 'en')\n", s);
printf("FAIL (got '%s', expected 'en-CA')\n", s);
return (1);
}
else
{
puts("FAIL (got NULL, expected 'en')");
puts("FAIL (got NULL, expected 'en-CA')");
return (1);
}
@@ -3555,7 +3555,6 @@ write_unit_file(
// Set some catalog values...
pdfioDictSetName(catalog, "PageLayout", "SinglePage");
pdfioDictSetName(catalog, "PageMode", "UseThumbs");
pdfioDictSetString(catalog, "Lang", "en");
// Set info values...
fputs("pdfioFileGet/SetAuthor: ", stdout);
@@ -3609,6 +3608,23 @@ write_unit_file(
return (1);
}
fputs("pdfioFileGet/SetLanguage: ", stdout);
pdfioFileSetLanguage(outpdf, "en-CA");
if ((s = pdfioFileGetLanguage(outpdf)) != NULL && !strcmp(s, "en-CA"))
{
puts("PASS");
}
else if (s)
{
printf("FAIL (got '%s', expected 'en-CA')\n", s);
return (1);
}
else
{
puts("FAIL (got NULL, expected 'en-CA')");
return (1);
}
fputs("pdfioFileGet/SetSubject: ", stdout);
pdfioFileSetSubject(outpdf, "Unit test document");
if ((s = pdfioFileGetSubject(outpdf)) != NULL && !strcmp(s, "Unit test document"))