diff options
author | David Tardon <dtardon@redhat.com> | 2014-03-23 22:02:33 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-03-23 23:04:49 +0100 |
commit | cc7c33b23a33036395dd6f608587a4303ad9b121 (patch) | |
tree | 03d547bc65023c141e1b70dabc12882211116077 | |
parent | b1d00137f2ae0dde7ba0d4a42f184538120a05e5 (diff) |
add a smoketest for wpftimpress import lib
Change-Id: Ifcbc1fd941c8984ef02ef437f6369c0b2df3b28b
-rw-r--r-- | writerperfect/CppunitTest_writerperfect_impress.mk | 38 | ||||
-rw-r--r-- | writerperfect/Module_writerperfect.mk | 1 | ||||
-rw-r--r-- | writerperfect/qa/unit/data/libetonyek/fail/v6.zip | bin | 0 -> 379391 bytes | |||
-rw-r--r-- | writerperfect/qa/unit/data/libetonyek/indeterminate/.gitignore | 0 | ||||
-rw-r--r-- | writerperfect/qa/unit/data/libetonyek/pass/v2.zip | bin | 0 -> 335906 bytes | |||
-rw-r--r-- | writerperfect/qa/unit/data/libetonyek/pass/v3.zip | bin | 0 -> 6972479 bytes | |||
-rw-r--r-- | writerperfect/qa/unit/data/libetonyek/pass/v4.zip | bin | 0 -> 7340562 bytes | |||
-rw-r--r-- | writerperfect/qa/unit/data/libetonyek/pass/v5.key | bin | 0 -> 2210218 bytes | |||
-rw-r--r-- | writerperfect/qa/unit/wpftimpress.cxx | 129 |
9 files changed, 168 insertions, 0 deletions
diff --git a/writerperfect/CppunitTest_writerperfect_impress.mk b/writerperfect/CppunitTest_writerperfect_impress.mk new file mode 100644 index 000000000000..b2fdffba1722 --- /dev/null +++ b/writerperfect/CppunitTest_writerperfect_impress.mk @@ -0,0 +1,38 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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/. +# + +$(eval $(call gb_CppunitTest_CppunitTest,writerperfect_impress)) + +$(eval $(call gb_CppunitTest_use_api,writerperfect_impress,\ + offapi \ + udkapi \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,writerperfect_impress, \ + comphelper \ + cppu \ + cppuhelper \ + sal \ + test \ + ucbhelper \ + unotest \ + $(gb_UWINAPI) \ +)) + +$(eval $(call gb_CppunitTest_use_ure,writerperfect_impress)) + +$(eval $(call gb_CppunitTest_use_rdb,writerperfect_impress,services)) + +$(eval $(call gb_CppunitTest_use_configuration,writerperfect_impress)) + +$(eval $(call gb_CppunitTest_add_exception_objects,writerperfect_impress, \ + writerperfect/qa/unit/wpftimpress \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/writerperfect/Module_writerperfect.mk b/writerperfect/Module_writerperfect.mk index aec064b9b017..1bf44288f184 100644 --- a/writerperfect/Module_writerperfect.mk +++ b/writerperfect/Module_writerperfect.mk @@ -27,6 +27,7 @@ $(eval $(call gb_Module_add_targets,writerperfect,\ )) $(eval $(call gb_Module_add_check_targets,writerperfect,\ + CppunitTest_writerperfect_impress \ CppunitTest_writerperfect_stream \ )) diff --git a/writerperfect/qa/unit/data/libetonyek/fail/v6.zip b/writerperfect/qa/unit/data/libetonyek/fail/v6.zip Binary files differnew file mode 100644 index 000000000000..b0401b398777 --- /dev/null +++ b/writerperfect/qa/unit/data/libetonyek/fail/v6.zip diff --git a/writerperfect/qa/unit/data/libetonyek/indeterminate/.gitignore b/writerperfect/qa/unit/data/libetonyek/indeterminate/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/writerperfect/qa/unit/data/libetonyek/indeterminate/.gitignore diff --git a/writerperfect/qa/unit/data/libetonyek/pass/v2.zip b/writerperfect/qa/unit/data/libetonyek/pass/v2.zip Binary files differnew file mode 100644 index 000000000000..8d7cd4b72269 --- /dev/null +++ b/writerperfect/qa/unit/data/libetonyek/pass/v2.zip diff --git a/writerperfect/qa/unit/data/libetonyek/pass/v3.zip b/writerperfect/qa/unit/data/libetonyek/pass/v3.zip Binary files differnew file mode 100644 index 000000000000..5d715e68c8db --- /dev/null +++ b/writerperfect/qa/unit/data/libetonyek/pass/v3.zip diff --git a/writerperfect/qa/unit/data/libetonyek/pass/v4.zip b/writerperfect/qa/unit/data/libetonyek/pass/v4.zip Binary files differnew file mode 100644 index 000000000000..bf3c9f0c593c --- /dev/null +++ b/writerperfect/qa/unit/data/libetonyek/pass/v4.zip diff --git a/writerperfect/qa/unit/data/libetonyek/pass/v5.key b/writerperfect/qa/unit/data/libetonyek/pass/v5.key Binary files differnew file mode 100644 index 000000000000..fe2f9ad21b71 --- /dev/null +++ b/writerperfect/qa/unit/data/libetonyek/pass/v5.key diff --git a/writerperfect/qa/unit/wpftimpress.cxx b/writerperfect/qa/unit/wpftimpress.cxx new file mode 100644 index 000000000000..dcb3f9c806b8 --- /dev/null +++ b/writerperfect/qa/unit/wpftimpress.cxx @@ -0,0 +1,129 @@ +/* -*- 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/. + */ + +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/frame/theDesktop.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/ucb/SimpleFileAccess.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <test/bootstrapfixture.hxx> + +#include <unotest/filters-test.hxx> + +namespace beans = com::sun::star::beans; +namespace document = com::sun::star::document; +namespace frame = com::sun::star::frame; +namespace io = com::sun::star::io; +namespace lang = com::sun::star::lang; +namespace ucb = com::sun::star::ucb; +namespace uno = com::sun::star::uno; + +namespace +{ + +class WpftImpressFilterTest + : public test::FiltersTest + , public test::BootstrapFixture +{ +public: + virtual void setUp(); + virtual void tearDown(); + + void test(); + + CPPUNIT_TEST_SUITE(WpftImpressFilterTest); + CPPUNIT_TEST(test); + CPPUNIT_TEST_SUITE_END(); + +private: + virtual bool load(const OUString &, const OUString &rURL, const OUString &, + unsigned int, unsigned int, unsigned int); + + void doTest(const rtl::OUString &rFilter, const rtl::OUString &rPath); + +private: + uno::Reference<frame::XDesktop2> m_xDesktop; + uno::Reference<ucb::XSimpleFileAccess> m_xFileAccess; + uno::Reference<document::XFilter> m_xFilter; +}; + +void WpftImpressFilterTest::setUp() +{ + test::BootstrapFixture::setUp(); + + m_xDesktop = frame::theDesktop::get(m_xContext); + m_xFileAccess = ucb::SimpleFileAccess::create(m_xContext); +} + +void WpftImpressFilterTest::tearDown() +{ + test::BootstrapFixture::tearDown(); + + m_xDesktop->terminate(); +} + +void WpftImpressFilterTest::test() +{ + doTest("org.libreoffice.comp.Impress.KeynoteImportFilter", "/writerperfect/qa/unit/data/libetonyek/"); +} + +bool WpftImpressFilterTest::load(const OUString &, const OUString &rURL, const OUString &, + unsigned int, unsigned int, unsigned int) +{ + const uno::Reference<lang::XComponent> xDoc( + m_xDesktop->loadComponentFromURL("private:factory/simpress", "_blank", 0, uno::Sequence<beans::PropertyValue>()), + uno::UNO_QUERY_THROW); + + bool result = false; + + try + { + const uno::Reference<document::XImporter> xImporter(m_xFilter, uno::UNO_QUERY_THROW); + + xImporter->setTargetDocument(xDoc); + + uno::Sequence<beans::PropertyValue> aDescriptor(2); + aDescriptor[0].Name = "URL"; + aDescriptor[0].Value <<= rURL; + + const uno::Reference<io::XInputStream> xInputStream(m_xFileAccess->openFileRead(rURL), uno::UNO_QUERY_THROW); + aDescriptor[1].Name = "InputStream"; + aDescriptor[1].Value <<= xInputStream; + + result = m_xFilter->filter(aDescriptor); + } + catch (const uno::Exception &) + { + xDoc->dispose(); + throw; + } + + xDoc->dispose(); + + return result; +} + +void WpftImpressFilterTest::doTest(const rtl::OUString &rFilter, const rtl::OUString &rPath) +{ + m_xFilter.set(m_xFactory->createInstanceWithContext(rFilter, m_xContext), uno::UNO_QUERY_THROW); + testDir(OUString(), getURLFromSrc(rPath), OUString()); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(WpftImpressFilterTest); + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |