[Libreoffice-commits] core.git: sw/qa

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 24 12:37:53 UTC 2021


 sw/qa/extras/odfexport/odfexport.cxx |   10 +++++++---
 sw/qa/extras/uiwriter/uiwriter.cxx   |   13 +++++++------
 2 files changed, 14 insertions(+), 9 deletions(-)

New commits:
commit 07db9f59c00da0cc0bc8a09b7e41d9d5242b7269
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Mar 23 20:54:50 2021 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Mar 24 13:37:11 2021 +0100

    sw: clean up not needed HAVE_FEATURE_PDFIUM ifdefs
    
    Towards completely avoiding the HAVE_FEATURE_PDFIUM ifdef forest.
    
    Change-Id: I0bbeeda32b61669429ad12f51d4ce0e8603e4822
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113010
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 285da20616e0..357557828091 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -10,7 +10,6 @@
 #include <algorithm>
 #include <memory>
 #include <swmodeltestbase.hxx>
-#include <config_features.h>
 
 #include <com/sun/star/awt/FontSlant.hpp>
 #include <com/sun/star/awt/Gradient.hpp>
@@ -50,6 +49,7 @@
 #include <unotools/streamwrap.hxx>
 #include <svl/PasswordHelper.hxx>
 #include <comphelper/sequenceashashmap.hxx>
+#include <vcl/filter/PDFiumLibrary.hxx>
 
 #include <docufld.hxx> // for SwHiddenTextField::ParseIfFieldDefinition() method call
 #include <unoprnms.hxx>
@@ -1899,9 +1899,14 @@ DECLARE_ODFEXPORT_TEST(testCellUserDefineAttr, "userdefattr-tablecell.odt")
     getUserDefineAttribute(uno::makeAny(xCellC1), "proName", "v3");
 }
 
-#if HAVE_FEATURE_PDFIUM
 DECLARE_ODFEXPORT_TEST(testEmbeddedPdf, "embedded-pdf.odt")
 {
+    auto pPdfium = vcl::pdf::PDFiumLibrary::get();
+    if (!pPdfium)
+    {
+        return;
+    }
+
     CPPUNIT_ASSERT_EQUAL(1, getShapes());
     CPPUNIT_ASSERT_EQUAL(1, getPages());
     uno::Reference<drawing::XShape> xShape = getShape(1);
@@ -1933,7 +1938,6 @@ DECLARE_ODFEXPORT_TEST(testEmbeddedPdf, "embedded-pdf.odt")
         CPPUNIT_ASSERT(bHasBitmap);
     }
 }
-#endif
 
 DECLARE_ODFEXPORT_TEST(testTableStyles1, "table_styles_1.odt")
 {
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index dae657a35088..e47594a27b42 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -55,6 +55,7 @@
 #include <svl/itemiter.hxx>
 #include <svx/svxids.hrc>
 #include <unotools/localfilehelper.hxx>
+#include <vcl/filter/PDFiumLibrary.hxx>
 
 #include <editeng/eeitem.hxx>
 #include <editeng/scripttypeitem.hxx>
@@ -400,9 +401,7 @@ public:
     void testRedlineAutoCorrect();
     void testRedlineAutoCorrect2();
     void testEmojiAutoCorrect();
-#if HAVE_FEATURE_PDFIUM
     void testInsertPdf();
-#endif
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -633,9 +632,7 @@ public:
     CPPUNIT_TEST(testRedlineAutoCorrect);
     CPPUNIT_TEST(testRedlineAutoCorrect2);
     CPPUNIT_TEST(testEmojiAutoCorrect);
-#if HAVE_FEATURE_PDFIUM
     CPPUNIT_TEST(testInsertPdf);
-#endif
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -8079,9 +8076,14 @@ void SwUiWriterTest::testInsertLongDateFormat()
     CPPUNIT_ASSERT(xField->getString().indexOf(" ") > -1);
 }
 
-#if HAVE_FEATURE_PDFIUM
 void SwUiWriterTest::testInsertPdf()
 {
+    auto pPdfium = vcl::pdf::PDFiumLibrary::get();
+    if (!pPdfium)
+    {
+        return;
+    }
+
     createDoc();
     SwXTextDocument *pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
@@ -8109,7 +8111,6 @@ void SwUiWriterTest::testInsertPdf()
     // Assert that the graphic is a PDF
     CPPUNIT_ASSERT_EQUAL(OUString("application/pdf"), getProperty<OUString>(xGraphic, "MimeType"));
 }
-#endif
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list