[Libreoffice-commits] .: sw/CppunitTest_sw_subsequent_ooxmlexport.mk sw/Module_sw.mk sw/qa
Miklos Vajna
vmiklos at kemper.freedesktop.org
Mon May 14 07:55:43 PDT 2012
sw/CppunitTest_sw_subsequent_ooxmlexport.mk | 89 ++++++++++++++++++++++++++++
sw/Module_sw.mk | 1
sw/qa/extras/ooxmlexport/data/zoom.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 83 ++++++++++++++++++++++++++
4 files changed, 173 insertions(+)
New commits:
commit 057d632db0872c17ebb7abb3afa26d7e97f05243
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Mon May 14 15:35:33 2012 +0200
Initial ooxml export test
Change-Id: I Id7f647be04245496bb1970b1bcc621d97395c032
diff --git a/sw/CppunitTest_sw_subsequent_ooxmlexport.mk b/sw/CppunitTest_sw_subsequent_ooxmlexport.mk
new file mode 100644
index 0000000..be81973
--- /dev/null
+++ b/sw/CppunitTest_sw_subsequent_ooxmlexport.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 at 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_ooxmlexport))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_subsequent_ooxmlexport, \
+ sw/qa/extras/ooxmlexport/ooxmlexport \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_ooxmlexport, \
+ cppu \
+ sal \
+ test \
+ tl \
+ unotest \
+ utl \
+ vcl \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sw_subsequent_ooxmlexport,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sw_subsequent_ooxmlexport))
+
+$(eval $(call gb_CppunitTest_use_components,sw_subsequent_ooxmlexport,\
+ 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_use_configuration,sw_subsequent_ooxmlexport))
+
+$(eval $(call gb_CppunitTest_use_filter_configuration,sw_subsequent_ooxmlexport))
+
+$(eval $(call gb_CppunitTest_use_extra_configuration,sw_subsequent_ooxmlexport,\
+ $(OUTDIR)/unittest/registry \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index bc0679c..43b8403 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_ooxmlexport \
CppunitTest_sw_subsequent_ooxmltok \
CppunitTest_sw_subsequent_ww8tok \
CppunitTest_sw_subsequent_rtfexport \
diff --git a/sw/qa/extras/ooxmlexport/data/zoom.docx b/sw/qa/extras/ooxmlexport/data/zoom.docx
new file mode 100644
index 0000000..6c2cd46
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/zoom.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
new file mode 100644
index 0000000..e9657dd
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -0,0 +1,83 @@
+/*
+ * 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 at 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 "../swmodeltestbase.hxx"
+
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/view/XViewSettingsSupplier.hpp>
+
+#include <unotools/tempfile.hxx>
+
+using rtl::OUString;
+
+class Test : public SwModelTestBase
+{
+public:
+ void testZoom();
+
+ CPPUNIT_TEST_SUITE(Test);
+#if !defined(MACOSX) && !defined(WNT)
+ CPPUNIT_TEST(testZoom);
+#endif
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ void roundtrip(const OUString& rURL);
+};
+
+void Test::roundtrip(const OUString& rFilename)
+{
+ uno::Reference<lang::XComponent> xImported = loadFromDesktop(getURLFromSrc("/sw/qa/extras/ooxmlexport/data/") + rFilename);
+ uno::Reference<frame::XStorable> xStorable(xImported, uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> aArgs(1);
+ aArgs[0].Name = "FilterName";
+ aArgs[0].Value <<= OUString("Office Open XML Text");
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ xStorable->storeToURL(aTempFile.GetURL(), aArgs);
+ uno::Reference<lang::XComponent> xComponent(xStorable, uno::UNO_QUERY);
+ xComponent->dispose();
+ mxComponent = loadFromDesktop(aTempFile.GetURL());
+}
+
+void Test::testZoom()
+{
+ roundtrip("zoom.docx");
+
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<view::XViewSettingsSupplier> xViewSettingsSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xPropertySet(xViewSettingsSupplier->getViewSettings());
+ sal_Int16 nValue = 0;
+ xPropertySet->getPropertyValue("ZoomValue") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(42), nValue);
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list