sdext/CppunitTest_pdfimport.mk | 90 ++++++++++++++++++ sdext/Module_sdext.mk | 4 sdext/source/minimizer/delzip | 1 sdext/source/minimizer/minimizer.pmk | 28 ----- sdext/source/pdfimport/delzip | 1 sdext/source/pdfimport/pdfisettings.pmk | 28 ----- sdext/source/pdfimport/test/makefile.mk | 141 ----------------------------- sdext/source/pdfimport/test/tests.cxx | 101 ++++++++++++++++++++ sdext/source/pdfimport/wrapper/wrapper.cxx | 4 sdext/source/presenter/delzip | 1 10 files changed, 193 insertions(+), 206 deletions(-)
New commits: commit 5d44d9fec3aa594e1990e3000fd7c1e2e365a469 Author: David Tardon <[email protected]> Date: Sat Feb 25 19:15:09 2012 +0100 the passed string is already quoted diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 807bcdd..27d8567 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -63,7 +63,6 @@ #include "basegfx/tools/unopolypolygon.hxx" #include <boost/bind.hpp> -#include <boost/preprocessor/stringize.hpp> #include <boost/scoped_ptr.hpp> #include <boost/scoped_array.hpp> @@ -1017,8 +1016,7 @@ bool xpdf_ImportFromFile( const ::rtl::OUString& rUR converterURL.insert( 0, xProvider->getPackageLocation( - rtl::OUString::createFromAscii( - BOOST_PP_STRINGIZE(PDFI_IMPL_IDENTIFIER)))); + rtl::OUString::createFromAscii(PDFI_IMPL_IDENTIFIER))); } // spawn separate process to keep LGPL/GPL code apart. commit 3acc9127ffa86c90f8916f1d80e5f4b924719692 Author: David Tardon <[email protected]> Date: Sat Feb 25 17:18:50 2012 +0100 remove leftover makefiles diff --git a/sdext/source/minimizer/delzip b/sdext/source/minimizer/delzip deleted file mode 100644 index 8b13789..0000000 --- a/sdext/source/minimizer/delzip +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sdext/source/minimizer/minimizer.pmk b/sdext/source/minimizer/minimizer.pmk deleted file mode 100644 index f832f2d..0000000 --- a/sdext/source/minimizer/minimizer.pmk +++ /dev/null @@ -1,28 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -EXTENSIONNAME:=PresentationMinimizer diff --git a/sdext/source/pdfimport/delzip b/sdext/source/pdfimport/delzip deleted file mode 100644 index e16c76d..0000000 --- a/sdext/source/pdfimport/delzip +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/sdext/source/pdfimport/pdfisettings.pmk b/sdext/source/pdfimport/pdfisettings.pmk deleted file mode 100644 index b0f6ae4..0000000 --- a/sdext/source/pdfimport/pdfisettings.pmk +++ /dev/null @@ -1,28 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -IMPLEMENTATION_IDENTIFIER="com.sun.star.PDFImport-$(PLATFORMID)" diff --git a/sdext/source/presenter/delzip b/sdext/source/presenter/delzip deleted file mode 100644 index 636fda9..0000000 --- a/sdext/source/presenter/delzip +++ /dev/null @@ -1 +0,0 @@ -ECHO is OFF commit 718a58dc46adbb8d26c0fdcabf7955c3d7f8146f Author: David Tardon <[email protected]> Date: Sat Feb 25 13:43:14 2012 +0100 convert pdfimport test diff --git a/sdext/CppunitTest_pdfimport.mk b/sdext/CppunitTest_pdfimport.mk new file mode 100644 index 0000000..bbda2d5 --- /dev/null +++ b/sdext/CppunitTest_pdfimport.mk @@ -0,0 +1,90 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License or as specified alternatively below. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# Major Contributor(s): +# Copyright (C) 2012 Red Hat, Inc., David Tardon <[email protected]> +# (initial developer) +# +# All Rights Reserved. +# +# For minor contributions see the git repository. +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + +$(eval $(call gb_CppunitTest_CppunitTest,sdext_pdfimport)) + +$(eval $(call gb_CppunitTest_add_defs,sdext_pdfimport,\ + -DPDFIMPORT_EXECUTABLE_LOCATION=\"file://$(dir $(call gb_Executable_get_target,xpdfimport))\" \ +)) + +$(eval $(call gb_CppunitTest_add_api,sdext_pdfimport,\ + offapi \ + udkapi \ +)) + +$(eval $(call gb_CppunitTest_set_include,sdext_pdfimport,\ + -I$(SRCDIR)/sdext/source/pdfimport/inc \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_externals,sdext_pdfimport,\ + zlib \ +)) + +$(eval $(call gb_CppunitTest_add_linked_libs,sdext_pdfimport,\ + comphelper \ + cppu \ + cppuhelper \ + sal \ + test \ + unotest \ + $(gb_STDLIBS) \ +)) + +$(eval $(call gb_CppunitTest_add_linked_static_libs,sdext_pdfimport,\ + basegfx_s \ +)) + +$(eval $(call gb_CppunitTest_add_library_objects,sdext_pdfimport,\ + pdfimport \ +)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sdext_pdfimport,\ + sdext/source/pdfimport/test/tests \ +)) + +$(eval $(call gb_CppunitTest_uses_ure,sdext_pdfimport)) + +$(eval $(call gb_CppunitTest_add_type_rdbs,sdext_pdfimport,\ + types \ +)) + +$(eval $(call gb_CppunitTest_add_components,sdext_pdfimport,\ + comphelper/util/comphelp \ + configmgr/source/configmgr \ + i18npool/util/i18npool \ + ucb/source/core/ucb1 \ + ucb/source/ucp/file/ucpfile1 \ +)) + +$(eval $(call gb_CppunitTest_set_args,sdext_pdfimport,\ + --headless \ + --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ + "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry)" \ +)) + +# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sdext/Module_sdext.mk b/sdext/Module_sdext.mk index a8fef26..8f49690 100644 --- a/sdext/Module_sdext.mk +++ b/sdext/Module_sdext.mk @@ -45,6 +45,10 @@ $(eval $(call gb_Module_add_targets,sdext,\ Library_pdfimport \ Package_pdfimport_keywords \ )) + +$(eval $(call gb_Module_add_check_targets,sdext,\ + CppunitTest_pdfimport \ +)) endif ifeq ($(ENABLE_PRESENTER_SCREEN),YES) diff --git a/sdext/source/pdfimport/test/makefile.mk b/sdext/source/pdfimport/test/makefile.mk deleted file mode 100755 index fdc3966..0000000 --- a/sdext/source/pdfimport/test/makefile.mk +++ /dev/null @@ -1,141 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. -PRJNAME=sdext -TARGET=tests -TARGETTYPE=CUI -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE: settings.mk - -# --- test lib ------------------------------------------------------ - -.IF "$(ENABLE_PDFIMPORT)" == "NO" -@all: - @echo "PDF Import extension disabled." -.ENDIF - -CFLAGSCXX += $(CPPUNIT_CFLAGS) - -.IF "$(SYSTEM_ZLIB)" == "YES" -CFLAGS+=-DSYSTEM_ZLIB -.ENDIF - -SHL1OBJS= \ - $(SLO)$/tests.obj - -SHL1LIBS=\ - $(SLB)$/pdfmisc.lib \ - $(SLB)$/pdfparse.lib \ - $(SLB)$/pdfsax.lib \ - $(SLB)$/pdfparsetree.lib \ - $(SLB)$/pdfodf.lib \ - $(SLB)$/xpdfwrapper.lib \ - $(SLB)$/pdfimport.lib - -SHL1TARGET=$(TARGET) -SHL1STDLIBS=\ - $(BASEGFXLIB) \ - $(UNOTOOLSLIB) \ - $(CANVASTOOLSLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPUNITLIB) \ - $(ZLIB3RDLIB) \ - $(CPPULIB) \ - $(UNOTESTLIB) \ - $(TESTLIB) \ - $(SALLIB) - - -SHL1IMPLIB= i$(SHL1TARGET) -DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP = export.map - -# --- pdf2xml binary ------------------------------------------------------ - -TARGET2=pdf2xml - -APP1TARGET=$(TARGET2) -APP1LIBSALCPPRT= -APP1OBJS=$(SLO)$/pdf2xml.obj - -APP1LIBS=\ - $(SLB)$/pdfmisc.lib \ - $(SLB)$/pdfparse.lib \ - $(SLB)$/pdfsax.lib \ - $(SLB)$/pdfparsetree.lib \ - $(SLB)$/pdfodf.lib \ - $(SLB)$/xpdfwrapper.lib \ - $(SLB)$/pdfimport.lib - -APP1STDLIBS=\ - $(BASEGFXLIB) \ - $(UNOTOOLSLIB) \ - $(CANVASTOOLSLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPUNITLIB) \ - $(ZLIB3RDLIB) \ - $(CPPULIB) \ - $(SALLIB) - -# --- pdfunzip binary ------------------------------------------------------ - -TARGET3=pdfunzip - -APP2TARGET=$(TARGET3) -APP2LIBSALCPPRT= -APP2OBJS=$(SLO)$/pdfunzip.obj - -APP2LIBS=\ - $(SLB)$/pdfmisc.lib \ - $(SLB)$/pdfparse.lib \ - $(SLB)$/pdfsax.lib \ - $(SLB)$/pdfparsetree.lib \ - $(SLB)$/pdfodf.lib \ - $(SLB)$/xpdfwrapper.lib \ - $(SLB)$/pdfimport.lib - -APP2STDLIBS=\ - $(BASEGFXLIB) \ - $(UNOTOOLSLIB) \ - $(CANVASTOOLSLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPUNITLIB) \ - $(ZLIB3RDLIB) \ - $(CPPULIB) \ - $(SALLIB) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk -.INCLUDE : _cppunit.mk diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx index 0fd470e..78d0a5e 100644 --- a/sdext/source/pdfimport/test/tests.cxx +++ b/sdext/source/pdfimport/test/tests.cxx @@ -60,6 +60,7 @@ #include "cppunit/plugin/TestPlugIn.h" #include <test/bootstrapfixture.hxx> +#include <com/sun/star/deployment/XPackageInformationProvider.hpp> #include <com/sun/star/rendering/XCanvas.hpp> #include <com/sun/star/rendering/XColorSpace.hpp> #include <com/sun/star/rendering/PathJoinType.hpp> @@ -79,6 +80,7 @@ #include <vector> #include <boost/unordered_map.hpp> +#include <cassert> using namespace ::pdfparse; using namespace ::pdfi; @@ -477,6 +479,92 @@ namespace bool m_bDashedLineSeen; }; + /* + This is a (hackish) way to set correct path to the xpdfimport executable + during build. Because $OUTDIR/bin is not in $PATH, it will not be found + directly. We also know that xpdf_ImportFromFile() tries to get the path + through the extension mechanism, but there are no registered extensions + available when this test is run. So we create a phony + PackageInformationProvider that pretends such extension exists and passes + out the path we need .-) + */ + + typedef cppu::WeakComponentImplHelper1<deployment::XPackageInformationProvider> PackageInformationProvider_Base; + + class PackageInformationProvider + : private cppu::BaseMutex + , public PackageInformationProvider_Base + { + public: + PackageInformationProvider() + : PackageInformationProvider_Base(m_aMutex) + { + } + + private: + virtual rtl::OUString SAL_CALL getPackageLocation(rtl::OUString const&) + throw() + { + rtl::OUString const aLocation(RTL_CONSTASCII_USTRINGPARAM(PDFIMPORT_EXECUTABLE_LOCATION)); + return aLocation; + } + + virtual uno::Sequence<uno::Sequence<rtl::OUString> > SAL_CALL isUpdateAvailable(rtl::OUString const&) + throw() + { + // dummy impl. + uno::Sequence<uno::Sequence<rtl::OUString> > const aSeq; + return aSeq; + } + + virtual uno::Sequence<uno::Sequence<rtl::OUString> > SAL_CALL getExtensionList() + throw() + { + // dummy impl. + uno::Sequence<uno::Sequence<rtl::OUString> > const aSeq; + return aSeq; + } + }; + + typedef cppu::WeakComponentImplHelper1<uno::XComponentContext> ComponentContext_Base; + + class ComponentContext + : private cppu::BaseMutex + , public ComponentContext_Base + { + public: + explicit ComponentContext(uno::Reference<uno::XComponentContext> const& xParent) + : ComponentContext_Base(m_aMutex) + , m_xParent(xParent) + { + assert(m_xParent.is()); + } + + private: + virtual uno::Any SAL_CALL getValueByName(rtl::OUString const& rName) + throw() + { + if (rName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("/singletons/com.sun.star.deployment.PackageInformationProvider"))) + { + uno::Reference<deployment::XPackageInformationProvider> const xProvider(new PackageInformationProvider()); + uno::Any aComponent; + aComponent <<= xProvider; + return aComponent; + } + + return m_xParent->getValueByName(rName); + } + + virtual uno::Reference<lang::XMultiComponentFactory> SAL_CALL getServiceManager() + throw() + { + return m_xParent->getServiceManager(); + } + + private: + uno::Reference<uno::XComponentContext> m_xParent; + }; + class PDFITest : public test::BootstrapFixture { public: @@ -487,7 +575,7 @@ namespace pSink, uno::Reference< task::XInteractionHandler >(), rtl::OUString(), - getComponentContext() ); + impl_getComponentContext() ); // make destruction explicit, a bunch of things are // checked in the destructor @@ -496,7 +584,7 @@ namespace void testOdfDrawExport() { - pdfi::PDFIRawAdaptor aAdaptor( getComponentContext() ); + pdfi::PDFIRawAdaptor aAdaptor( impl_getComponentContext() ); aAdaptor.setTreeVisitorFactory( createDrawTreeVisitorFactory() ); ::rtl::OUString aURL, aAbsURL, aBaseURL; @@ -512,7 +600,7 @@ namespace void testOdfWriterExport() { - pdfi::PDFIRawAdaptor aAdaptor( getComponentContext() ); + pdfi::PDFIRawAdaptor aAdaptor( impl_getComponentContext() ); aAdaptor.setTreeVisitorFactory( createWriterTreeVisitorFactory() ); ::rtl::OUString aURL, aAbsURL, aBaseURL; @@ -531,6 +619,13 @@ namespace CPPUNIT_TEST(testOdfWriterExport); CPPUNIT_TEST(testOdfDrawExport); CPPUNIT_TEST_SUITE_END(); + + private: + uno::Reference<uno::XComponentContext> impl_getComponentContext() + { + uno::Reference<uno::XComponentContext> const xCtxt(new ComponentContext(getComponentContext())); + return xCtxt; + } }; } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
