summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-09-03 14:24:02 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-09-06 14:03:39 +0200
commit9ec80bc7dc33cf9b3119d8bd72cbd0852fbc1ad6 (patch)
treed389a60e1f175fd0f39e9fbf00553d4bdb6ebaa1 /sd
parent6d275917944c274a22620c2c19880eb8e94f2558 (diff)
sd: add additional asserts for testAnnotationsImportExport
Change-Id: I45824c4023c56b466560638a1fe5206bddaf74be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102092 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/SdrPdfImportTest.cxx29
1 files changed, 28 insertions, 1 deletions
diff --git a/sd/qa/unit/SdrPdfImportTest.cxx b/sd/qa/unit/SdrPdfImportTest.cxx
index 50e7d233877d..3125663d1908 100644
--- a/sd/qa/unit/SdrPdfImportTest.cxx
+++ b/sd/qa/unit/SdrPdfImportTest.cxx
@@ -261,7 +261,34 @@ CPPUNIT_TEST_FIXTURE(SdrPdfImportTest, testAnnotationsImportExport)
SdPage* pPage = pNewViewShell->GetActualPage();
CPPUNIT_ASSERT(pPage);
- CPPUNIT_ASSERT(!pPage->getAnnotations().empty());
+ // We expect only 1 annotation in the document because the PDF
+ // annotations are dependent on each-other:
+ // parent annotation "Text" and the child annotation "Pop-up"
+
+ CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->getAnnotations().size());
+
+ // check annotation
+ auto xAnnotation = pPage->getAnnotations().at(0);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(90.33, xAnnotation->getPosition().X, 1E-3);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(12.07, xAnnotation->getPosition().Y, 1E-3);
+
+ CPPUNIT_ASSERT_EQUAL(OUString("TheAuthor"), xAnnotation->getAuthor());
+ CPPUNIT_ASSERT_EQUAL(OUString(), xAnnotation->getInitials());
+
+ auto xText = xAnnotation->getTextRange();
+
+ CPPUNIT_ASSERT_EQUAL(OUString("This is the annotation text!"), xText->getString());
+
+ auto aDateTime = xAnnotation->getDateTime();
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(2020), aDateTime.Year);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(6), aDateTime.Month);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(18), aDateTime.Day);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(12), aDateTime.Hours);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(11), aDateTime.Minutes);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(53), aDateTime.Seconds);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), aDateTime.NanoSeconds);
+ CPPUNIT_ASSERT_EQUAL(false, bool(aDateTime.IsUTC));
}
#endif // HAVE_FEATURE_PDFIUM