diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf108714.docx | bin | 0 -> 1310 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 47 |
2 files changed, 47 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf108714.docx b/sw/qa/extras/ooxmlimport/data/tdf108714.docx Binary files differnew file mode 100644 index 000000000000..e564d44a648b --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf108714.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index a5f7cf21cd96..97dd9128b9ea 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/drawing/GraphicExportFilter.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/style/BreakType.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/text/HoriOrientation.hpp> #include <com/sun/star/text/RelOrientation.hpp> @@ -1312,6 +1313,52 @@ DECLARE_OOXMLIMPORT_TEST(testVmlAdjustments, "vml-adjustments.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(17639), aAdjustmentValue.Value.get<sal_Int32>()); } +DECLARE_OOXMLIMPORT_TEST(testTdf108714, "tdf108714.docx") +{ + CPPUNIT_ASSERT_EQUAL(4, getParagraphs()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Page break is absent - we lost bug-to-bug compatibility with Word", 3, getPages()); + + // The second (empty) paragraph must be at first page, despite the <w:br> element was before it. + // That's because Word treats such break as first element in first run of following paragraph: + // + // <w:br w:type="page"/> + // <w:p> + // <w:r> + // <w:t/> + // </w:r> + // </w:p> + // + // is equal to + // + // <w:p> + // <w:r> + // <w:br w:type="page"/> + // </w:r> + // </w:p> + // + // which emits page break after that empty paragraph. + + uno::Reference< text::XTextRange > paragraph = getParagraph(1); + CPPUNIT_ASSERT_EQUAL(OUString("Paragraph 1"), paragraph->getString()); + style::BreakType breakType = getProperty<style::BreakType>(paragraph, "BreakType"); + CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, breakType); + + paragraph = getParagraph(2); + CPPUNIT_ASSERT_EQUAL(OUString(), paragraph->getString()); + breakType = getProperty<style::BreakType>(paragraph, "BreakType"); + CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, breakType); + + paragraph = getParagraph(3); + CPPUNIT_ASSERT_EQUAL(OUString("Paragraph 2"), paragraph->getString()); + breakType = getProperty<style::BreakType>(paragraph, "BreakType"); + CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, breakType); + + paragraph = getParagraph(4); + CPPUNIT_ASSERT_EQUAL(OUString("Paragraph 3"), paragraph->getString()); + breakType = getProperty<style::BreakType>(paragraph, "BreakType"); + CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, breakType); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); |