[Libreoffice-commits] core.git: 3 commits - sdext/Executable_pdf2xml.mk sdext/Executable_pdfunzip.mk sdext/source

Thorsten Behrens tbehrens at suse.com
Mon Apr 29 15:40:32 PDT 2013


 sdext/Executable_pdf2xml.mk             |    2 +
 sdext/Executable_pdfunzip.mk            |    4 ---
 sdext/source/pdfimport/test/pdf2xml.cxx |   38 +++++++++-----------------------
 sdext/source/pdfimport/test/tests.cxx   |    6 ++++-
 4 files changed, 18 insertions(+), 32 deletions(-)

New commits:
commit 298c52a61d7c70c1f0fd042767ac9dfad52af175
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Tue Apr 30 00:34:49 2013 +0200

    pdfunzip rather needs ~no office libraries.
    
    Change-Id: I27df97ab6e35b03dfe70c7a979dd06f977086069

diff --git a/sdext/Executable_pdfunzip.mk b/sdext/Executable_pdfunzip.mk
index 2f20685..ec94503 100644
--- a/sdext/Executable_pdfunzip.mk
+++ b/sdext/Executable_pdfunzip.mk
@@ -22,10 +22,6 @@ $(eval $(call gb_Executable_set_include,pdfunzip,\
 ))
 
 $(eval $(call gb_Executable_use_libraries,pdfunzip,\
-    basegfx \
-    vcl \
-    cppu \
-    cppuhelper \
     sal \
 ))
 
commit b0da8f00a0d41f2b17639fcee4ed4956421e55c5
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Tue Apr 30 00:33:23 2013 +0200

    Make pdf2xml usable at least from within buildenv again.
    
    Seems this had bitrotted quite a lot. Calling it now like a cppunit
    test works again.
    
    Change-Id: I27479c3c3e1c1fe0639629e9bf8844456e0b0515

diff --git a/sdext/Executable_pdf2xml.mk b/sdext/Executable_pdf2xml.mk
index 6cd93a0..38a591d 100644
--- a/sdext/Executable_pdf2xml.mk
+++ b/sdext/Executable_pdf2xml.mk
@@ -26,6 +26,8 @@ $(eval $(call gb_Executable_use_libraries,pdf2xml,\
     vcl \
     comphelper \
     cppu \
+    unotest \
+    test \
     cppuhelper \
     sal \
 ))
diff --git a/sdext/source/pdfimport/test/pdf2xml.cxx b/sdext/source/pdfimport/test/pdf2xml.cxx
index d18bfa0..666781b 100644
--- a/sdext/source/pdfimport/test/pdf2xml.cxx
+++ b/sdext/source/pdfimport/test/pdf2xml.cxx
@@ -27,17 +27,16 @@
 
 #include <sal/main.h>
 #include <osl/process.h>
-#include <rtl/bootstrap.hxx>
-
-#include <cppuhelper/bootstrap.hxx>
+#include <unotest/bootstrapfixturebase.hxx>
 #include <comphelper/processfactory.hxx>
+#include <cppuhelper/bootstrap.hxx>
 
 using namespace ::pdfi;
 using namespace ::com::sun::star;
 
 SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
 {
-    if( argc != 5 )
+    if( argc < 4 )
         return 1;
 
     OUString aBaseURL, aTmpURL, aSrcURL, aDstURL, aIniUrl;
@@ -61,32 +60,17 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
                                   &aTmpURL.pData );
     osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aDstURL.pData);
 
-    osl_getFileURLFromSystemPath( OUString::createFromAscii(argv[4]).pData,
-                                &aTmpURL.pData );
-    osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aIniUrl.pData);
-
     // bootstrap UNO
-    uno::Reference< lang::XMultiServiceFactory > xFactory;
-    uno::Reference< uno::XComponentContext > xCtx;
-    try
-    {
-        xCtx = ::cppu::defaultBootstrap_InitialComponentContext(aIniUrl);
-        xFactory = uno::Reference< lang::XMultiServiceFactory >(  xCtx->getServiceManager(),
-                                                                  uno::UNO_QUERY );
-        if( xFactory.is() )
-            ::comphelper::setProcessServiceFactory( xFactory );
-    }
-    catch( uno::Exception& )
-    {
-    }
+    uno::Reference< uno::XComponentContext > xContext(
+        cppu::defaultBootstrap_InitialComponentContext() );
+    uno::Reference<lang::XMultiComponentFactory> xFactory(xContext->getServiceManager());
+    uno::Reference<lang::XMultiServiceFactory> xSM(xFactory, uno::UNO_QUERY_THROW);
+    comphelper::setProcessServiceFactory(xSM);
 
-    if( !xFactory.is() )
-    {
-        OSL_TRACE( "Could not bootstrap UNO, installation must be in disorder. Exiting." );
-        return 1;
-    }
+    test::BootstrapFixtureBase aEnv;
+    aEnv.setUp();
 
-    pdfi::PDFIRawAdaptor aAdaptor( xCtx );
+    pdfi::PDFIRawAdaptor aAdaptor( aEnv.getComponentContext() );
     aAdaptor.setTreeVisitorFactory(pTreeFactory);
     aAdaptor.odfConvert( aSrcURL, new OutputWrap(aDstURL), NULL );
 
commit bfffa6d7cee18d0814bc38f1d053a0d0b27f972c
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Tue Apr 30 00:31:58 2013 +0200

    Add unit test for pdfimport image import.
    
    Change-Id: Ifd51f0c25418085ba8a6e8d331ac5c6d8139d18a

diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx
index ec36810..a90010f 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -82,7 +82,8 @@ namespace
             m_bPageEnded(false),
             m_bRedCircleSeen(false),
             m_bGreenStrokeSeen(false),
-            m_bDashedLineSeen(false)
+            m_bDashedLineSeen(false),
+            m_bImageSeen(false)
         {}
 
         ~TestSink()
@@ -111,6 +112,7 @@ namespace
             CPPUNIT_ASSERT_MESSAGE( "red circle seen in input", m_bRedCircleSeen );
             CPPUNIT_ASSERT_MESSAGE( "green stroke seen in input", m_bGreenStrokeSeen );
             CPPUNIT_ASSERT_MESSAGE( "dashed line seen in input", m_bDashedLineSeen );
+            CPPUNIT_ASSERT_MESSAGE( "image seen in input", m_bImageSeen );
         }
 
     private:
@@ -377,6 +379,7 @@ namespace
                                     xBitmap[0].Name.compareToAscii( "URL" ) == 0 );
             CPPUNIT_ASSERT_MESSAGE( "drawImage got InputStream param",
                                     xBitmap[1].Name.compareToAscii( "InputStream" ) == 0 );
+            m_bImageSeen = true;
         }
 
         virtual void drawColorMaskedImage(const uno::Sequence<beans::PropertyValue>& xBitmap,
@@ -450,6 +453,7 @@ namespace
         bool                      m_bRedCircleSeen;
         bool                      m_bGreenStrokeSeen;
         bool                      m_bDashedLineSeen;
+        bool                      m_bImageSeen;
     };
 
     class PDFITest : public test::BootstrapFixture


More information about the Libreoffice-commits mailing list