summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-12-20 15:54:18 +0300
committerJustin Luth <justin_luth@sil.org>2016-12-22 05:08:41 +0000
commite37563c304e52f1d2385868c9b33e0145493d2bd (patch)
tree08516cd131f926cc2e8caab9cf321fd5ad169196 /sw
parentc06be281e7bd97d8db5549cdc886c9761ac9c015 (diff)
tdf#104710 bRemove: only prevent w/BREAK_TYPE for defined Sections
fixes regression from fix for bug 103975 which prevented removal of empty paragraphs if there was a page/column break. This patch adds the requirement that there is also a defined SectionBreak. I did a bad thing with unit test rhbz988516 (which was re-used as the unit test for bug 103975). I didn't first check in MSWord to see how many pages it really ought to have, and when it started round-tripping with 3 pages I was happy. Well, the proper page count according to MSO is 2 (a hard page/break and Section/newPage combine to form a single pagebreak). Undoing the regression fixes that too. The regression was commit 7b250d56981f78e77454a2a3fd670731b2358e75 Change-Id: I15e9df2d260954f02a9e183d9f48c1d267494b49 Reviewed-on: https://gerrit.libreoffice.org/32236 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx4
-rwxr-xr-xsw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakB.docxbin0 -> 13971 bytes
-rwxr-xr-xsw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakC.docxbin0 -> 13955 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx56
4 files changed, 58 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 1e20ff4b7e1c..002d0641c54e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -81,13 +81,13 @@ DECLARE_OOXMLEXPORT_TEST(testRhbz988516, "rhbz988516.docx")
{
// The problem was that the list properties of the footer leaked into body
CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(1), "NumberingStyleName"));
- CPPUNIT_ASSERT_EQUAL(OUString("Enclosure 3"), getParagraph(3)->getString());
+ CPPUNIT_ASSERT_EQUAL(OUString("Enclosure 3"), getParagraph(2)->getString());
CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(2), "NumberingStyleName"));
CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(3), "NumberingStyleName"));
CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(4), "NumberingStyleName"));
// tdf#103975 The problem was that an empty paragraph with page break info was removed.
- CPPUNIT_ASSERT_EQUAL( 3, getPages() );
+ CPPUNIT_ASSERT_EQUAL( 2, getPages() );
}
DECLARE_OOXMLEXPORT_TEST(testTdf103389, "tdf103389.docx")
diff --git a/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakB.docx b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakB.docx
new file mode 100755
index 000000000000..a7b880d00e60
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakB.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakC.docx b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakC.docx
new file mode 100755
index 000000000000..52767abb8ce3
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf103975_notPageBreakC.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 14be1f844911..eb45e2270a87 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -130,6 +130,62 @@ DECLARE_SW_IMPORT_TEST(testMathMalformedXml, "math-malformed_xml.docx", FailTest
CPPUNIT_ASSERT(!mxComponent.is());
}
+DECLARE_OOXMLIMPORT_TEST(testTdf103975_notPageBreakB, "tdf103975_notPageBreakB.docx")
+{
+ // turn on View Formatting Marks to see these documents.
+ uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(1), "TextSection");
+ CPPUNIT_ASSERT(xTextSection.is());
+ uno::Reference<text::XTextColumns> xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
+
+ xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(2), "TextSection");
+ CPPUNIT_ASSERT(xTextSection.is());
+ xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
+
+ xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(3), "TextSection");
+ CPPUNIT_ASSERT(xTextSection.is());
+ xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount());
+
+ xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(4), "TextSection");
+ CPPUNIT_ASSERT(xTextSection.is());
+ xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount());
+
+ CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(2), "BreakType"));
+ CPPUNIT_ASSERT_EQUAL( 4, getParagraphs() );
+ CPPUNIT_ASSERT_EQUAL( 1, getPages() );
+}
+
+DECLARE_OOXMLIMPORT_TEST(testTdf103975_notPageBreakC, "tdf103975_notPageBreakC.docx")
+{
+ // turn on View Formatting Marks to see these documents.
+ uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(1), "TextSection");
+ CPPUNIT_ASSERT(xTextSection.is());
+ uno::Reference<text::XTextColumns> xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
+
+ xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(2), "TextSection");
+ CPPUNIT_ASSERT(xTextSection.is());
+ xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
+
+ xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(3), "TextSection");
+ CPPUNIT_ASSERT(xTextSection.is());
+ xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount());
+
+ xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(4), "TextSection");
+ CPPUNIT_ASSERT(xTextSection.is());
+ xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount());
+
+ CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(2), "BreakType"));
+ CPPUNIT_ASSERT_EQUAL( 4, getParagraphs() );
+ CPPUNIT_ASSERT_EQUAL( 1, getPages() );
+}
+
DECLARE_OOXMLIMPORT_TEST(testTdf103975_notPageBreakD, "tdf103975_notPageBreakD.docx")
{
// The problem was that the column break was moving outside of the columns, making a page break.