[Libreoffice-commits] core.git: sw/CppunitTest_sw_mailmerge.mk sw/qa

2018-12-11 Thread Libreoffice Gerrit user
 sw/CppunitTest_sw_mailmerge.mk   |1 +
 sw/qa/extras/mailmerge/data/tdf62364.odt |binary
 sw/qa/extras/mailmerge/mailmerge.cxx |   28 
 3 files changed, 29 insertions(+)

New commits:
commit 182db646cfef44d26a4ced4bc745987e27900eb2
Author: Serge Krot 
AuthorDate: Tue Dec 11 12:20:12 2018 +0100
Commit: Thorsten Behrens 
CommitDate: Tue Dec 11 15:13:12 2018 +0100

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/64955
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/sw/CppunitTest_sw_mailmerge.mk b/sw/CppunitTest_sw_mailmerge.mk
index 5f943f74f364..6d9df162df5c 100644
--- a/sw/CppunitTest_sw_mailmerge.mk
+++ b/sw/CppunitTest_sw_mailmerge.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_mailmerge, \
 cppuhelper \
 sal \
 sfx \
+svl \
 sw \
 test \
 tl \
diff --git a/sw/qa/extras/mailmerge/data/tdf62364.odt 
b/sw/qa/extras/mailmerge/data/tdf62364.odt
new file mode 100644
index ..70def3730e26
Binary files /dev/null and b/sw/qa/extras/mailmerge/data/tdf62364.odt differ
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx 
b/sw/qa/extras/mailmerge/mailmerge.cxx
index c1d78685ff24..ebcea54e764d 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -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(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: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/CppunitTest_sw_mailmerge.mk sw/qa

2017-07-19 Thread Miklos Vajna
 sw/CppunitTest_sw_mailmerge.mk  |1 
 sw/qa/extras/mailmerge/data/10-testing-addresses-writer.odt |binary
 sw/qa/extras/mailmerge/data/writer-mail-merge.odt   |binary
 sw/qa/extras/mailmerge/mailmerge.cxx|   14 
 4 files changed, 15 insertions(+)

New commits:
commit d9b0108e3af7244179bcc7b07db9d0826c3ac8a6
Author: Miklos Vajna 
Date:   Wed Jul 19 15:10:09 2017 +0200

sw mailmerge: add writer data source testcase

Fails with commit 83b43ef2223b66484e0e90e7b614886e06f955b5 (sw mail
merge: add support for the new 'writer' connectivity driver, 2017-07-18)
reverted.

Change-Id: I675e15bdbc655a34cca3de2b5d070167ca69cac8
Reviewed-on: https://gerrit.libreoffice.org/40174
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/sw/CppunitTest_sw_mailmerge.mk b/sw/CppunitTest_sw_mailmerge.mk
index 8d798c1788a4..336b235a7df1 100644
--- a/sw/CppunitTest_sw_mailmerge.mk
+++ b/sw/CppunitTest_sw_mailmerge.mk
@@ -39,6 +39,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_mailmerge, \
 configmgr/source/configmgr \
 connectivity/source/cpool/dbpool2 \
 connectivity/source/drivers/calc/calc \
+connectivity/source/drivers/writer/writer \
 connectivity/source/manager/sdbc2 \
 dbaccess/source/filter/xml/dbaxml \
 dbaccess/util/dba \
diff --git a/sw/qa/extras/mailmerge/data/10-testing-addresses-writer.odt 
b/sw/qa/extras/mailmerge/data/10-testing-addresses-writer.odt
new file mode 100644
index ..40b61eda3bbb
Binary files /dev/null and 
b/sw/qa/extras/mailmerge/data/10-testing-addresses-writer.odt differ
diff --git a/sw/qa/extras/mailmerge/data/writer-mail-merge.odt 
b/sw/qa/extras/mailmerge/data/writer-mail-merge.odt
new file mode 100644
index ..f3d42f6b4781
Binary files /dev/null and b/sw/qa/extras/mailmerge/data/writer-mail-merge.odt 
differ
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx 
b/sw/qa/extras/mailmerge/mailmerge.cxx
index e97edbd11306..60b5c0bd9011 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -426,6 +426,20 @@ DECLARE_FILE_MAILMERGE_TEST(testSimpleMailMerge, 
"simple-mail-merge.odt", "10-te
 }
 }
 
