diff options
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf92724_continuousBreaksComplex2.docx | bin | 0 -> 16057 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 26 |
2 files changed, 26 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf92724_continuousBreaksComplex2.docx b/sw/qa/extras/ooxmlexport/data/tdf92724_continuousBreaksComplex2.docx Binary files differnew file mode 100644 index 000000000000..18b63c07c447 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf92724_continuousBreaksComplex2.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 4ddf5e46a901..559c4a7a976e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -1005,6 +1005,32 @@ DECLARE_OOXMLEXPORT_TEST(testTdf92724_continuousBreaksComplex,"tdf92724_continuo CPPUNIT_ASSERT_EQUAL(sal_Int16(3), xCursor->getPage()); } +DECLARE_OOXMLEXPORT_TEST(testTdf90697_continuousBreaksComplex2,"tdf92724_continuousBreaksComplex2.docx") +{ +// Continuous section breaks with new headers/footers should not immediately switch to a new page style. + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + xCursor->jumpToLastPage(); + + sal_Int16 nPages = xCursor->getPage(); + while( nPages > 0 ) + { + OUString sPageStyleName = getProperty<OUString>( xCursor, "PageStyleName" ); + uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(sPageStyleName), "HeaderText"); +// Specific case to avoid. Testing separately (even though redundant). +// The first header (defined on page 3) ONLY is shown IF the section happens to start on a new page (which it doesn't in this document). + CPPUNIT_ASSERT( xHeaderText->getString() != "Third section - First page header. No follow defined" ); +// Same test stated differently: Pages 4 and 5 OUGHT to use "Second section header", but currently don't. Page 6 does. + if( nPages <= 3 ) + CPPUNIT_ASSERT_EQUAL( xHeaderText->getString(), OUString("First section header") ); + else + CPPUNIT_ASSERT( xHeaderText->getString() == "First section header" || xHeaderText->getString() == "Second section header" ); + + xCursor->jumpToPage( --nPages ); + } +} + DECLARE_OOXMLEXPORT_TEST(testTdf81345_045Original,"tdf81345.docx") { //Header wasn't replaced and columns were missing because no new style was created. |