Kaydet (Commit) 182db646 authored tarafından Serge Krot's avatar Serge Krot Kaydeden (comit) Thorsten Behrens

tdf#62364: mailmerge: new unit test

Problem was: during mailmerge, all paragraphs became list nodes
when the last node in original document (template) was list node.

Change-Id: I8b457c5ef04ab6569e7860deb1f5b3d73dadacd0
Reviewed-on: https://gerrit.libreoffice.org/64955Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst e12308fe
......@@ -19,6 +19,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_mailmerge, \
cppuhelper \
sal \
sfx \
svl \
sw \
test \
tl \
......
......@@ -900,5 +900,33 @@ DECLARE_SHELL_MAILMERGE_TEST(testTdf118845, "tdf118845.fodt", "4_v01.ods", "Tabe
CPPUNIT_ASSERT_EQUAL(OUString(""), xParagraph->getString());
}
DECLARE_SHELL_MAILMERGE_TEST(testTdf62364, "tdf62364.odt", "10-testing-addresses.ods", "testing-addresses")
{
// prepare unit test and run
executeMailMerge();
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxMMComponent.get());
CPPUNIT_ASSERT(pTextDoc);
CPPUNIT_ASSERT_EQUAL( sal_uInt16( 19 ), pTextDoc->GetDocShell()->GetWrtShell()->GetPhyPageNum()); // 10 pages, but each sub-document starts on odd page number
// check: each page (one page is one sub doc) has 4 paragraphs:
// - 1st and 2nd are regular paragraphs
// - 3rd and 4th are inside list
const bool nodeInList[4] = { false, false, true, true };
const auto & rNodes = pTextDoc->GetDocShell()->GetDoc()->GetNodes();
for (int pageIndex=0; pageIndex<10; pageIndex++)
{
for (int nodeIndex = 0; nodeIndex<4; nodeIndex++)
{
const SwNodePtr aNode = rNodes[9 + pageIndex * 4 + nodeIndex];
CPPUNIT_ASSERT_EQUAL(true, aNode->IsTextNode());
const SwTextNode* pTextNode = aNode->GetTextNode();
CPPUNIT_ASSERT(pTextNode);
CPPUNIT_ASSERT_EQUAL(nodeInList[nodeIndex], pTextNode->GetSwAttrSet().HasItem(RES_PARATR_LIST_ID));
}
}
}
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