sc/qa/uitest/calc_tests4/exportToPDF.py | 10 ++++++---- sd/qa/uitest/impress_tests/exportToPDF.py | 14 ++++++++------ sw/Module_sw.mk | 2 +- sw/qa/core/text/itrform2.cxx | 4 ++++ sw/qa/uitest/writer_tests4/exportToPDF.py | 6 ++++-- 5 files changed, 23 insertions(+), 13 deletions(-)
New commits: commit 2b0e0a4ed65959371aee4183769b24356fdadb40 Author: Thorsten Behrens <thorsten.behr...@allotropia.de> AuthorDate: Wed Feb 19 10:43:32 2025 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Wed Feb 19 10:43:32 2025 +0100 Have unit tests ignore missing pdfimport/pdfium Some builds disable those features, let the tests pass regardless. Change-Id: I7433aad1e1eb43db56101fd37077475f63c02bfe diff --git a/sc/qa/uitest/calc_tests4/exportToPDF.py b/sc/qa/uitest/calc_tests4/exportToPDF.py index a635ee60a5d0..626e853be477 100644 --- a/sc/qa/uitest/calc_tests4/exportToPDF.py +++ b/sc/qa/uitest/calc_tests4/exportToPDF.py @@ -70,10 +70,12 @@ class exportToPDF(UITestCase): xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) - with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + # only run this if optional pdfimport service is available + if self.xContext.ServiceManager.createInstance("org.libreoffice.comp.documents.DrawPDFImport"): + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: - self.assertEqual("Sheet1", document.DrawPages[0][0].String) - self.assertEqual("Page 1", document.DrawPages[0][1].String) - self.assertEqual("Hello World", document.DrawPages[0][2].String) + self.assertEqual("Sheet1", document.DrawPages[0][0].String) + self.assertEqual("Page 1", document.DrawPages[0][1].String) + self.assertEqual("Hello World", document.DrawPages[0][2].String) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/exportToPDF.py b/sd/qa/uitest/impress_tests/exportToPDF.py index 429e28df4f0d..90d5d2bd9b08 100644 --- a/sd/qa/uitest/impress_tests/exportToPDF.py +++ b/sd/qa/uitest/impress_tests/exportToPDF.py @@ -72,11 +72,13 @@ class exportToPDF(UITestCase): xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) - with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: - - self.assertEqual("", document.DrawPages[0].getByIndex(0).String) - self.assertEqual(" ", document.DrawPages[0].getByIndex(1).String) - self.assertEqual(" ", document.DrawPages[0].getByIndex(2).String) - self.assertEqual("Hello World", document.DrawPages[0].getByIndex(3).String) + # only run this if optional pdfimport service is available + if self.xContext.ServiceManager.createInstance("org.libreoffice.comp.documents.DrawPDFImport"): + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + + self.assertEqual("", document.DrawPages[0].getByIndex(0).String) + self.assertEqual(" ", document.DrawPages[0].getByIndex(1).String) + self.assertEqual(" ", document.DrawPages[0].getByIndex(2).String) + self.assertEqual("Hello World", document.DrawPages[0].getByIndex(3).String) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index ab92e8d11571..be8b49bf2237 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -165,7 +165,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_filter_xml \ CppunitTest_sw_a11y \ CppunitTest_sw_core_theme \ - CppunitTest_sw_pdf_test \ + $(if $(ENABLE_PDFIMPORT),CppunitTest_sw_pdf_test) \ )) ifneq ($(DISABLE_GUI),TRUE) diff --git a/sw/qa/core/text/itrform2.cxx b/sw/qa/core/text/itrform2.cxx index c4fd1ac99dd8..fbd6e629c49e 100644 --- a/sw/qa/core/text/itrform2.cxx +++ b/sw/qa/core/text/itrform2.cxx @@ -128,6 +128,10 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlHeaderPDFExport) // Then make sure all the expected text is there on page 2: std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(); + + if (!pPdfDocument) + return; // no pdfium in this build + std::unique_ptr<vcl::pdf::PDFiumPage> pPage2 = pPdfDocument->openPage(1); int nTextCount = 0; for (int i = 0; i < pPage2->getObjectCount(); ++i) diff --git a/sw/qa/uitest/writer_tests4/exportToPDF.py b/sw/qa/uitest/writer_tests4/exportToPDF.py index ef628d4eea68..e8c02ce49ffa 100644 --- a/sw/qa/uitest/writer_tests4/exportToPDF.py +++ b/sw/qa/uitest/writer_tests4/exportToPDF.py @@ -68,8 +68,10 @@ class exportToPDF(UITestCase): xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) - with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + # only run this if optional pdfimport service is available + if self.xContext.ServiceManager.createInstance("org.libreoffice.comp.documents.DrawPDFImport"): + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: - self.assertEqual("Hello World", document.DrawPages[0].getByIndex(0).String) + self.assertEqual("Hello World", document.DrawPages[0].getByIndex(0).String) # vim: set shiftwidth=4 softtabstop=4 expandtab: