summaryrefslogtreecommitdiff
path: root/sw
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
parent6776cb6f9cb91c3f86c4e66695eb7e9f4ffef715 (diff)
add testcase for n#751054
Diffstat (limited to 'sw')
-rw-r--r--sw/CppunitTest_sw_subsequent_ooxmltok.mk89
-rw-r--r--sw/Module_sw.mk1
-rw-r--r--sw/qa/extras/ooxmltok/data/n751054.docxbin0 -> 13100 bytes
-rw-r--r--sw/qa/extras/ooxmltok/ooxmltok.cxx97
4 files changed, 187 insertions, 0 deletions
diff --git a/sw/CppunitTest_sw_subsequent_ooxmltok.mk b/sw/CppunitTest_sw_subsequent_ooxmltok.mk
new file mode 100644
index 000000000000..cec2405a844f
--- /dev/null
+++ b/sw/CppunitTest_sw_subsequent_ooxmltok.mk
@@ -0,0 +1,89 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+# 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 or as specified alternatively below. 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.
+#
+# Major Contributor(s):
+#
+# For minor contributions see the git repository.
+#
+# 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.
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sw_subsequent_ooxmltok))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_subsequent_ooxmltok, \
+ sw/qa/extras/ooxmltok/ooxmltok \
+))
+
+$(eval $(call gb_CppunitTest_add_linked_libs,sw_subsequent_ooxmltok, \
+ cppu \
+ sal \
+ test \
+ unotest \
+ vcl \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_add_api,sw_subsequent_ooxmltok,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_uses_ure,sw_subsequent_ooxmltok))
+
+$(eval $(call gb_CppunitTest_add_type_rdbs,sw_subsequent_ooxmltok,\
+ types \
+))
+
+$(eval $(call gb_CppunitTest_add_components,sw_subsequent_ooxmltok,\
+ comphelper/util/comphelp \
+ configmgr/source/configmgr \
+ fileaccess/source/fileacc \
+ filter/source/config/cache/filterconfig1 \
+ framework/util/fwk \
+ i18npool/util/i18npool \
+ oox/util/oox \
+ package/source/xstor/xstor \
+ package/util/package2 \
+ sax/source/expatwrap/expwrap \
+ sax/source/fastparser/fastsax \
+ sw/util/sw \
+ sw/util/swd \
+ sw/util/msword \
+ sfx2/util/sfx \
+ svl/source/fsstor/fsstorage \
+ svtools/util/svt \
+ toolkit/util/tk \
+ ucb/source/core/ucb1 \
+ ucb/source/ucp/file/ucpfile1 \
+ unotools/util/utl \
+ unoxml/source/service/unoxml \
+ writerfilter/util/writerfilter \
+))
+
+$(eval $(call gb_CppunitTest_set_args,sw_subsequent_ooxmltok,\
+ --headless \
+ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
+ "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) module:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry/spool) xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/unittest/registry)" \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 8cf4f39ff6b9..d5f1e06b0c7a 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -54,6 +54,7 @@ $(eval $(call gb_Module_add_check_targets,sw,\
$(eval $(call gb_Module_add_slowcheck_targets,sw,\
CppunitTest_sw_filters_test \
CppunitTest_sw_macros_test \
+ CppunitTest_sw_subsequent_ooxmltok \
CppunitTest_sw_subsequent_rtftok \
))
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: */