Commit 84c52530 authored by Albert Astals Cid's avatar Albert Astals Cid Committed by Albert Astals Cid

Fix regression in URI link handling

parent b3cfbbf2
......@@ -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] == ':') {
......
......@@ -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"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment