summaryrefslogtreecommitdiff
path: root/qt5
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2019-04-28 19:25:08 +0200
committerAlbert Astals Cid <aacid@kde.org>2019-04-28 19:25:08 +0200
commit0d0630cd6f10d0586172b740290056620fe56b21 (patch)
tree178b14312f9b1ce9677de1971374d74c6398e2c4 /qt5
parentb49d16a47388e03aa1a56ba64a47751aa993e06a (diff)
qt5: Fix regression in annotation handling
Diffstat (limited to 'qt5')
-rw-r--r--qt5/src/poppler-annotation.cc2
-rw-r--r--qt5/tests/check_annotations.cpp18
2 files changed, 19 insertions, 1 deletions
diff --git a/qt5/src/poppler-annotation.cc b/qt5/src/poppler-annotation.cc
index 207d6ca4..c2798408 100644
--- a/qt5/src/poppler-annotation.cc
+++ b/qt5/src/poppler-annotation.cc
@@ -412,7 +412,7 @@ QList<Annotation*> AnnotationPrivate::findAnnotations(::Page *pdfPage, DocumentD
if (!markupann)
{
// Assume it's a root annotation, and skip if user didn't request it
- if (parentID != 0)
+ if (parentID != -1)
continue;
}
else if (markupann->getInReplyToID() != parentID)
diff --git a/qt5/tests/check_annotations.cpp b/qt5/tests/check_annotations.cpp
index 1145ceec..20b33f21 100644
--- a/qt5/tests/check_annotations.cpp
+++ b/qt5/tests/check_annotations.cpp
@@ -20,6 +20,7 @@ private slots:
void checkFontSizeAndColor();
void checkHighlightFromAndToQuads();
void checkUTF16LEAnnot();
+ void checkNonMarkupAnnotations();
};
/* Is .5f sufficient for 16 bit color channel roundtrip trough save and load on all architectures? */
@@ -155,6 +156,23 @@ void TestAnnotations::checkUTF16LEAnnot()
QCOMPARE(annot->contents(), QString::fromUtf8("Únîcödé豰")); //clazy:exclude=qstring-allocations
}
+void TestAnnotations::checkNonMarkupAnnotations()
+{
+ std::unique_ptr<Poppler::Document> doc{
+ Poppler::Document::load(TESTDATADIR "/unittestcases/checkbox_issue_159.pdf")
+ };
+ QVERIFY(doc.get());
+
+ std::unique_ptr<Poppler::Page> page{
+ doc->page(0)
+ };
+ QVERIFY(page.get());
+
+ auto annots = page->annotations();
+ QCOMPARE(annots.size(), 17);
+}
+
+
QTEST_GUILESS_MAIN(TestAnnotations)
#include "check_annotations.moc"