Kaydet (Commit) 13c0122a authored tarafından Justin Luth's avatar Justin Luth

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/29322Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
üst a87a3160
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment