From 057d632db0872c17ebb7abb3afa26d7e97f05243 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 14 May 2012 15:35:33 +0200 Subject: [PATCH] Initial ooxml export test Change-Id: I Id7f647be04245496bb1970b1bcc621d97395c032 --- sw/CppunitTest_sw_subsequent_ooxmlexport.mk | 89 ++++++++++++++++++++ sw/Module_sw.mk | 1 + sw/qa/extras/ooxmlexport/data/zoom.docx | Bin 0 -> 3795 bytes sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 83 ++++++++++++++++++ 4 files changed, 173 insertions(+) create mode 100644 sw/CppunitTest_sw_subsequent_ooxmlexport.mk create mode 100644 sw/qa/extras/ooxmlexport/data/zoom.docx create mode 100644 sw/qa/extras/ooxmlexport/ooxmlexport.cxx diff --git a/sw/CppunitTest_sw_subsequent_ooxmlexport.mk b/sw/CppunitTest_sw_subsequent_ooxmlexport.mk new file mode 100644 index 000000000000..be819735b687 --- /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 (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 bc0679c3b0bc..43b84038301d 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 0000000000000000000000000000000000000000..6c2cd469decbf664e2107e4c50f9aaaa8e07ba2a GIT binary patch literal 3795 zcmaJ^2{@E%8=kQ*gBkmwg|QyHk}YA7XtI-zeQAX3W67>b$i9q7*|)5fM3y1TShJR8 zXc8%8FGPd>8RxGY|9^Vsnz?4KYwqv+-uu0u`?+6zI5`C?fQE(!uz5986>zBNiQlcg z5H3hb3DRdpGX5et40L;yz^cB|fV&J%%3O}4!LXDtfgP$E)X%D1)vRz|<%yO+pKs~q z7n%zS_ilKqQo?a}$!_qmlbQapOVtvwTv?1?7rDnb%T|)~j7$0TBoHQkYNJxA$!?IR z_r{If>}K?Z)LHck@1C-QA`6l{Cu_!pRnFyP`O12aY$hf z=pd38etS@3+9%l=iuJ7ggP)Is!H1Ar^CdE`1Q?c9R}=c7-u&GRa@qzb!Dnz0u3`FJ zTgEh~tx@yIw$F@ShDqd8_xUNHKAf5+y#h;zC$3q83;@voS5}yb|L}A7x+>}5?&fW5 zYv+QHxZ&!8Nj~S+CI!0vHA`(Ut4n$iDrHA)smS(6#s;AJQYYDleN^elo2Duj$(7eU z^MdOJtHES-lcC&wR2u~k#CIGrJtHpHYvPdIDthi^;@4PT$mV2XldTiCn*t`Vc|NjW z_<%UulUYleU|x!DMux$OO~;f`MR%TpGL@M5pjUxHNy2s9;-AF=AynuOBYg?jR+P51 z5F&9L$Vc#?s${4l*OT9h6-or|LDakRtKwp+CuRo}^gaRVXaDNJ&eCZv^jd7D;P^L0 zy4)(6-m$&rx}a@g5W;(0vdA|8=GE78GIKM-?5=@dXht5io@G`NxlOnHTwLz!avSwp zrSk@OIIoH?U_@6cr;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/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 (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 +#include + +#include + +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 xImported = loadFromDesktop(getURLFromSrc("/sw/qa/extras/ooxmlexport/data/") + rFilename); + uno::Reference xStorable(xImported, uno::UNO_QUERY); + uno::Sequence 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 xComponent(xStorable, uno::UNO_QUERY); + xComponent->dispose(); + mxComponent = loadFromDesktop(aTempFile.GetURL()); +} + +void Test::testZoom() +{ + roundtrip("zoom.docx"); + + uno::Reference xModel(mxComponent, uno::UNO_QUERY); + uno::Reference xViewSettingsSupplier(xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference 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: */