diff options
author | Justin Luth <justin.luth@collabora.com> | 2020-09-22 17:30:02 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-11-04 08:16:39 +0100 |
commit | 0b8c7a94c6c4b1aa10c7ae0a614d0f1f6cba1002 (patch) | |
tree | 1ac1e1d47d215eaf3041d8092a5d99c1240002e5 /sw/qa/extras/ooxmlimport | |
parent | fe531957e3dcd42927cf15ab31d04473433d81f9 (diff) |
tdf#136952 writerfilter: PageBreakBefore - don't always overwrite
There can be a number of things that can set PROP_BREAK_TYPE,
and thus an un-inheriting value of PageBreakBefore should not
cancel a w:br for example.
There are two ways to approach this. One would be to never
overwrite, and that should be safe in practice, since I don't
see anywhere else that would specify a NONE value.
However, if PageBreakBefore is true, it ought to override
a theoretical NONE, or potential COLUMN break I would assume,
so in that case a "yes" page break should probably override,
but a "no" page break should not. Basically, if anything
specifically requests a page break, they should get it.
(Actually, I'm not sure how, but column and textWrapping
breaks seem not to be affected by this - which is good.
Only the page break seemed to be lost when PageBreakBefore=false.
I tested by changing the w:br type to column,
textWrapping, and the invalid value of none.)
NOTE: If there is both a w:br and a PageBreakBefore=true,
then MSWord 2003 treats both as a valid page break,
but neither Word 2010 nor 2016 add the empty page.
See bug report for two proof unit tests.
Change-Id: I279874c60cc4cc572e0d190dc2afad0ad3431c43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103223
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa/extras/ooxmlimport')
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf136952_pgBreak3.docx | bin | 0 -> 5145 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 14 |
2 files changed, 14 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf136952_pgBreak3.docx b/sw/qa/extras/ooxmlimport/data/tdf136952_pgBreak3.docx Binary files differnew file mode 100644 index 000000000000..3f3c1d37d5c3 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf136952_pgBreak3.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 91029dae7a1d..ec680a69a6ad 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1706,6 +1706,20 @@ DECLARE_OOXMLIMPORT_TEST(testTdf108714, "tdf108714.docx") CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, breakType); } +DECLARE_OOXMLIMPORT_TEST(testTdf136952_pgBreak3, "tdf136952_pgBreak3.docx") +{ + // The original 6 page ODT was designed to visually exaggerate the problems + // of emulating LO's followed-by-page-style into MSWord's sections. + // While much has been improved, there are extra pages present, which still need fixing. + xmlDocUniquePtr pDump = parseLayoutDump(); + + //Do not lose the page::breakAfter. This SHOULD be on page 4, but sadly it is not. + //The key part of this test is that the page starts with "Lorem ipsum" + //Prior to this, there was no page break, and so it was in the middle of a page. + CPPUNIT_ASSERT(getXPath(pDump, "//page[6]/body/txt[1]/Text[1]", "Portion").startsWith("Lorem ipsum")); +} + + DECLARE_OOXMLIMPORT_TEST(testImageLazyRead, "image-lazy-read.docx") { auto xGraphic = getProperty<uno::Reference<graphic::XGraphic>>(getShape(1), "Graphic"); |