diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-11-04 15:56:34 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-11-05 09:29:01 +0100 |
commit | b98984c420bec944c034a0d8b3a967c049ad7b5d (patch) | |
tree | 6cd01971d4cf7f5ac822ab8a666f7171622e7bff /vcl | |
parent | 33ee9829fee1f6b80eb21b7a3d0e5a0f15ddf6f2 (diff) |
vcl pdf tokenizer: add real numbers testcase
Fails with commit 0d68738d67eacdfebdca3c9183dc11f953b38174 (Correctly
parse real numbers in PDFs, 2020-09-25) reverted.
Change-Id: I449ed781a3dd4b78e27a3fd2e135495e7d6c35ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105297
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qa/cppunit/filter/ipdf/data/real-numbers.pdf | 55 | ||||
-rw-r--r-- | vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 17 |
2 files changed, 72 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/filter/ipdf/data/real-numbers.pdf b/vcl/qa/cppunit/filter/ipdf/data/real-numbers.pdf new file mode 100644 index 000000000000..409360c54650 --- /dev/null +++ b/vcl/qa/cppunit/filter/ipdf/data/real-numbers.pdf @@ -0,0 +1,55 @@ +%PDF-1.7 +% +1 0 obj << + /Type /Catalog + /Pages 2 0 R +>> +endobj +2 0 obj << + /Type /Pages + /MediaBox [0 0 200 300] + /Count 1 + /Kids [3 0 R] +>> +endobj +3 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 4 0 R +>> +endobj +4 0 obj << + /Length 188 + /Test [.00 1.00 .00 1.00 .00 1.00] +>> +stream +q +0 0 0 rg +0 290 10 10 re B* +10 150 50 30 re B* +0 0 1 rg +190 290 10 10 re B* +70 232 50 30 re B* +0 1 0 rg +190 0 10 10 re B* +130 150 50 30 re B* +1 0 0 rg +0 0 10 10 re B* +70 67 50 30 re B* +Q +endstream +endobj +xref +0 5 +0000000000 65535 f +0000000015 00000 n +0000000068 00000 n +0000000157 00000 n +0000000226 00000 n +trailer << + /Root 1 0 R + /Size 5 +>> +startxref +503 +%%EOF diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 683a87f33995..d94eb76aa5b3 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -161,6 +161,23 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testDictArrayDict) CPPUNIT_ASSERT(pKey); } +CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testRealNumbers) +{ + // Load a file that has markup like this: + // 4 0 obj << + // /Test [.00 1.00 .00 1.00 .00 1.00] + // >> + OUString aSourceURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "real-numbers.pdf"; + SvFileStream aFile(aSourceURL, StreamMode::READ); + vcl::filter::PDFDocument aDocument; + + // Without the accompanying fix in place, this test would have failed, because the parser + // stopped when it saw an unexpected "." character. + CPPUNIT_ASSERT(aDocument.Read(aFile)); + std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); + CPPUNIT_ASSERT(!aPages.empty()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |