aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/character_encoding.test
diff options
context:
space:
mode:
Diffstat (limited to 'qpdf/qtest/character_encoding.test')
-rw-r--r--qpdf/qtest/character_encoding.test40
1 files changed, 40 insertions, 0 deletions
diff --git a/qpdf/qtest/character_encoding.test b/qpdf/qtest/character_encoding.test
new file mode 100644
index 00000000..71a3b2c2
--- /dev/null
+++ b/qpdf/qtest/character_encoding.test
@@ -0,0 +1,40 @@
+#!/usr/bin/env perl
+require 5.008;
+use warnings;
+use strict;
+
+unshift(@INC, '.');
+require qpdf_test_helpers;
+
+chdir("qpdf") or die "chdir testdir failed: $!\n";
+
+require TestDriver;
+
+cleanup();
+
+my $td = new TestDriver('character_encoding');
+
+my $n_tests = 4;
+
+$td->runtest("PDF doc encoding to Unicode",
+ {$td->COMMAND => "test_pdf_doc_encoding pdf-doc-to-utf8.in"},
+ {$td->FILE => "pdf-doc-to-utf8.out", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("UTF-16 encoding",
+ {$td->COMMAND => "test_pdf_unicode unicode.in"},
+ {$td->FILE => "unicode.out", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("UTF-16 encoding errors",
+ {$td->COMMAND => "test_pdf_unicode unicode-errors.in"},
+ {$td->FILE => "unicode-errors.out", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+
+# UTF-16LE is not allowed by the PDF spec, but it seems that most
+# readers accept it.
+$td->runtest("UTF-16LE strings",
+ {$td->COMMAND => "qpdf --list-attachments --verbose utf16le.pdf"},
+ {$td->FILE => "utf16le-attachments.out", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+
+cleanup();
+$td->report($n_tests);