diff options
author | Justin Luth <justin_luth@sil.org> | 2016-09-30 17:46:38 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-10-03 06:24:34 +0000 |
commit | fe8ec3f3f09aae165c854294ad52d6870e70ef8e (patch) | |
tree | e9ca26cc43b37d2a3d3f7c07d6c7b634164dbce5 /sw/qa/extras | |
parent | 14d096e2bf7998de55350b8fe53ec511dedcc477 (diff) |
n#780843 revert part of docx testcase
revert testcase for commit 211916f86585cb4f6258eb30e0474e4c21cd37f1
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>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/inheritFirstHeader.docx | bin | 0 -> 15002 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/n780843b.docx | bin | 0 -> 13623 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 52 |
3 files changed, 34 insertions, 18 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/inheritFirstHeader.docx b/sw/qa/extras/ooxmlimport/data/inheritFirstHeader.docx Binary files differnew file mode 100644 index 000000000000..e3d7d20a2d23 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/inheritFirstHeader.docx diff --git a/sw/qa/extras/ooxmlimport/data/n780843b.docx b/sw/qa/extras/ooxmlimport/data/n780843b.docx Binary files differnew file mode 100644 index 000000000000..2ba9ab2c6f0f --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/n780843b.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 50f587faa8d2..4c099e178e80 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -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") { /* |