1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <config_features.h>
12 #if HAVE_FEATURE_PDFIUM
14 #include <cppunit/TestAssert.h>
15 #include <cppunit/extensions/HelperMacros.h>
17 #include <unotest/bootstrapfixturebase.hxx>
18 #include <unotest/directories.hxx>
19 #include <unotools/datetime.hxx>
21 #include <com/sun/star/util/DateTime.hpp>
23 #include <vcl/graph.hxx>
24 #include <vcl/graphicfilter.hxx>
25 #include <tools/stream.hxx>
27 #include <vcl/filter/PDFiumLibrary.hxx>
28 #include <vcl/pdfread.hxx>
29 #include <vcl/bitmapaccess.hxx>
31 class PDFiumLibraryTest
: public test::BootstrapFixtureBase
33 OUString
getFullUrl(const OUString
& sFileName
)
35 return m_directories
.getURLFromSrc("/vcl/qa/cppunit/data/") + sFileName
;
40 void testPageObjects();
41 void testAnnotationsMadeInEvince();
42 void testAnnotationsMadeInAcrobat();
43 void testAnnotationsDifferentTypes();
45 void testFormFields();
47 CPPUNIT_TEST_SUITE(PDFiumLibraryTest
);
48 CPPUNIT_TEST(testDocument
);
49 CPPUNIT_TEST(testPages
);
50 CPPUNIT_TEST(testPageObjects
);
51 CPPUNIT_TEST(testAnnotationsMadeInEvince
);
52 CPPUNIT_TEST(testAnnotationsMadeInAcrobat
);
53 CPPUNIT_TEST(testAnnotationsDifferentTypes
);
54 CPPUNIT_TEST(testTools
);
55 CPPUNIT_TEST(testFormFields
);
56 CPPUNIT_TEST_SUITE_END();
59 void PDFiumLibraryTest::testDocument()
61 OUString aURL
= getFullUrl("Pangram.pdf");
62 SvFileStream
aStream(aURL
, StreamMode::READ
);
63 GraphicFilter
& rGraphicFilter
= GraphicFilter::GetGraphicFilter();
64 Graphic aGraphic
= rGraphicFilter
.ImportUnloadedGraphic(aStream
);
65 aGraphic
.makeAvailable();
67 auto pVectorGraphicData
= aGraphic
.getVectorGraphicData();
68 CPPUNIT_ASSERT(pVectorGraphicData
);
69 CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf
,
70 pVectorGraphicData
->getVectorGraphicDataType());
72 const void* pData
= pVectorGraphicData
->getVectorGraphicDataArray().getConstArray();
73 int nLength
= pVectorGraphicData
->getVectorGraphicDataArrayLength();
75 auto pPdfium
= vcl::pdf::PDFiumLibrary::get();
76 CPPUNIT_ASSERT(pPdfium
);
77 auto pDocument
= pPdfium
->openDocument(pData
, nLength
);
78 CPPUNIT_ASSERT(pDocument
);
80 CPPUNIT_ASSERT_EQUAL(1, pDocument
->getPageCount());
82 auto aSize
= pDocument
->getPageSize(0);
83 CPPUNIT_ASSERT_EQUAL(612.0, aSize
.getX());
84 CPPUNIT_ASSERT_EQUAL(792.0, aSize
.getY());
87 void PDFiumLibraryTest::testPages()
89 OUString aURL
= getFullUrl("Pangram.pdf");
90 SvFileStream
aStream(aURL
, StreamMode::READ
);
91 GraphicFilter
& rGraphicFilter
= GraphicFilter::GetGraphicFilter();
92 Graphic aGraphic
= rGraphicFilter
.ImportUnloadedGraphic(aStream
);
93 aGraphic
.makeAvailable();
95 auto pVectorGraphicData
= aGraphic
.getVectorGraphicData();
96 CPPUNIT_ASSERT(pVectorGraphicData
);
97 CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf
,
98 pVectorGraphicData
->getVectorGraphicDataType());
100 const void* pData
= pVectorGraphicData
->getVectorGraphicDataArray().getConstArray();
101 int nLength
= pVectorGraphicData
->getVectorGraphicDataArrayLength();
103 auto pPdfium
= vcl::pdf::PDFiumLibrary::get();
104 auto pDocument
= pPdfium
->openDocument(pData
, nLength
);
105 CPPUNIT_ASSERT(pDocument
);
107 CPPUNIT_ASSERT_EQUAL(1, pDocument
->getPageCount());
109 auto pPage
= pDocument
->openPage(0);
110 CPPUNIT_ASSERT(pPage
);
113 void PDFiumLibraryTest::testPageObjects()
115 OUString aURL
= getFullUrl("Pangram.pdf");
116 SvFileStream
aStream(aURL
, StreamMode::READ
);
117 GraphicFilter
& rGraphicFilter
= GraphicFilter::GetGraphicFilter();
118 Graphic aGraphic
= rGraphicFilter
.ImportUnloadedGraphic(aStream
);
119 aGraphic
.makeAvailable();
121 auto pVectorGraphicData
= aGraphic
.getVectorGraphicData();
122 CPPUNIT_ASSERT(pVectorGraphicData
);
123 CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf
,
124 pVectorGraphicData
->getVectorGraphicDataType());
126 const void* pData
= pVectorGraphicData
->getVectorGraphicDataArray().getConstArray();
127 int nLength
= pVectorGraphicData
->getVectorGraphicDataArrayLength();
129 auto pPdfium
= vcl::pdf::PDFiumLibrary::get();
130 auto pDocument
= pPdfium
->openDocument(pData
, nLength
);
131 CPPUNIT_ASSERT(pDocument
);
133 CPPUNIT_ASSERT_EQUAL(1, pDocument
->getPageCount());
135 auto pPage
= pDocument
->openPage(0);
136 CPPUNIT_ASSERT(pPage
);
138 CPPUNIT_ASSERT_EQUAL(12, pPage
->getObjectCount());
140 auto pPageObject
= pPage
->getObject(0);
141 auto pTextPage
= pPage
->getTextPage();
143 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFPageObjectType::Text
, pPageObject
->getType());
145 CPPUNIT_ASSERT_EQUAL(OUString("The quick, brown fox jumps over a lazy dog. DJs flock by when "
146 "MTV ax quiz prog. Junk MTV quiz "),
147 pPageObject
->getText(pTextPage
));
149 CPPUNIT_ASSERT_EQUAL(12.0, pPageObject
->getFontSize());
150 CPPUNIT_ASSERT_EQUAL(OUString("Liberation Serif"), pPageObject
->getFontName());
151 CPPUNIT_ASSERT_EQUAL(0, pPageObject
->getTextRenderMode()); // FPDF_TEXTRENDERMODE_FILL
152 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, pPageObject
->getFillColor());
153 CPPUNIT_ASSERT_EQUAL(COL_BLACK
, pPageObject
->getStrokeColor());
155 CPPUNIT_ASSERT_EQUAL(true, pPageObject
->getMatrix().isIdentity());
157 CPPUNIT_ASSERT_DOUBLES_EQUAL(057.01, pPageObject
->getBounds().getMinX(), 1E-2);
158 CPPUNIT_ASSERT_DOUBLES_EQUAL(721.51, pPageObject
->getBounds().getMinY(), 1E-2);
159 CPPUNIT_ASSERT_DOUBLES_EQUAL(539.48, pPageObject
->getBounds().getMaxX(), 1E-2);
160 CPPUNIT_ASSERT_DOUBLES_EQUAL(732.54, pPageObject
->getBounds().getMaxY(), 1E-2);
163 void PDFiumLibraryTest::testAnnotationsMadeInEvince()
165 OUString aURL
= getFullUrl("PangramWithAnnotations.pdf");
166 SvFileStream
aStream(aURL
, StreamMode::READ
);
167 GraphicFilter
& rGraphicFilter
= GraphicFilter::GetGraphicFilter();
168 Graphic aGraphic
= rGraphicFilter
.ImportUnloadedGraphic(aStream
);
169 aGraphic
.makeAvailable();
171 auto pVectorGraphicData
= aGraphic
.getVectorGraphicData();
172 CPPUNIT_ASSERT(pVectorGraphicData
);
173 CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf
,
174 pVectorGraphicData
->getVectorGraphicDataType());
176 const void* pData
= pVectorGraphicData
->getVectorGraphicDataArray().getConstArray();
177 int nLength
= pVectorGraphicData
->getVectorGraphicDataArrayLength();
179 auto pPdfium
= vcl::pdf::PDFiumLibrary::get();
180 auto pDocument
= pPdfium
->openDocument(pData
, nLength
);
181 CPPUNIT_ASSERT(pDocument
);
183 CPPUNIT_ASSERT_EQUAL(1, pDocument
->getPageCount());
185 auto pPage
= pDocument
->openPage(0);
186 CPPUNIT_ASSERT(pPage
);
188 CPPUNIT_ASSERT_EQUAL(2, pPage
->getAnnotationCount());
191 auto pAnnotation
= pPage
->getAnnotation(0);
192 CPPUNIT_ASSERT(pAnnotation
);
193 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Text
, pAnnotation
->getSubType());
195 OUString aPopupString
= pAnnotation
->getString(vcl::pdf::constDictionaryKeyTitle
);
196 CPPUNIT_ASSERT_EQUAL(OUString("quikee"), aPopupString
);
198 OUString aContentsString
= pAnnotation
->getString(vcl::pdf::constDictionaryKeyContents
);
199 CPPUNIT_ASSERT_EQUAL(OUString("Annotation test"), aContentsString
);
201 CPPUNIT_ASSERT_EQUAL(true, pAnnotation
->hasKey(vcl::pdf::constDictionaryKeyPopup
));
202 auto pPopupAnnotation
= pAnnotation
->getLinked(vcl::pdf::constDictionaryKeyPopup
);
203 CPPUNIT_ASSERT(pPopupAnnotation
);
205 CPPUNIT_ASSERT_EQUAL(1, pPage
->getAnnotationIndex(pPopupAnnotation
));
206 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Popup
, pPopupAnnotation
->getSubType());
208 OUString sDateTimeString
209 = pAnnotation
->getString(vcl::pdf::constDictionaryKeyModificationDate
);
210 CPPUNIT_ASSERT_EQUAL(OUString("D:20200612201322+02'00"), sDateTimeString
);
214 auto pAnnotation
= pPage
->getAnnotation(1);
215 CPPUNIT_ASSERT(pAnnotation
);
216 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Popup
, pAnnotation
->getSubType());
220 void PDFiumLibraryTest::testAnnotationsMadeInAcrobat()
222 OUString aURL
= getFullUrl("PangramAcrobatAnnotations.pdf");
223 SvFileStream
aStream(aURL
, StreamMode::READ
);
224 GraphicFilter
& rGraphicFilter
= GraphicFilter::GetGraphicFilter();
225 Graphic aGraphic
= rGraphicFilter
.ImportUnloadedGraphic(aStream
);
226 aGraphic
.makeAvailable();
228 auto pVectorGraphicData
= aGraphic
.getVectorGraphicData();
229 CPPUNIT_ASSERT(pVectorGraphicData
);
230 CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf
,
231 pVectorGraphicData
->getVectorGraphicDataType());
233 const void* pData
= pVectorGraphicData
->getVectorGraphicDataArray().getConstArray();
234 int nLength
= pVectorGraphicData
->getVectorGraphicDataArrayLength();
236 auto pPdfium
= vcl::pdf::PDFiumLibrary::get();
237 auto pDocument
= pPdfium
->openDocument(pData
, nLength
);
238 CPPUNIT_ASSERT(pDocument
);
240 CPPUNIT_ASSERT_EQUAL(1, pDocument
->getPageCount());
242 auto pPage
= pDocument
->openPage(0);
243 CPPUNIT_ASSERT(pPage
);
245 CPPUNIT_ASSERT_EQUAL(4, pPage
->getAnnotationCount());
248 auto pAnnotation
= pPage
->getAnnotation(0);
249 CPPUNIT_ASSERT(pAnnotation
);
250 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Text
, pAnnotation
->getSubType());
252 OUString aPopupString
= pAnnotation
->getString(vcl::pdf::constDictionaryKeyTitle
);
253 CPPUNIT_ASSERT_EQUAL(OUString("quikee"), aPopupString
);
255 OUString aContentsString
= pAnnotation
->getString(vcl::pdf::constDictionaryKeyContents
);
256 CPPUNIT_ASSERT_EQUAL(OUString("YEEEY"), aContentsString
);
258 CPPUNIT_ASSERT_EQUAL(true, pAnnotation
->hasKey(vcl::pdf::constDictionaryKeyPopup
));
259 auto pPopupAnnotation
= pAnnotation
->getLinked(vcl::pdf::constDictionaryKeyPopup
);
260 CPPUNIT_ASSERT(pPopupAnnotation
);
262 CPPUNIT_ASSERT_EQUAL(1, pPage
->getAnnotationIndex(pPopupAnnotation
));
263 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Popup
, pPopupAnnotation
->getSubType());
267 auto pAnnotation
= pPage
->getAnnotation(1);
268 CPPUNIT_ASSERT(pAnnotation
);
269 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Popup
, pAnnotation
->getSubType());
273 auto pAnnotation
= pPage
->getAnnotation(2);
274 CPPUNIT_ASSERT(pAnnotation
);
275 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Text
, pAnnotation
->getSubType());
277 OUString aPopupString
= pAnnotation
->getString(vcl::pdf::constDictionaryKeyTitle
);
278 CPPUNIT_ASSERT_EQUAL(OUString("quikee"), aPopupString
);
280 OUString aContentsString
= pAnnotation
->getString(vcl::pdf::constDictionaryKeyContents
);
281 CPPUNIT_ASSERT_EQUAL(OUString("Note"), aContentsString
);
283 CPPUNIT_ASSERT_EQUAL(true, pAnnotation
->hasKey(vcl::pdf::constDictionaryKeyPopup
));
284 auto pPopupAnnotation
= pAnnotation
->getLinked(vcl::pdf::constDictionaryKeyPopup
);
285 CPPUNIT_ASSERT(pPopupAnnotation
);
287 CPPUNIT_ASSERT_EQUAL(3, pPage
->getAnnotationIndex(pPopupAnnotation
));
288 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Popup
, pPopupAnnotation
->getSubType());
292 auto pAnnotation
= pPage
->getAnnotation(3);
293 CPPUNIT_ASSERT(pAnnotation
);
294 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Popup
, pAnnotation
->getSubType());
298 void PDFiumLibraryTest::testFormFields()
300 // Given a document with a form field that looks like plain text:
301 OUString aURL
= getFullUrl(u
"form-fields.pdf");
302 SvFileStream
aFileStream(aURL
, StreamMode::READ
);
303 SvMemoryStream aMemory
;
304 aMemory
.WriteStream(aFileStream
);
307 // When rendering its first (and only) page to a bitmap:
308 std::vector
<BitmapEx
> aBitmaps
;
309 int nRet
= vcl::RenderPDFBitmaps(aMemory
.GetData(), aMemory
.GetSize(), aBitmaps
);
310 CPPUNIT_ASSERT(nRet
);
311 CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aBitmaps
.size());
313 // Then make sure the bitmap contains that text:
314 Bitmap aBitmap
= aBitmaps
[0].GetBitmap();
315 BitmapReadAccess
aAccess(aBitmap
);
316 Size aSize
= aBitmap
.GetSizePixel();
317 std::set
<sal_uInt32
> aColors
;
318 for (tools::Long y
= 0; y
< aSize
.Height(); ++y
)
320 for (tools::Long x
= 0; x
< aSize
.Width(); ++x
)
322 aColors
.insert(static_cast<sal_uInt32
>(aAccess
.GetPixel(y
, x
)));
325 // Without the accompanying fix in place, this test would have failed with:
326 // - Expected greater than: 1
328 // i.e. at least black text and white background is expected (possibly more, due to
329 // anti-aliasing), but nothing was rendered.
330 CPPUNIT_ASSERT_GREATER(static_cast<size_t>(1), aColors
.size());
333 void PDFiumLibraryTest::testAnnotationsDifferentTypes()
335 OUString aURL
= getFullUrl("PangramWithMultipleTypeOfAnnotations.pdf");
336 SvFileStream
aStream(aURL
, StreamMode::READ
);
337 GraphicFilter
& rGraphicFilter
= GraphicFilter::GetGraphicFilter();
338 Graphic aGraphic
= rGraphicFilter
.ImportUnloadedGraphic(aStream
);
339 aGraphic
.makeAvailable();
341 auto pVectorGraphicData
= aGraphic
.getVectorGraphicData();
342 CPPUNIT_ASSERT(pVectorGraphicData
);
343 CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf
,
344 pVectorGraphicData
->getVectorGraphicDataType());
346 const void* pData
= pVectorGraphicData
->getVectorGraphicDataArray().getConstArray();
347 int nLength
= pVectorGraphicData
->getVectorGraphicDataArrayLength();
349 auto pPdfium
= vcl::pdf::PDFiumLibrary::get();
350 auto pDocument
= pPdfium
->openDocument(pData
, nLength
);
351 CPPUNIT_ASSERT(pDocument
);
353 CPPUNIT_ASSERT_EQUAL(1, pDocument
->getPageCount());
355 auto pPage
= pDocument
->openPage(0);
356 CPPUNIT_ASSERT(pPage
);
358 CPPUNIT_ASSERT_EQUAL(6, pPage
->getAnnotationCount());
361 auto pAnnotation
= pPage
->getAnnotation(0);
362 CPPUNIT_ASSERT(pAnnotation
);
363 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::FreeText
, pAnnotation
->getSubType());
364 CPPUNIT_ASSERT_EQUAL(0, pAnnotation
->getObjectCount());
365 OUString aContentsString
= pAnnotation
->getString(vcl::pdf::constDictionaryKeyContents
);
366 CPPUNIT_ASSERT_EQUAL(OUString("Inline Note"), aContentsString
);
367 auto const& rLineGeometry
= pAnnotation
->getLineGeometry();
368 CPPUNIT_ASSERT_EQUAL(true, rLineGeometry
.empty());
372 auto pAnnotation
= pPage
->getAnnotation(1);
373 CPPUNIT_ASSERT(pAnnotation
);
374 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Ink
, pAnnotation
->getSubType());
375 CPPUNIT_ASSERT_EQUAL(0, pAnnotation
->getObjectCount());
376 OUString aContentsString
= pAnnotation
->getString(vcl::pdf::constDictionaryKeyContents
);
377 CPPUNIT_ASSERT_EQUAL(OUString("Freehand Text"), aContentsString
);
378 CPPUNIT_ASSERT_EQUAL(size_t(1), pAnnotation
->getInkStrokes().size());
379 auto const& aInkStrokes
= pAnnotation
->getInkStrokes();
380 auto const& aPoints
= aInkStrokes
[0];
381 CPPUNIT_ASSERT_EQUAL(size_t(74), aPoints
.size());
382 CPPUNIT_ASSERT_DOUBLES_EQUAL(2.0f
, pAnnotation
->getBorderWidth(), 1E-2);
383 auto const& rLineGeometry
= pAnnotation
->getLineGeometry();
384 CPPUNIT_ASSERT_EQUAL(true, rLineGeometry
.empty());
388 auto pAnnotation
= pPage
->getAnnotation(2);
389 CPPUNIT_ASSERT(pAnnotation
);
390 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Line
, pAnnotation
->getSubType());
391 CPPUNIT_ASSERT_EQUAL(0, pAnnotation
->getObjectCount());
392 OUString aContentsString
= pAnnotation
->getString(vcl::pdf::constDictionaryKeyContents
);
393 CPPUNIT_ASSERT_EQUAL(OUString("Line Text"), aContentsString
);
394 auto const& rLineGeometry
= pAnnotation
->getLineGeometry();
395 CPPUNIT_ASSERT_EQUAL(false, rLineGeometry
.empty());
399 auto pAnnotation
= pPage
->getAnnotation(3);
400 CPPUNIT_ASSERT(pAnnotation
);
401 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Polygon
, pAnnotation
->getSubType());
402 CPPUNIT_ASSERT_EQUAL(0, pAnnotation
->getObjectCount());
403 CPPUNIT_ASSERT_EQUAL(true, pAnnotation
->hasKey("Vertices"));
404 OUString aContentsString
= pAnnotation
->getString(vcl::pdf::constDictionaryKeyContents
);
405 CPPUNIT_ASSERT_EQUAL(OUString("Polygon Text"), aContentsString
);
406 auto const& aVertices
= pAnnotation
->getVertices();
407 CPPUNIT_ASSERT_EQUAL(size_t(3), aVertices
.size());
408 CPPUNIT_ASSERT_DOUBLES_EQUAL(2.0f
, pAnnotation
->getBorderWidth(), 1E-2);
409 auto const& rLineGeometry
= pAnnotation
->getLineGeometry();
410 CPPUNIT_ASSERT_EQUAL(true, rLineGeometry
.empty());
414 auto pAnnotation
= pPage
->getAnnotation(4);
415 CPPUNIT_ASSERT(pAnnotation
);
416 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Circle
, pAnnotation
->getSubType());
417 CPPUNIT_ASSERT_EQUAL(0, pAnnotation
->getObjectCount());
418 OUString aContentsString
= pAnnotation
->getString(vcl::pdf::constDictionaryKeyContents
);
419 CPPUNIT_ASSERT_EQUAL(OUString("Ellipse Text"), aContentsString
);
420 auto const& rLineGeometry
= pAnnotation
->getLineGeometry();
421 CPPUNIT_ASSERT_EQUAL(true, rLineGeometry
.empty());
425 auto pAnnotation
= pPage
->getAnnotation(5);
426 CPPUNIT_ASSERT(pAnnotation
);
427 CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Square
, pAnnotation
->getSubType());
428 CPPUNIT_ASSERT_EQUAL(0, pAnnotation
->getObjectCount());
429 OUString aContentsString
= pAnnotation
->getString(vcl::pdf::constDictionaryKeyContents
);
430 CPPUNIT_ASSERT_EQUAL(OUString("Rectangle Text"), aContentsString
);
431 CPPUNIT_ASSERT_EQUAL(Color(0xFF, 0xE0, 0x00), pAnnotation
->getColor());
432 CPPUNIT_ASSERT_EQUAL(false, pAnnotation
->hasKey(vcl::pdf::constDictionaryKeyInteriorColor
));
433 auto const& rLineGeometry
= pAnnotation
->getLineGeometry();
434 CPPUNIT_ASSERT_EQUAL(true, rLineGeometry
.empty());
438 void PDFiumLibraryTest::testTools()
440 OUString sConverted
= vcl::pdf::convertPdfDateToISO8601("D:20200612201322+02'00");
442 css::util::DateTime aDateTime
;
443 CPPUNIT_ASSERT(utl::ISO8601parseDateTime(sConverted
, aDateTime
));
444 CPPUNIT_ASSERT_EQUAL(sal_Int16(2020), aDateTime
.Year
);
445 CPPUNIT_ASSERT_EQUAL(sal_uInt16(6), aDateTime
.Month
);
446 CPPUNIT_ASSERT_EQUAL(sal_uInt16(12), aDateTime
.Day
);
447 CPPUNIT_ASSERT_EQUAL(sal_uInt16(20), aDateTime
.Hours
);
448 CPPUNIT_ASSERT_EQUAL(sal_uInt16(13), aDateTime
.Minutes
);
449 CPPUNIT_ASSERT_EQUAL(sal_uInt16(22), aDateTime
.Seconds
);
450 CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), aDateTime
.NanoSeconds
);
451 CPPUNIT_ASSERT_EQUAL(false, bool(aDateTime
.IsUTC
));
454 CPPUNIT_TEST_SUITE_REGISTRATION(PDFiumLibraryTest
);
456 CPPUNIT_PLUGIN_IMPLEMENT();
460 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */