n#780843 revert part of docx testcase

revert testcase for commit 211916f865

On import, it is impossible to know where automatic
end-of-pages will be, so it cannot be known that all the
content before the page-break will be on the first page.

Removing this testcase because Writer does not have
the capability to dynamically assign headers/footers
to continuous break sections. This test worked on this
particular document, but not on generic documents.

Replacing it with a version of the document with more
text before the continuous break, which produces the
exact opposite footer results.

Change-Id: If660edd47b4eb19798f79babe65c37e1a9848739
Reviewed-on: https://gerrit.libreoffice.org/29408
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
Justin Luth
2016-09-30 17:46:38 +03:00
committed by Miklos Vajna
parent 14d096e2bf
commit fe8ec3f3f0
4 changed files with 40 additions and 24 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -971,25 +971,8 @@ DECLARE_OOXMLIMPORT_TEST(testN780853, "n780853.docx")
DECLARE_OOXMLIMPORT_TEST(testN780843, "n780843.docx")
{
/*
* The problem was that wrong footer was picked.
*
* oParas = ThisComponent.Text.createEnumeration
* oPara = oParas.nextElement
* oPara = oParas.nextElement
* oPara = oParas.nextElement
* sStyle = oPara.PageStyleName
* oStyle = ThisComponent.StyleFamilies.PageStyles.getByName(sStyle)
* xray oStyle.FooterText.String ' was "hidden footer"
*/
uno::Reference< text::XTextRange > xPara = getParagraph(3);
uno::Reference< text::XTextRange > xPara = getParagraph(1);
OUString aStyleName = getProperty<OUString>(xPara, "PageStyleName");
uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(aStyleName), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xFooter = getProperty< uno::Reference<text::XTextRange> >(xPageStyle, "FooterText");
CPPUNIT_ASSERT_EQUAL(OUString("shown footer"), xFooter->getString());
xPara = getParagraph(1);
aStyleName = getProperty<OUString>(xPara, "PageStyleName");
CPPUNIT_ASSERT_EQUAL(OUString("First Page"), aStyleName);
//tdf64372 this document should only have one page break (2 pages, not 3)
@@ -1000,6 +983,39 @@ DECLARE_OOXMLIMPORT_TEST(testN780843, "n780843.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage());
}
DECLARE_OOXMLIMPORT_TEST(testN780843b, "n780843b.docx")
{
// Same document as testN780843 except there is more text before the continuous break. Now the opposite footer results should happen.
uno::Reference< text::XTextRange > xPara = getParagraph(3);
OUString aStyleName = getProperty<OUString>(xPara, "PageStyleName");
uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(aStyleName), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xFooterText = getProperty< uno::Reference<text::XTextRange> >(xPageStyle, "FooterText");
CPPUNIT_ASSERT_EQUAL( OUString("hidden footer"), xFooterText->getString() );
}
DECLARE_OOXMLIMPORT_TEST(testInheritFirstHeader,"inheritFirstHeader.docx")
{
// First page headers always link to last used first header, never to a follow header
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();
OUString sPageStyleName = getProperty<OUString>( xCursor, "PageStyleName" );
uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(sPageStyleName), "HeaderText");
CPPUNIT_ASSERT_EQUAL( OUString("Last Header"), xHeaderText->getString() );
xCursor->jumpToPreviousPage();
sPageStyleName = getProperty<OUString>( xCursor, "PageStyleName" );
xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(sPageStyleName), "HeaderText");
CPPUNIT_ASSERT_EQUAL( OUString("First Header"), xHeaderText->getString() );
xCursor->jumpToPreviousPage();
sPageStyleName = getProperty<OUString>( xCursor, "PageStyleName" );
xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(sPageStyleName), "HeaderText");
CPPUNIT_ASSERT_EQUAL( OUString("Follow Header"), xHeaderText->getString() );
}
DECLARE_OOXMLIMPORT_TEST(testShadow, "imgshadow.docx")
{
/*

View File

@@ -1114,19 +1114,19 @@ throw ( css::beans::UnknownPropertyException,
ApplyProperties_( m_aFollowPageStyle );
}
if( pLastContext && m_sFirstPageStyleName.isEmpty() )
m_sFirstPageStyleName = pLastContext->GetPageStyleName( /*bFirst=*/true );
// FirstPageStyle may only be inherited if it will not be used or re-linked to a different follow
if( !m_bTitlePage && pLastContext && m_sFirstPageStyleName.isEmpty() )
m_sFirstPageStyleName = pLastContext->GetPageStyleName( /*bFirst=*/true );
else
{
HandleMarginsHeaderFooter( /*bFirst=*/true, rDM_Impl );
GetPageStyle( xPageStyles, xTextFactory, /*bFirst=*/true );
if( rDM_Impl.IsNewDoc() && m_aFirstPageStyle.is() )
ApplyProperties_( m_aFirstPageStyle );
}
GetPageStyle( xPageStyles, xTextFactory, /*bFirst=*/true );
// Chain m_aFollowPageStyle to be after m_aFirstPageStyle
m_aFirstPageStyle->setPropertyValue( "FollowStyle", uno::makeAny(m_sFollowPageStyleName) );
// Chain m_aFollowPageStyle to be after m_aFirstPageStyle
m_aFirstPageStyle->setPropertyValue( "FollowStyle", uno::makeAny(m_sFollowPageStyleName) );
}
}
void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )