[poppler] poppler/Link.cc qt5/tests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Mar 1 19:43:22 UTC 2020


 poppler/Link.cc           |    1 +
 qt5/tests/check_links.cpp |   23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)

New commits:
commit 84c52530992f28fc0623747ee505baad7a9bb287
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Mar 1 19:08:02 2020 +0100

    Fix regression in URI link handling

diff --git a/poppler/Link.cc b/poppler/Link.cc
index c9945ce8..790c41ab 100644
--- a/poppler/Link.cc
+++ b/poppler/Link.cc
@@ -519,6 +519,7 @@ LinkLaunch::LinkLaunch(const Object *actionObj) {
 LinkURI::LinkURI(const Object *uriObj, const GooString *baseURI) {
   hasURIFlag = false;
   if (uriObj->isString()) {
+    hasURIFlag = true;
     const std::string& uri2 = uriObj->getString()->toStr();
     size_t n = strcspn(uri2.c_str(), "/:");
     if (n < uri2.size() && uri2[n] == ':') {
diff --git a/qt5/tests/check_links.cpp b/qt5/tests/check_links.cpp
index 5927d623..0ec7ddbb 100644
--- a/qt5/tests/check_links.cpp
+++ b/qt5/tests/check_links.cpp
@@ -13,6 +13,7 @@ private slots:
     void checkDocumentWithNoDests();
     void checkDests_xr01();
     void checkDests_xr02();
+    void checkDocumentURILink();
 };
 
 static bool isDestinationValid_pageNumber( const Poppler::LinkDestination *dest, const Poppler::Document *doc )
@@ -95,6 +96,28 @@ void TestLinks::checkDests_xr02()
     delete doc;
 }
 
+void TestLinks::checkDocumentURILink()
+{
+    Poppler::Document *doc;
+    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/checkbox_issue_159.pdf");
+    QVERIFY( doc );
+
+    Poppler::Page *page = doc->page(0);
+    QVERIFY( page );
+
+    QList< Poppler::Link* > links = page->links();
+    QCOMPARE( links.count(), 1 );
+
+    QCOMPARE( links.at(0)->linkType(), Poppler::Link::Browse );
+    Poppler::LinkBrowse *link = static_cast< Poppler::LinkBrowse * >( links.at(0) );
+    QCOMPARE( link->url(), QLatin1String("http://www.tcpdf.org") );
+
+    qDeleteAll(links);
+    delete page;
+    delete doc;
+}
+
+
 QTEST_GUILESS_MAIN(TestLinks)
 
 #include "check_links.moc"


More information about the poppler mailing list