summaryrefslogtreecommitdiff
path: root/vcl/qa
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-09-29 11:49:58 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-10-04 08:39:08 +0200
commit9f9dec0679da48e49af09d8fa609955bca6db67b (patch)
treec0d8392cf69002e523a3db1ba4e57c7e2b882191 /vcl/qa
parentd30d41b36118ccfa473fab1e82c94c016e3a3f21 (diff)
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@gmail.com>
Diffstat (limited to 'vcl/qa')
-rw-r--r--vcl/qa/cppunit/PDFiumLibraryTest.cxx45
-rw-r--r--vcl/qa/cppunit/data/PangramWithMultipleTypeOfAnnotations.pdfbin19532 -> 23143 bytes
2 files changed, 44 insertions, 1 deletions
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
--- a/vcl/qa/cppunit/data/PangramWithMultipleTypeOfAnnotations.pdf
+++ b/vcl/qa/cppunit/data/PangramWithMultipleTypeOfAnnotations.pdf
Binary files differ