Kaydet (Commit) c2516738 authored tarafından Miklos Vajna's avatar Miklos Vajna

fdo#38244 comment range odf import/export testcase

Change-Id: I8cbaa30aa222404f55f5ff49474cf93e8b1bdac2
üst eccc5f97
# -*- 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_odfexport))
$(eval $(call gb_CppunitTest_add_exception_objects,sw_subsequent_odfexport, \
sw/qa/extras/odfexport/odfexport \
))
$(eval $(call gb_CppunitTest_use_libraries,sw_subsequent_odfexport, \
cppu \
cppuhelper \
sal \
sw \
test \
tl \
unotest \
utl \
vcl \
$(gb_STDLIBS) \
))
$(eval $(call gb_CppunitTest_use_externals,sw_subsequent_odfexport,\
libxml2 \
))
$(eval $(call gb_CppunitTest_set_include,sw_subsequent_odfexport,\
-I$(SRCDIR)/sw/inc \
-I$(SRCDIR)/sw/source/core/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_api,sw_subsequent_odfexport,\
offapi \
udkapi \
))
$(eval $(call gb_CppunitTest_use_ure,sw_subsequent_odfexport))
$(eval $(call gb_CppunitTest_use_components,sw_subsequent_odfexport,\
comphelper/util/comphelp \
configmgr/source/configmgr \
fileaccess/source/fileacc \
filter/source/config/cache/filterconfig1 \
framework/util/fwk \
i18npool/util/i18npool \
package/util/package2 \
package/source/xstor/xstor \
sw/util/sw \
sw/util/swd \
sax/source/expatwrap/expwrap \
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 \
xmlhelp/util/ucpchelp1 \
))
$(eval $(call gb_CppunitTest_use_configuration,sw_subsequent_odfexport))
$(eval $(call gb_CppunitTest_use_filter_configuration,sw_subsequent_odfexport))
$(eval $(call gb_CppunitTest_use_extra_configuration,sw_subsequent_odfexport,\
$(OUTDIR)/unittest/registry \
))
# vim: set noet sw=4 ts=4:
......@@ -60,6 +60,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
CppunitTest_sw_subsequent_ww8import \
CppunitTest_sw_subsequent_rtfexport \
CppunitTest_sw_subsequent_rtfimport \
CppunitTest_sw_subsequent_odfexport \
CppunitTest_sw_subsequent_odfimport \
))
......
/*
* 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 "../swmodeltestbase.hxx"
#include <unotools/tempfile.hxx>
using rtl::OUString;
class Test : public SwModelTestBase
{
public:
void testFdo38244();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
CPPUNIT_TEST(testFdo38244);
#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/odfexport/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("writer8");
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::testFdo38244()
{
// See ooxmlexport's testFdo38244().
roundtrip("fdo38244.odt");
// Test comment range feature.
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
xRunEnum->nextElement();
uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStart"), getProperty<OUString>(xPropertySet, "TextPortionType"));
xRunEnum->nextElement();
xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(OUString("TextFieldEnd"), getProperty<OUString>(xPropertySet, "TextPortionType"));
// Test properties
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(OUString("__Fieldmark__4_1833023242"), getProperty<OUString>(xPropertySet, "Name"));
CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty<OUString>(xPropertySet, "Initials"));
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment