From af7b619f2752fcac3492c53444e836371efbd5fe Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Sun, 28 Jun 2020 13:46:41 +0200 Subject: pdf: add text page object attribs, refactor ImpSdrPdfImport, tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This refactors ImpSdrPdfImport to push more functions into the PDFium wrapper. The focus is on text page object attributes. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97366 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit 4e9b03d04f740a0cbafa22a4f3cedfae7f37a994) Change-Id: Ie1faf5e3743eec7c77050835651533f9e227c2a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97451 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl --- sd/qa/unit/SdrPdfImportTest.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sd') diff --git a/sd/qa/unit/SdrPdfImportTest.cxx b/sd/qa/unit/SdrPdfImportTest.cxx index ca022d585c48..2ac548bb6c85 100644 --- a/sd/qa/unit/SdrPdfImportTest.cxx +++ b/sd/qa/unit/SdrPdfImportTest.cxx @@ -89,6 +89,9 @@ CPPUNIT_TEST_FIXTURE(SdrPdfImportTest, testImportSimpleText) SdPage* pPage = pViewShell->GetActualPage(); CPPUNIT_ASSERT(pPage); + // Check there is one object on the page only + CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount()); + // Get the first object - there should be only one. SdrObject* pObject = pPage->GetObj(0); CPPUNIT_ASSERT(pObject); @@ -110,11 +113,17 @@ CPPUNIT_TEST_FIXTURE(SdrPdfImportTest, testImportSimpleText) // Execute the break operation - to turn the PDF into shapes/objects pViewShell->GetDrawView()->DoImportMarkedMtf(); - // Check Objects after import + // Check there is one object on the page only + CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount()); + // Get the object SdrObject* pImportedObject = pPage->GetObj(0); CPPUNIT_ASSERT(pImportedObject); + // Check the object position + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(2011, 2098), Size(2106 + 1, 302 + 1)), + pImportedObject->GetLogicRect()); + // Object should be a text object containing one paragraph with // content "This is PDF!" -- cgit