diff options
author | David Tardon <dtardon@redhat.com> | 2015-12-17 13:06:20 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2015-12-17 23:03:15 +0100 |
commit | ddbba41b39399644b1ce7008d8922998446411e7 (patch) | |
tree | edb42d5bc03521f75fb84c19ebfa4b6488d5f4cd /writerperfect | |
parent | bc0f3f0df24b05d749481ca99e5251546611aaf4 (diff) |
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
Diffstat (limited to 'writerperfect')
-rw-r--r-- | writerperfect/CppunitTest_writerperfect_calc.mk | 1 | ||||
-rw-r--r-- | writerperfect/CppunitTest_writerperfect_draw.mk | 1 | ||||
-rw-r--r-- | writerperfect/CppunitTest_writerperfect_impress.mk | 1 | ||||
-rw-r--r-- | writerperfect/CppunitTest_writerperfect_writer.mk | 1 | ||||
-rw-r--r-- | writerperfect/qa/unit/WpftImportTestBase.cxx | 20 | ||||
-rw-r--r-- | writerperfect/qa/unit/WpftImportTestBase.hxx | 14 |
6 files changed, 38 insertions, 0 deletions
diff --git a/writerperfect/CppunitTest_writerperfect_calc.mk b/writerperfect/CppunitTest_writerperfect_calc.mk index 75716b38a00a..db0212a34465 100644 --- a/writerperfect/CppunitTest_writerperfect_calc.mk +++ b/writerperfect/CppunitTest_writerperfect_calc.mk @@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,writerperfect_calc,\ cppuhelper \ sal \ test \ + tl \ ucbhelper \ unotest \ $(gb_UWINAPI) \ diff --git a/writerperfect/CppunitTest_writerperfect_draw.mk b/writerperfect/CppunitTest_writerperfect_draw.mk index fac4476a1457..232ef3451d40 100644 --- a/writerperfect/CppunitTest_writerperfect_draw.mk +++ b/writerperfect/CppunitTest_writerperfect_draw.mk @@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,writerperfect_draw,\ cppuhelper \ sal \ test \ + tl \ ucbhelper \ unotest \ $(gb_UWINAPI) \ diff --git a/writerperfect/CppunitTest_writerperfect_impress.mk b/writerperfect/CppunitTest_writerperfect_impress.mk index 4da810cb8f0d..1c3bb7a14250 100644 --- a/writerperfect/CppunitTest_writerperfect_impress.mk +++ b/writerperfect/CppunitTest_writerperfect_impress.mk @@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,writerperfect_impress,\ cppuhelper \ sal \ test \ + tl \ ucbhelper \ unotest \ $(gb_UWINAPI) \ diff --git a/writerperfect/CppunitTest_writerperfect_writer.mk b/writerperfect/CppunitTest_writerperfect_writer.mk index 0c3e6150af94..ca0ee0a72b8d 100644 --- a/writerperfect/CppunitTest_writerperfect_writer.mk +++ b/writerperfect/CppunitTest_writerperfect_writer.mk @@ -24,6 +24,7 @@ $(eval $(call gb_CppunitTest_use_libraries,writerperfect_writer,\ cppuhelper \ sal \ test \ + tl \ ucbhelper \ unotest \ $(gb_UWINAPI) \ diff --git a/writerperfect/qa/unit/WpftImportTestBase.cxx b/writerperfect/qa/unit/WpftImportTestBase.cxx index 874b4d6daac6..8b66c3b64f5a 100644 --- a/writerperfect/qa/unit/WpftImportTestBase.cxx +++ b/writerperfect/qa/unit/WpftImportTestBase.cxx @@ -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(); diff --git a/writerperfect/qa/unit/WpftImportTestBase.hxx b/writerperfect/qa/unit/WpftImportTestBase.hxx index 43e1bf137060..4689f9847dd5 100644 --- a/writerperfect/qa/unit/WpftImportTestBase.hxx +++ b/writerperfect/qa/unit/WpftImportTestBase.hxx @@ -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; }; } |