[Libreoffice-commits] core.git: sw/qa
Justin Luth
justin_luth at sil.org
Thu Sep 29 04:37:20 UTC 2016
sw/qa/extras/ooxmlexport/data/tdf92724_continuousBreaksComplex2.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 26 ++++++++++
2 files changed, 26 insertions(+)
New commits:
commit 13c0122ad18dd1db187de8afc2ef406421d6d0e5
Author: Justin Luth <justin_luth at sil.org>
Date: Tue Sep 27 16:01:46 2016 +0300
tdf#90697 unit test for an unused FirstPage header
Continuous section breaks are tricky to handle. Here is a
strange case where the first page header is defined in the middle
of a page, so it is unused. Also added is an extra section page break
for added complexity (which inherits from the previous section).
Except for not dynamically switching to the most recently defined
headers/footers (which Writer is not designed to do), these breaks
are currently handled somewhat properly. Adding this test
to prevent regressions.
Change-Id: I6fe464c8839660a6eb19e0dd205adfa6ec988d7d
Reviewed-on: https://gerrit.libreoffice.org/29322
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Justin Luth <justin_luth at sil.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf92724_continuousBreaksComplex2.docx b/sw/qa/extras/ooxmlexport/data/tdf92724_continuousBreaksComplex2.docx
new file mode 100644
index 0000000..18b63c0
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf92724_continuousBreaksComplex2.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 4ddf5e4..559c4a7 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.
More information about the Libreoffice-commits
mailing list