[Libreoffice-commits] core.git: sd/qa

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 6 12:04:19 UTC 2020


 sd/qa/unit/SdrPdfImportTest.cxx |   29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

New commits:
commit 9ec80bc7dc33cf9b3119d8bd72cbd0852fbc1ad6
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Sep 3 14:24:02 2020 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sun Sep 6 14:03:39 2020 +0200

    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 at gmail.com>

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


More information about the Libreoffice-commits mailing list