summaryrefslogtreecommitdiff
path: root/vcl/qa/cppunit/PDFiumLibraryTest.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/qa/cppunit/PDFiumLibraryTest.cxx')
-rw-r--r--vcl/qa/cppunit/PDFiumLibraryTest.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/PDFiumLibraryTest.cxx b/vcl/qa/cppunit/PDFiumLibraryTest.cxx
index c786b6edc211..61b3981731f6 100644
--- a/vcl/qa/cppunit/PDFiumLibraryTest.cxx
+++ b/vcl/qa/cppunit/PDFiumLibraryTest.cxx
@@ -16,6 +16,9 @@
#include <unotest/bootstrapfixturebase.hxx>
#include <unotest/directories.hxx>
+#include <unotools/datetime.hxx>
+
+#include <com/sun/star/util/DateTime.hpp>
#include <vcl/graph.hxx>
#include <vcl/graphicfilter.hxx>
@@ -34,12 +37,14 @@ class PDFiumLibraryTest : public test::BootstrapFixtureBase
void testPages();
void testAnnotationsMadeInEvince();
void testAnnotationsMadeInAcrobat();
+ void testTools();
CPPUNIT_TEST_SUITE(PDFiumLibraryTest);
CPPUNIT_TEST(testDocument);
CPPUNIT_TEST(testPages);
CPPUNIT_TEST(testAnnotationsMadeInEvince);
CPPUNIT_TEST(testAnnotationsMadeInAcrobat);
+ CPPUNIT_TEST(testTools);
CPPUNIT_TEST_SUITE_END();
};
@@ -144,6 +149,10 @@ void PDFiumLibraryTest::testAnnotationsMadeInEvince()
CPPUNIT_ASSERT_EQUAL(1, pPage->getAnnotationIndex(pPopupAnnotation));
CPPUNIT_ASSERT_EQUAL(16, pPopupAnnotation->getSubType());
+
+ OUString sDateTimeString
+ = pAnnotation->getString(vcl::pdf::constDictionaryKeyModificationDate);
+ CPPUNIT_ASSERT_EQUAL(OUString("D:20200612201322+02'00"), sDateTimeString);
}
{
@@ -231,6 +240,22 @@ void PDFiumLibraryTest::testAnnotationsMadeInAcrobat()
}
}
+void PDFiumLibraryTest::testTools()
+{
+ OUString sConverted = vcl::pdf::convertPdfDateToISO8601("D:20200612201322+02'00");
+
+ css::util::DateTime aDateTime;
+ CPPUNIT_ASSERT(utl::ISO8601parseDateTime(sConverted, aDateTime));
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(2020), aDateTime.Year);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(6), aDateTime.Month);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(12), aDateTime.Day);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(20), aDateTime.Hours);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(13), aDateTime.Minutes);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(22), aDateTime.Seconds);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), aDateTime.NanoSeconds);
+ CPPUNIT_ASSERT_EQUAL(false, bool(aDateTime.IsUTC));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(PDFiumLibraryTest);
CPPUNIT_PLUGIN_IMPLEMENT();