[Libreoffice-commits] core.git: sw/qa sw/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 4 10:08:43 UTC 2020
sw/qa/extras/ooxmlexport/data/tdf135216_evenOddFooter.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 28 ++++++++++++++
sw/source/filter/ww8/wrtw8sty.cxx | 2 -
3 files changed, 29 insertions(+), 1 deletion(-)
New commits:
commit eb0201b9424ca9cfbbfa7af736cc314cf8f78fca
Author: Justin Luth <justin.luth at collabora.com>
AuthorDate: Tue Jul 28 15:44:41 2020 +0300
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Aug 4 12:08:05 2020 +0200
tdf#135216 sw MSexport: save LeftPageDesc as left page style
GetMaster() is for right pages. I assume this was a
copy/paste mistake which came in already at initial import.
And since left/right are alternating, they always use
the first version of the header/footer. Although the UI
doesn't allow changing these, they still COULD be different,
as is the case with the unit test.
No existing unit tests even touch this code,
so not a common situation at all.
Change-Id: I9e3720ddf34a8f7e08ce196780fbe16e8c88940b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99628
Tested-by: Justin Luth <justin_luth at sil.org>
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Reviewed-by: Justin Luth <justin_luth at sil.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf135216_evenOddFooter.odt b/sw/qa/extras/ooxmlexport/data/tdf135216_evenOddFooter.odt
new file mode 100644
index 000000000000..ab0ac591e29a
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf135216_evenOddFooter.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 7d83cadf520e..77cfd3bf3507 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -81,6 +81,34 @@ DECLARE_OOXMLEXPORT_TEST(testTdf98000_changePageStyle, "tdf98000_changePageStyle
CPPUNIT_ASSERT_MESSAGE("Different page1/page2 styles", sPageOneStyle != sPageTwoStyle);
}
+DECLARE_OOXMLEXPORT_TEST(testTdf135216_evenOddFooter, "tdf135216_evenOddFooter.odt")
+{
+ 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);
+
+ // get LO page style for the first page (even page #2)
+ OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ uno::Reference<container::XNameAccess> xPageStyles = getStyles("PageStyles");
+ uno::Reference<style::XStyle> xPageStyle(xPageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+
+ xCursor->jumpToFirstPage(); // Even/Left page #2
+ uno::Reference<text::XText> xFooter = getProperty<uno::Reference<text::XText>>(xPageStyle, "FooterTextLeft");
+ CPPUNIT_ASSERT_EQUAL(OUString("even page"), xFooter->getString());
+
+ xCursor->jumpToNextPage();
+ pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ xPageStyle.set(xPageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+ xFooter.set(getProperty<uno::Reference<text::XText>>(xPageStyle, "FooterTextRight"));
+ CPPUNIT_ASSERT_EQUAL(OUString("odd page - first footer"), xFooter->getString());
+
+ xCursor->jumpToNextPage();
+ pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ xPageStyle.set(xPageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+ xFooter.set(getProperty<uno::Reference<text::XText>>(xPageStyle, "FooterTextLeft"));
+ CPPUNIT_ASSERT_EQUAL(OUString("even page"), xFooter->getString());
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf133370_columnBreak, "tdf133370_columnBreak.odt")
{
// Since non-DOCX formats ignores column breaks in non-column situations, don't export to docx.
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index fc973381db09..0e7830ccfb04 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1823,7 +1823,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
sal_uInt8 nHeadFootFlags = 0;
const SwFrameFormat* pPdLeftFormat = bLeftRightPgChain
- ? &pPd->GetFollow()->GetMaster()
+ ? &pPd->GetFollow()->GetFirstLeft()
: &pPd->GetLeft();
// Ensure that headers are written if section is first paragraph
More information about the Libreoffice-commits
mailing list