Kaydet (Commit) 06a8ebc8 authored tarafından Michael Meeks's avatar Michael Meeks

fdo#62336 - unit test for conversion failure.

Turns out this depends on not doing layout, and so is a real corner-case.

Change-Id: If9d2db6b1a0df94fc809fb353f2dbf2cf9ac1c9a
üst 102f68ea
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#*************************************************************************
$(eval $(call gb_CppunitTest_CppunitTest,sw_htmlexport))
$(eval $(call gb_CppunitTest_add_exception_objects,sw_htmlexport, \
sw/qa/extras/htmlexport/htmlexport \
))
$(eval $(call gb_CppunitTest_use_libraries,sw_htmlexport, \
comphelper \
cppu \
cppuhelper \
sal \
sw \
test \
tl \
unotest \
utl \
vcl \
$(gb_UWINAPI) \
))
$(eval $(call gb_CppunitTest_use_externals,sw_htmlexport,\
boost_headers \
libxml2 \
))
$(eval $(call gb_CppunitTest_set_include,sw_htmlexport,\
-I$(SRCDIR)/sw/inc \
-I$(SRCDIR)/sw/source/core/inc \
-I$(SRCDIR)/sw/qa/extras/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_api,sw_htmlexport,\
offapi \
udkapi \
))
$(eval $(call gb_CppunitTest_use_ure,sw_htmlexport))
$(eval $(call gb_CppunitTest_use_components,sw_htmlexport,\
basic/util/sb \
comphelper/util/comphelp \
configmgr/source/configmgr \
embeddedobj/util/embobj \
fileaccess/source/fileacc \
filter/source/config/cache/filterconfig1 \
forms/util/frm \
framework/util/fwk \
i18npool/util/i18npool \
linguistic/source/lng \
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 \
starmath/util/sm \
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 \
xmloff/util/xo \
))
$(eval $(call gb_CppunitTest_use_configuration,sw_htmlexport))
$(eval $(call gb_CppunitTest_use_filter_configuration,sw_htmlexport))
$(eval $(call gb_CppunitTest_use_unittest_configuration,sw_htmlexport))
# vim: set noet sw=4 ts=4:
...@@ -46,6 +46,7 @@ $(eval $(call gb_Module_add_check_targets,sw,\ ...@@ -46,6 +46,7 @@ $(eval $(call gb_Module_add_check_targets,sw,\
)) ))
$(eval $(call gb_Module_add_slowcheck_targets,sw,\ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
CppunitTest_sw_htmlexport \
CppunitTest_sw_macros_test \ CppunitTest_sw_macros_test \
CppunitTest_sw_ooxmlexport \ CppunitTest_sw_ooxmlexport \
CppunitTest_sw_ooxmlimport \ CppunitTest_sw_ooxmlimport \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <swmodeltestbase.hxx>
#include <com/sun/star/awt/Gradient.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
class Test : public SwModelTestBase
{
public:
void testFdo62336();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
CPPUNIT_TEST(run);
#endif
CPPUNIT_TEST_SUITE_END();
private:
void run();
};
void Test::run()
{
MethodEntry<Test> aMethods[] = {
{"fdo62336.docx", &Test::testFdo62336},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
MethodEntry<Test>& rEntry = aMethods[i];
load("/sw/qa/extras/htmlexport/data/", rEntry.pName,
false /* not doing layout is required for this test */);
utl::TempFile aFile;
save("HTML", aFile);
(this->*rEntry.pMethod)();
finish();
}
}
void Test::testFdo62336()
{
// The problem was essentially a crash during table export as docx/rtf/html
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* /*
* This file is part of the LibreOffice project. * This file is part of the LibreOffice project.
* *
...@@ -259,12 +260,13 @@ protected: ...@@ -259,12 +260,13 @@ protected:
fprintf(stderr, "File tested,Execution Time (ms)\n"); fprintf(stderr, "File tested,Execution Time (ms)\n");
} }
void load(const char* pDir, const char* pName) void load(const char* pDir, const char* pName, bool bCalcLayout = true)
{ {
// Output name early, so in the case of a hang, the name of the hanging input file is visible. // Output name early, so in the case of a hang, the name of the hanging input file is visible.
fprintf(stderr, "%s,", pName); fprintf(stderr, "%s,", pName);
m_nStartTime = osl_getGlobalTimer(); m_nStartTime = osl_getGlobalTimer();
mxComponent = loadFromDesktop(getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.text.TextDocument"); mxComponent = loadFromDesktop(getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.text.TextDocument");
if (bCalcLayout)
calcLayout(); calcLayout();
} }
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* /*
* This file is part of the LibreOffice project. * This file is part of the LibreOffice project.
* *
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* /*
* This file is part of the LibreOffice project. * This file is part of the LibreOffice project.
* *
......
...@@ -568,7 +568,9 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, sal_uInt16 nStartRow, ...@@ -568,7 +568,9 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, sal_uInt16 nStartRow,
sal_uInt16 nOldRow = nRow; sal_uInt16 nOldRow = nRow;
SwWriteTableRow aSrchRow( nRPos,bUseLayoutHeights ); SwWriteTableRow aSrchRow( nRPos,bUseLayoutHeights );
SwWriteTableRows::const_iterator it2 = aRows.find( &aSrchRow ); SwWriteTableRows::const_iterator it2 = aRows.find( &aSrchRow );
OSL_ENSURE( it2 != aRows.end(), "missing row" );
// coupled methods out of sync ...
assert( it2 != aRows.end() );
nRow = it2 - aRows.begin(); nRow = it2 - aRows.begin();
OSL_ENSURE( nOldRow <= nRow, "Don't look back!" ); OSL_ENSURE( nOldRow <= nRow, "Don't look back!" );
......
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