+DECLARE_FILE_MAILMERGE_TEST(testWriterDataSource, "writer-mail-merge.odt", 
"10-testing-addresses-writer.odt", "testing-addresses-writer")
+{
+// This failed as the .odt data source was mapped to the jdbc: protocol.
+executeMailMerge();
+for (int doc = 0; doc < 10; ++doc)
+{
+loadMailMergeDocument(doc);
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+CPPUNIT_ASSERT_EQUAL(OUString("Fixed text."), getRun(getParagraph(1), 
1)->getString());
+CPPUNIT_ASSERT_EQUAL(OUString("lastname" + OUString::number(doc + 1)), 
getRun(getParagraph(2), 1)->getString());
+CPPUNIT_ASSERT_EQUAL(OUString("Another fixed text."), 
getRun(getParagraph(3), 1)->getString());
+}
+}
+
 DECLARE_FILE_MAILMERGE_TEST(test2Pages, "simple-mail-merge-2pages.odt", 
"10-testing-addresses.ods", "testing-addresses")
 {
 executeMailMerge();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/CppunitTest_sw_mailmerge.mk

2016-09-21 Thread Michael Stahl
 sw/CppunitTest_sw_mailmerge.mk |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 7c9150af57dfeecf4a0828d20238adc1ecaf18e3
Author: Michael Stahl 
Date:   Wed Sep 21 15:18:39 2016 +0200

sw: apparently CppunitTest_sw_mailmerge needs scfilt library

At least my incremental ASAN build failed because it loaded an outdated
libscfiltlo.so that was still linked against outdated
liborcus-parser-0.11.so causing an odr-violation.

Change-Id: I4a4e134ab14503b15742138e9c4c29cb2b98d655

diff --git a/sw/CppunitTest_sw_mailmerge.mk b/sw/CppunitTest_sw_mailmerge.mk
index 701bb93..aa037fc 100644
--- a/sw/CppunitTest_sw_mailmerge.mk
+++ b/sw/CppunitTest_sw_mailmerge.mk
@@ -54,6 +54,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_mailmerge, \
 package/util/package2 \
 sax/source/expatwrap/expwrap \
 sc/util/sc \
+sc/util/scfilt \
 sfx2/util/sfx \
 sot/util/sot \
 svl/source/fsstor/fsstorage \
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/CppunitTest_sw_mailmerge.mk sw/qa

2016-08-17 Thread Jan-Marek Glogowski
 sw/CppunitTest_sw_mailmerge.mk|2 
 sw/qa/extras/mailmerge/data/linked-labels.odt |binary
 sw/qa/extras/mailmerge/mailmerge.cxx  |  112 --
 3 files changed, 91 insertions(+), 23 deletions(-)

New commits:
commit 9dbaf6b3b6112d9e16fd64ab0ed5dff6e513e5f8
Author: Jan-Marek Glogowski 
Date:   Wed Jan 20 10:48:37 2016 +0100

tdf#95292 MM: add unit test

bEndOfDB was handled inconsistently in ToNextRecord for record
selections and normal record iteration.

This unit test checks mail merge to generate the correct amount
of three pages (actually five with the hidden, empty pages) for
a five record data subset, mailing a linked label document with
two labels. Previously the third / last page was missing.

On Windows, this test originally failed, because the test document
for synced labels opens the "synchronize" dialog, which is
generated from an UI file, which are missing in the default test
configuration.

So this patch also switches the mail merge unit test to the
"instdir configuration", which has locking enabled and prevents
opening a documents twice. As a result we can't use a document for
two test and have to load the source document for inspection after
the UNO mail merge call, because it can just work with a file name
as the source document. This way the document isn't opened twice,
and the tests still pass on Windows.

Change-Id: I98b33defc403c40b84af44d91ed7fdcf6cf347a3
Reviewed-on: https://gerrit.libreoffice.org/23503
Tested-by: Jenkins 
Reviewed-by: Jan-Marek Glogowski 

diff --git a/sw/CppunitTest_sw_mailmerge.mk b/sw/CppunitTest_sw_mailmerge.mk
index 131fc81..701bb93 100644
--- a/sw/CppunitTest_sw_mailmerge.mk
+++ b/sw/CppunitTest_sw_mailmerge.mk
@@ -77,7 +77,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_mailmerge, \
 xmloff/util/xo \
 ))
 
-$(eval $(call gb_CppunitTest_use_configuration,sw_mailmerge))
+$(eval $(call gb_CppunitTest_use_instdir_configuration,sw_mailmerge))
 $(eval $(call gb_CppunitTest_use_ure,sw_mailmerge))
 $(eval $(call gb_CppunitTest_use_vcl,sw_mailmerge))
 
diff --git a/sw/qa/extras/mailmerge/data/linked-labels.odt 
b/sw/qa/extras/mailmerge/data/linked-labels.odt
new file mode 100644
index 000..a89fd92
Binary files /dev/null and b/sw/qa/extras/mailmerge/data/linked-labels.odt 
differ
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx 
b/sw/qa/extras/mailmerge/mailmerge.cxx
index 8e13aef..4b2e8ef 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -10,6 +10,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -21,6 +22,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -66,20 +69,20 @@ public:
  * The 'verify' method actually has to execute the mail merge by
  * calling executeMailMerge() after modifying the job arguments.
  */
-void executeMailMergeTest(const char* filename, const char* datasource, 
const char* tablename, bool file)
+void executeMailMergeTest(const char* filename, const char* datasource, 
const char* tablename, bool file, int selection)
 {
+maMMtestFilename = filename;
 header();
 preTest(filename);
-load(mpTestDocumentPath, filename);
 
 utl::TempFile aTempDir(nullptr, true);
 const OUString aWorkDir = aTempDir.GetURL();
 const OUString aURI( m_directories.getURLFromSrc(mpTestDocumentPath) + 
OUString::createFromAscii(datasource) );
 OUString aDBName = registerDBsource( aURI, aWorkDir );
-initMailMergeJobAndArgs( filename, tablename, aDBName, "LOMM_", 
aWorkDir, file );
+initMailMergeJobAndArgs( filename, tablename, aDBName, "LOMM_", 
aWorkDir, file, selection );
 
-postTest(filename);
 verify();
+postTest(filename);
 finish();
 
 ::utl::removeTree(aWorkDir);
@@ -105,28 +108,64 @@ public:
 return aDBName;
 }
 
+uno::Reference< sdbc::XRowSet > getXResultFromDataset( const char* 
tablename, const OUString  )
+{
+uno::Reference< sdbc::XRowSet > xCurResultSet;
+uno::Reference< uno::XInterface > xInstance = 
getMultiServiceFactory()->createInstance( "com.sun.star.sdb.RowSet" );
+uno::Reference< beans::XPropertySet > xRowSetPropSet( xInstance, 
uno::UNO_QUERY );
+assert( xRowSetPropSet.is() && "failed to get XPropertySet interface 
from RowSet" );
+if (xRowSetPropSet.is())
+{
+xRowSetPropSet->setPropertyValue( "DataSourceName",
uno::makeAny( aDBName ) );
+xRowSetPropSet->setPropertyValue( "Command",   
uno::makeAny( OUString::createFromAscii(tablename) ) );
+xRowSetPropSet->setPropertyValue( "CommandType",   
uno::makeAny( sdb::CommandType::TABLE ) );
+
+uno::Reference< sdbc::XRowSet 

[Libreoffice-commits] core.git: sw/CppunitTest_sw_mailmerge.mk

2014-10-01 Thread Noel Grandin
 sw/CppunitTest_sw_mailmerge.mk |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 99bb7d664ef6c809ff6478fe2335c8a4a00e141b
Author: Noel Grandin n...@peralex.com
Date:   Wed Oct 1 13:02:57 2014 +0200

blind fix for windows build

Change-Id: I8c3d8b039bc82b23d74b41ca4254f50d5c84

diff --git a/sw/CppunitTest_sw_mailmerge.mk b/sw/CppunitTest_sw_mailmerge.mk
index f1020ff..47b51b6 100644
--- a/sw/CppunitTest_sw_mailmerge.mk
+++ b/sw/CppunitTest_sw_mailmerge.mk
@@ -16,6 +16,7 @@ $(eval $(call 
gb_CppunitTest_add_exception_objects,sw_mailmerge, \
 $(eval $(call gb_CppunitTest_use_libraries,sw_mailmerge, \
 comphelper \
 cppu \
+cppuhelper \
 sal \
 sw \
 test \
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits