summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-03-23 10:04:35 +0100
committerMiklos Vajna <vmiklos@suse.cz>2012-03-23 10:06:11 +0100
commit99298d615bc71c6dbc0ea718803ae73ef6648e81 (patch)
tree74fdce51ed0bb4ccac128eec527788e467765357 /sw/qa
parent6776cb6f9cb91c3f86c4e66695eb7e9f4ffef715 (diff)
add testcase for n#751054
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ooxmltok/data/n751054.docxbin0 -> 13100 bytes
-rw-r--r--sw/qa/extras/ooxmltok/ooxmltok.cxx97
2 files changed, 97 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmltok/data/n751054.docx
Binary files 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 <vmiklos@suse.cz> (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 <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+
+#include <test/bootstrapfixture.hxx>
+#include <unotest/macros_test.hxx>
+#include <vcl/svapp.hxx>
+
+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<lang::XComponent> 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<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> 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: */