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

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Sun Oct 4 06:39:51 UTC 2020


 vcl/qa/cppunit/PDFiumLibraryTest.cxx                         |   45 ++++++++++-
 vcl/qa/cppunit/data/PangramWithMultipleTypeOfAnnotations.pdf |binary
 2 files changed, 44 insertions(+), 1 deletion(-)

New commits:
commit 9f9dec0679da48e49af09d8fa609955bca6db67b
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Sep 29 11:49:58 2020 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sun Oct 4 08:39:08 2020 +0200

    pdfium: extend the PDF test with more types of annotations
    
    Change-Id: I6faef0b6712e172abf090f5d16974dfd91747fae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103884
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/qa/cppunit/PDFiumLibraryTest.cxx b/vcl/qa/cppunit/PDFiumLibraryTest.cxx
index dd18d9809b8d..547c59872216 100644
--- a/vcl/qa/cppunit/PDFiumLibraryTest.cxx
+++ b/vcl/qa/cppunit/PDFiumLibraryTest.cxx
@@ -316,18 +316,61 @@ void PDFiumLibraryTest::testAnnotationsDifferentTypes()
     auto pPage = pDocument->openPage(0);
     CPPUNIT_ASSERT(pPage);
 
-    CPPUNIT_ASSERT_EQUAL(2, pPage->getAnnotationCount());
+    CPPUNIT_ASSERT_EQUAL(6, pPage->getAnnotationCount());
 
     {
         auto pAnnotation = pPage->getAnnotation(0);
         CPPUNIT_ASSERT(pAnnotation);
         CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::FreeText, pAnnotation->getSubType());
+        CPPUNIT_ASSERT_EQUAL(0, pAnnotation->getObjectCount());
+        OUString aContentsString = pAnnotation->getString(vcl::pdf::constDictionaryKeyContents);
+        CPPUNIT_ASSERT_EQUAL(OUString("Inline Note"), aContentsString);
     }
 
     {
         auto pAnnotation = pPage->getAnnotation(1);
         CPPUNIT_ASSERT(pAnnotation);
+        CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Ink, pAnnotation->getSubType());
+        CPPUNIT_ASSERT_EQUAL(0, pAnnotation->getObjectCount());
+        OUString aContentsString = pAnnotation->getString(vcl::pdf::constDictionaryKeyContents);
+        CPPUNIT_ASSERT_EQUAL(OUString("Freehand Text"), aContentsString);
+    }
+
+    {
+        auto pAnnotation = pPage->getAnnotation(2);
+        CPPUNIT_ASSERT(pAnnotation);
         CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Line, pAnnotation->getSubType());
+        CPPUNIT_ASSERT_EQUAL(0, pAnnotation->getObjectCount());
+        OUString aContentsString = pAnnotation->getString(vcl::pdf::constDictionaryKeyContents);
+        CPPUNIT_ASSERT_EQUAL(OUString("Line Text"), aContentsString);
+    }
+
+    {
+        auto pAnnotation = pPage->getAnnotation(3);
+        CPPUNIT_ASSERT(pAnnotation);
+        CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Polygon, pAnnotation->getSubType());
+        CPPUNIT_ASSERT_EQUAL(0, pAnnotation->getObjectCount());
+        CPPUNIT_ASSERT_EQUAL(true, pAnnotation->hasKey("Vertices"));
+        OUString aContentsString = pAnnotation->getString(vcl::pdf::constDictionaryKeyContents);
+        CPPUNIT_ASSERT_EQUAL(OUString("Polygon Text"), aContentsString);
+    }
+
+    {
+        auto pAnnotation = pPage->getAnnotation(4);
+        CPPUNIT_ASSERT(pAnnotation);
+        CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Circle, pAnnotation->getSubType());
+        CPPUNIT_ASSERT_EQUAL(0, pAnnotation->getObjectCount());
+        OUString aContentsString = pAnnotation->getString(vcl::pdf::constDictionaryKeyContents);
+        CPPUNIT_ASSERT_EQUAL(OUString("Ellipse Text"), aContentsString);
+    }
+
+    {
+        auto pAnnotation = pPage->getAnnotation(5);
+        CPPUNIT_ASSERT(pAnnotation);
+        CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Square, pAnnotation->getSubType());
+        CPPUNIT_ASSERT_EQUAL(0, pAnnotation->getObjectCount());
+        OUString aContentsString = pAnnotation->getString(vcl::pdf::constDictionaryKeyContents);
+        CPPUNIT_ASSERT_EQUAL(OUString("Rectangle Text"), aContentsString);
     }
 }
 
diff --git a/vcl/qa/cppunit/data/PangramWithMultipleTypeOfAnnotations.pdf b/vcl/qa/cppunit/data/PangramWithMultipleTypeOfAnnotations.pdf
index 281cf264a6ee..68037d0a2d39 100644
Binary files a/vcl/qa/cppunit/data/PangramWithMultipleTypeOfAnnotations.pdf and b/vcl/qa/cppunit/data/PangramWithMultipleTypeOfAnnotations.pdf differ


More information about the Libreoffice-commits mailing list