summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2017-03-04 22:07:46 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-03-06 09:25:41 +0000
commitb3afee4b61740b20bb7430bd6bbe25023f705f3a (patch)
tree869f69e5fcd52dd52c375ffe4deec3038feedc95
parent0ea05f930fb6811da33606cf546057e11a96361c (diff)
doc/docx: make unit test for tdf#99120 round-tripable
When a page description is chained to a non-chained follow, it will only be used for a single page. Thus it might be able to be combined into the follow as a titlePage instead. However, if this page description has distinct even/odd pages, don't merge it as a titlepage. Change-Id: I62237a48c062e7c393a5224285a23597c479c1c9 Reviewed-on: https://gerrit.libreoffice.org/34889 Reviewed-by: Justin Luth <justin_luth@sil.org> Tested-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/qa/extras/ww8export/data/tdf99120.doc (renamed from sw/qa/extras/ww8import/data/tdf99120.doc)bin23040 -> 23040 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export2.cxx9
-rw-r--r--sw/qa/extras/ww8import/ww8import.cxx9
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx1
4 files changed, 10 insertions, 9 deletions
diff --git a/sw/qa/extras/ww8import/data/tdf99120.doc b/sw/qa/extras/ww8export/data/tdf99120.doc
index a93721c573a7..a93721c573a7 100644
--- a/sw/qa/extras/ww8import/data/tdf99120.doc
+++ b/sw/qa/extras/ww8export/data/tdf99120.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index d5050cc67285..bb70ccff0be0 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -27,6 +27,15 @@ public:
}
};
+DECLARE_WW8EXPORT_TEST(testTdf99120, "tdf99120.doc")
+{
+ CPPUNIT_ASSERT_EQUAL(OUString("Section 1, odd."), parseDump("/root/page[1]/header/txt/text()"));
+ CPPUNIT_ASSERT_EQUAL(OUString("Section 1, even."), parseDump("/root/page[2]/header/txt/text()"));
+ // This failed: the header was empty on the 3rd page, as the first page header was shown.
+ CPPUNIT_ASSERT_EQUAL(OUString("Section 2, odd."), parseDump("/root/page[3]/header/txt/text()"));
+ CPPUNIT_ASSERT_EQUAL(OUString("Section 2, even."), parseDump("/root/page[4]/header/txt/text()"));
+}
+
DECLARE_WW8EXPORT_TEST(testTdf41542_borderlessPadding, "tdf41542_borderlessPadding.odt")
{
// the page style's borderless padding should force this to 3 pages, not 1
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index 79c323f2ccde..3727c58d090b 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -56,15 +56,6 @@ DECLARE_WW8IMPORT_TEST(testFloatingTableSectionColumns, "floating-table-section-
CPPUNIT_ASSERT( tableWidth.toInt32() > 10000 );
}
-DECLARE_WW8IMPORT_TEST(testTdf99120, "tdf99120.doc")
-{
- CPPUNIT_ASSERT_EQUAL(OUString("Section 1, odd."), parseDump("/root/page[1]/header/txt/text()"));
- CPPUNIT_ASSERT_EQUAL(OUString("Section 1, even."), parseDump("/root/page[2]/header/txt/text()"));
- // This failed: the header was empty on the 3rd page, as the first page header was shown.
- CPPUNIT_ASSERT_EQUAL(OUString("Section 2, odd."), parseDump("/root/page[3]/header/txt/text()"));
- CPPUNIT_ASSERT_EQUAL(OUString("Section 2, even."), parseDump("/root/page[4]/header/txt/text()"));
-}
-
DECLARE_WW8IMPORT_TEST(testTdf106291, "tdf106291.doc")
{
// Table cell was merged vertically instead of horizontally -> had incorrect dimensions
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 66f0cf51cac0..ee2d376fafab 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1619,6 +1619,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
// in checking heuristics here.
if ( !titlePage && pPd->GetFollow() && pPd != pPd->GetFollow() &&
pPd->GetFollow()->GetFollow() == pPd->GetFollow() &&
+ pPd->IsHeaderShared() && pPd->IsFooterShared() &&
( !rSepInfo.pPDNd || pPd->IsFollowNextPageOfNode( *rSepInfo.pPDNd ) ) )
{
const SwPageDesc *pFollow = pPd->GetFollow();