From 99298d615bc71c6dbc0ea718803ae73ef6648e81 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 23 Mar 2012 10:04:35 +0100 Subject: add testcase for n#751054 --- sw/qa/extras/ooxmltok/data/n751054.docx | Bin 0 -> 13100 bytes sw/qa/extras/ooxmltok/ooxmltok.cxx | 97 ++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 sw/qa/extras/ooxmltok/data/n751054.docx create mode 100644 sw/qa/extras/ooxmltok/ooxmltok.cxx (limited to 'sw/qa') diff --git a/sw/qa/extras/ooxmltok/data/n751054.docx b/sw/qa/extras/ooxmltok/data/n751054.docx new file mode 100644 index 000000000000..49d7d6af9cc6 Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/n751054.docx differ diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx new file mode 100644 index 000000000000..32d39af96ca6 --- /dev/null +++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx @@ -0,0 +1,97 @@ +/* + * 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. 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. + * + * The Initial Developer of the Original Code is + * Miklos Vajna (SUSE, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2012 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * 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. + */ + +#include +#include +#include + +#include +#include +#include + +using rtl::OString; +using rtl::OUString; +using rtl::OUStringBuffer; +using namespace com::sun::star; + +class OoxmlModelTest : public test::BootstrapFixture, public unotest::MacrosTest +{ +public: + virtual void setUp(); + virtual void tearDown(); + void testN751054(); + + CPPUNIT_TEST_SUITE(OoxmlModelTest); +#if !defined(MACOSX) && !defined(WNT) + CPPUNIT_TEST(testN751054); +#endif + CPPUNIT_TEST_SUITE_END(); + +private: + /// Load an OOXML file and make the document available via mxComponent. + void load(const OUString& rURL); + uno::Reference mxComponent; +}; + +void OoxmlModelTest::load(const OUString& rFilename) +{ + mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/ooxmltok/data/") + rFilename); +} + +void OoxmlModelTest::setUp() +{ + test::BootstrapFixture::setUp(); + + mxDesktop.set(getMultiServiceFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), uno::UNO_QUERY); + CPPUNIT_ASSERT(mxDesktop.is()); +} + +void OoxmlModelTest::tearDown() +{ + if (mxComponent.is()) + mxComponent->dispose(); + + test::BootstrapFixture::tearDown(); +} + +void OoxmlModelTest::testN751054() +{ + load(OUString(RTL_CONSTASCII_USTRINGPARAM("n751054.docx"))); + + uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY); + text::TextContentAnchorType eValue; + xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AnchorType"))) >>= eValue; + CPPUNIT_ASSERT(eValue != text::TextContentAnchorType_AS_CHARACTER); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(OoxmlModelTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit