diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-09-08 13:02:07 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-09-08 17:56:23 +0200 |
commit | 45518f03c6c994cd7a7d13bb7b4e1b6cf3ec95e5 (patch) | |
tree | 466c737c85133f20ed6d13b616b51ecd3e16b37a /sw/qa/extras/ooxmlimport | |
parent | 60ebe8e183881ed7a85f3bd92fabbc43cf484ed1 (diff) |
sw_ooxmlexport14: DECLARE_OOXMLIMPORT_TEST -> DECLARE_OOXMLEXPORT_TEST
and if the test fails, move it to sw_ooxmlimport2
Change-Id: I2fb18f9cef40ba502ee4d719de543b5e78cd31d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102241
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/extras/ooxmlimport')
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf125038.docx | bin | 0 -> 12690 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf125038b.docx | bin | 0 -> 12649 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf125038c.docx | bin | 0 -> 12677 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 44 |
4 files changed, 44 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf125038.docx b/sw/qa/extras/ooxmlimport/data/tdf125038.docx Binary files differnew file mode 100644 index 000000000000..b4dd622f95e0 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf125038.docx diff --git a/sw/qa/extras/ooxmlimport/data/tdf125038b.docx b/sw/qa/extras/ooxmlimport/data/tdf125038b.docx Binary files differnew file mode 100644 index 000000000000..3aa189daded8 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf125038b.docx diff --git a/sw/qa/extras/ooxmlimport/data/tdf125038c.docx b/sw/qa/extras/ooxmlimport/data/tdf125038c.docx Binary files differnew file mode 100644 index 000000000000..10234b864627 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf125038c.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index c8f8c514c3a6..85317503c90a 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -602,6 +602,50 @@ DECLARE_OOXMLIMPORT_TEST(testTdf103345, "numbering-circle.docx") } } +DECLARE_OOXMLIMPORT_TEST(testTdf125038, "tdf125038.docx") +{ + OUString aActual = getParagraph(1)->getString(); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: phone:... + // - Actual : result1result2phone:... + // i.e. the result if the inner MERGEFIELD fields ended up in the body text. + CPPUNIT_ASSERT_EQUAL(OUString("phone: \t1234567890"), aActual); +} + +DECLARE_OOXMLIMPORT_TEST(testTdf125038b, "tdf125038b.docx") +{ + // Load a document with an IF field, where the IF field command contains a paragraph break. + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParagraphAccess(xTextDocument->getText(), + uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParagraphs = xParagraphAccess->createEnumeration(); + CPPUNIT_ASSERT(xParagraphs->hasMoreElements()); + uno::Reference<text::XTextRange> xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: phone: 1234 + // - Actual : + // i.e. the first paragraph was empty and the second paragraph had the content. + CPPUNIT_ASSERT_EQUAL(OUString("phone: 1234"), xParagraph->getString()); + CPPUNIT_ASSERT(xParagraphs->hasMoreElements()); + xParagraphs->nextElement(); + + // Without the accompanying fix in place, this test would have failed with: + // - Expression: !xParagraphs->hasMoreElements() + // i.e. the document had 3 paragraphs, while only 2 was expected. + CPPUNIT_ASSERT(!xParagraphs->hasMoreElements()); +} + +DECLARE_OOXMLIMPORT_TEST(testTdf125038c, "tdf125038c.docx") +{ + OUString aActual = getParagraph(1)->getString(); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: email: test@test.test + // - Actual : email: + // I.e. the result of the MERGEFIELD field inside an IF field was lost. + CPPUNIT_ASSERT_EQUAL(OUString("email: test@test.test"), aActual); +} + DECLARE_OOXMLIMPORT_TEST(testTdf130214, "tdf130214.docx") { // Currently this file imports with errors because of tdf#126435; it must not segfault on load |