summaryrefslogtreecommitdiff
path: root/vcl/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-12-17 21:07:41 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-12-18 09:08:19 +0100
commite987a050260ad4c8f6c3487e57bec1c8b680c65e (patch)
tree2f4a1e60bdf02e35a59285655f40e79b8d7320eb /vcl/qa
parent177792660697f85763b39f455d7ebff0f83084fd (diff)
pdfium: add PDFiumPage::hasLinks() wrapper
Reduces the amount of raw pdfium includes in CppunitTest_vcl_pdfexport. Change-Id: I61bcc7ef11932cc5129be8123dba0e8b06e8f324 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107925 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'vcl/qa')
-rw-r--r--vcl/qa/cppunit/pdfexport/pdfexport.cxx22
1 files changed, 5 insertions, 17 deletions
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 69b7d17711a2..61debc5ed5ec 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -35,9 +35,6 @@
#include <unotools/tempfile.hxx>
#include <vcl/filter/pdfdocument.hxx>
#include <tools/zcodec.hxx>
-#include <fpdf_edit.h>
-#include <fpdf_text.h>
-#include <fpdf_doc.h>
#include <fpdf_annot.h>
#include <fpdfview.h>
#include <vcl/graphicfilter.hxx>
@@ -1803,11 +1800,9 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTocLink)
CPPUNIT_ASSERT(pPdfPage);
// Ensure there is a link on the first page (in the ToC).
- int nStartPos = 0;
- FPDF_LINK pLinkAnnot = nullptr;
- // Without the accompanying fix in place, this test would have failed, as FPDFLink_Enumerate()
- // returned false, as the page contained no links.
- CPPUNIT_ASSERT(FPDFLink_Enumerate(pPdfPage->getPointer(), &nStartPos, &pLinkAnnot));
+ // Without the accompanying fix in place, this test would have failed, as the page contained no
+ // links.
+ CPPUNIT_ASSERT(pPdfPage->hasLinks());
}
CPPUNIT_TEST_FIXTURE(PdfExportTest, testReduceSmallImage)
@@ -1904,13 +1899,6 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testReduceImage)
CPPUNIT_ASSERT_EQUAL(160, nHeight);
}
-bool HasLinksOnPage(std::unique_ptr<vcl::pdf::PDFiumPage>& pPdfPage)
-{
- int nStartPos = 0;
- FPDF_LINK pLinkAnnot = nullptr;
- return FPDFLink_Enumerate(pPdfPage->getPointer(), &nStartPos, &pLinkAnnot);
-}
-
CPPUNIT_TEST_FIXTURE(PdfExportTest, testLinkWrongPage)
{
// Import the bugdoc and export as PDF.
@@ -1928,12 +1916,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testLinkWrongPage)
// Without the accompanying fix in place, this test would have failed, as the link of the first
// page went to the second page due to the hidden first slide.
- CPPUNIT_ASSERT(HasLinksOnPage(pPdfPage));
+ CPPUNIT_ASSERT(pPdfPage->hasLinks());
// Second page should have no links (3rd slide).
std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage2 = pPdfDocument->openPage(/*nIndex=*/1);
CPPUNIT_ASSERT(pPdfPage2);
- CPPUNIT_ASSERT(!HasLinksOnPage(pPdfPage2));
+ CPPUNIT_ASSERT(!pPdfPage2->hasLinks());
}
CPPUNIT_TEST_FIXTURE(PdfExportTest, testLargePage)