summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2013-04-30 17:31:12 +0100
committerMichael Meeks <michael.meeks@suse.com>2013-04-30 17:32:20 +0100
commit06a8ebc878ff9bcab26556d5b5a46532e232d416 (patch)
tree57b426a4e47bd3ef165265eb0e78e4032c916f1e
parent102f68ea54e7b9420a8f13605289a5411db5512b (diff)
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
-rw-r--r--sw/CppunitTest_sw_htmlexport.mk89
-rw-r--r--sw/Module_sw.mk1
-rw-r--r--sw/qa/extras/htmlexport/data/fdo62336.docxbin0 -> 21361 bytes
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx56
-rw-r--r--sw/qa/extras/inc/swmodeltestbase.hxx6
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx1
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx1
-rw-r--r--sw/source/filter/writer/wrtswtbl.cxx4
8 files changed, 155 insertions, 3 deletions
diff --git a/sw/CppunitTest_sw_htmlexport.mk b/sw/CppunitTest_sw_htmlexport.mk
new file mode 100644
index 000000000000..5041627c03e9
--- /dev/null
+++ b/sw/CppunitTest_sw_htmlexport.mk
@@ -0,0 +1,89 @@
+# -*- 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:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 021fda84d4dc..202c67c4fc35 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -46,6 +46,7 @@ $(eval $(call gb_Module_add_check_targets,sw,\
))
$(eval $(call gb_Module_add_slowcheck_targets,sw,\
+ CppunitTest_sw_htmlexport \
CppunitTest_sw_macros_test \
CppunitTest_sw_ooxmlexport \
CppunitTest_sw_ooxmlimport \
diff --git a/sw/qa/extras/htmlexport/data/fdo62336.docx b/sw/qa/extras/htmlexport/data/fdo62336.docx
new file mode 100644
index 000000000000..f14a0e001962
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/fdo62336.docx
Binary files differ
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
new file mode 100644
index 000000000000..34cd2ee0b4e4
--- /dev/null
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -0,0 +1,56 @@
+/* -*- 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: */
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index 5419a8c8a503..fc8682d39f1c 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -259,13 +260,14 @@ protected:
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.
fprintf(stderr, "%s,", pName);
m_nStartTime = osl_getGlobalTimer();
mxComponent = loadFromDesktop(getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.text.TextDocument");
- calcLayout();
+ if (bCalcLayout)
+ calcLayout();
}
void reload(OUString aFilter)
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 436759a2813f..09c342a65bac 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 0def6ef93852..8dc69f2a197e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx
index 12c35398fcb1..c75de62d7a46 100644
--- a/sw/source/filter/writer/wrtswtbl.cxx
+++ b/sw/source/filter/writer/wrtswtbl.cxx
@@ -568,7 +568,9 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, sal_uInt16 nStartRow,
sal_uInt16 nOldRow = nRow;
SwWriteTableRow aSrchRow( nRPos,bUseLayoutHeights );
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();
OSL_ENSURE( nOldRow <= nRow, "Don't look back!" );