allow to skip import tests based on library version
That way we don't have to require the newest version for build just to run tests. Change-Id: I4f91828a13821b235004ff16a69043d6d43686c1
This commit is contained in:
parent
bc0f3f0df2
commit
ddbba41b39
8 changed files with 54 additions and 0 deletions
15
config_host/config_writerperfect.h.in
Normal file
15
config_host/config_writerperfect.h.in
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
/* Configuration for versions of import libraries used by writerperfect.
|
||||
* This is needed to skip test files that are not supported by the used
|
||||
* version.
|
||||
*/
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -12916,6 +12916,7 @@ AC_CONFIG_HEADERS([config_host/config_version.h])
|
|||
AC_CONFIG_HEADERS([config_host/config_oauth2.h])
|
||||
AC_CONFIG_HEADERS([config_host/config_poppler.h])
|
||||
AC_CONFIG_HEADERS([config_host/config_python.h])
|
||||
AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
|
||||
AC_OUTPUT
|
||||
|
||||
if test "$CROSS_COMPILING" = TRUE; then
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,writerperfect_calc,\
|
|||
cppuhelper \
|
||||
sal \
|
||||
test \
|
||||
tl \
|
||||
ucbhelper \
|
||||
unotest \
|
||||
$(gb_UWINAPI) \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,writerperfect_draw,\
|
|||
cppuhelper \
|
||||
sal \
|
||||
test \
|
||||
tl \
|
||||
ucbhelper \
|
||||
unotest \
|
||||
$(gb_UWINAPI) \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,writerperfect_impress,\
|
|||
cppuhelper \
|
||||
sal \
|
||||
test \
|
||||
tl \
|
||||
ucbhelper \
|
||||
unotest \
|
||||
$(gb_UWINAPI) \
|
||||
|
|
|
@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,writerperfect_writer,\
|
|||
cppuhelper \
|
||||
sal \
|
||||
test \
|
||||
tl \
|
||||
ucbhelper \
|
||||
unotest \
|
||||
$(gb_UWINAPI) \
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <com/sun/star/ucb/XContent.hpp>
|
||||
#include <com/sun/star/util/XCloseable.hpp>
|
||||
|
||||
#include <tools/urlobj.hxx>
|
||||
|
||||
#include <ucbhelper/content.hxx>
|
||||
|
||||
#include "WpftImportTestBase.hxx"
|
||||
|
@ -50,6 +52,7 @@ WpftImportTestBase::WpftImportTestBase(const rtl::OUString &rFactoryURL)
|
|||
, m_xDesktop()
|
||||
, m_xFilter()
|
||||
, m_xTypeMap()
|
||||
, m_pOptionalMap(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -75,6 +78,15 @@ void WpftImportTestBase::tearDown()
|
|||
bool WpftImportTestBase::load(const OUString &, const OUString &rURL, const OUString &,
|
||||
SfxFilterFlags, SotClipboardFormatId, unsigned int)
|
||||
{
|
||||
if (m_pOptionalMap)
|
||||
{
|
||||
// first check if this test file is supported by the used version of the library
|
||||
const INetURLObject aUrl(rURL);
|
||||
const WpftOptionalMap_t::const_iterator it(m_pOptionalMap->find(aUrl.getName()));
|
||||
if ((it != m_pOptionalMap->end()) && !it->second)
|
||||
return true; // skip the file
|
||||
}
|
||||
|
||||
// create an empty frame
|
||||
const uno::Reference<lang::XComponent> xDoc(
|
||||
m_xDesktop->loadComponentFromURL(m_aFactoryURL, "_blank", 0, uno::Sequence<beans::PropertyValue>()),
|
||||
|
@ -163,6 +175,14 @@ void WpftImportTestBase::doTest(const rtl::OUString &rFilter, const rtl::OUStrin
|
|||
testDir(OUString(), getURLFromSrc(rPath), OUString());
|
||||
}
|
||||
|
||||
void WpftImportTestBase::doTest(const rtl::OUString &rFilter, const rtl::OUString &rPath, const WpftOptionalMap_t &rOptionalMap)
|
||||
{
|
||||
m_xFilter.set(m_xFactory->createInstanceWithContext(rFilter, m_xContext), uno::UNO_QUERY_THROW);
|
||||
m_pOptionalMap = &rOptionalMap;
|
||||
testDir(OUString(), getURLFromSrc(rPath), OUString());
|
||||
m_pOptionalMap = nullptr;
|
||||
}
|
||||
|
||||
void WpftImportTestBase::impl_detectFilterName(uno::Sequence<beans::PropertyValue> &rDescriptor, const rtl::OUString &rTypeName)
|
||||
{
|
||||
const sal_Int32 nDescriptorLen = rDescriptor.getLength();
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
#ifndef INCLUDED_WRITERPERFECT_QA_UNIT_WPFTIMPORTTESTBASE_HXX
|
||||
#define INCLUDED_WRITERPERFECT_QA_UNIT_WPFTIMPORTTESTBASE_HXX
|
||||
|
||||
#include "config_writerperfect.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
|
||||
|
@ -19,6 +23,12 @@
|
|||
|
||||
#include <unotest/filters-test.hxx>
|
||||
|
||||
#define REQUIRE_VERSION(major, minor, micro, req_major, req_minor, req_micro) \
|
||||
(major) > (req_major) || \
|
||||
((major) == (req_major) && \
|
||||
((minor) > (req_minor) \
|
||||
|| ((minor) == (req_minor) && ((micro) >= (req_micro)))))
|
||||
|
||||
namespace com
|
||||
{
|
||||
namespace sun
|
||||
|
@ -54,6 +64,8 @@ namespace writerperfect
|
|||
namespace test
|
||||
{
|
||||
|
||||
typedef std::unordered_map<rtl::OUString, bool, rtl::OUStringHash> WpftOptionalMap_t;
|
||||
|
||||
class WpftImportTestBase
|
||||
: public ::test::FiltersTest
|
||||
, public ::test::BootstrapFixture
|
||||
|
@ -66,6 +78,7 @@ public:
|
|||
|
||||
protected:
|
||||
void doTest(const rtl::OUString &rFilter, const rtl::OUString &rPath);
|
||||
void doTest(const rtl::OUString &rFilter, const rtl::OUString &rPath, const WpftOptionalMap_t &rOptionalMap);
|
||||
|
||||
private:
|
||||
virtual bool load(const OUString &, const OUString &rURL, const OUString &,
|
||||
|
@ -79,6 +92,7 @@ private:
|
|||
css::uno::Reference<css::ucb::XSimpleFileAccess> m_xFileAccess;
|
||||
css::uno::Reference<css::document::XFilter> m_xFilter;
|
||||
css::uno::Reference<css::container::XNameAccess> m_xTypeMap;
|
||||
const WpftOptionalMap_t *m_pOptionalMap;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue