diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2022-04-01 16:35:40 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-04-05 15:50:54 +0200 |
commit | e3a996bf72a16f5b22e6ff021745af5cec70a632 (patch) | |
tree | 1de6242cde5da9382b520079075d2c1eeb9c3fad /sw | |
parent | 8c632d8a837cc722c6e7b3b400f6d97edf9f9800 (diff) |
tdf#139948: docx and rtf import: emulate border in between
Writer does not support border in between available in all MS
formats. Since this feature is missing in core it will be
better to emulate it with top borders than to ignore it
completely.
Change-Id: I4e5a99cde5908066c4bb483136cfe9a1316df53c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132429
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf139948.docx | bin | 0 -> 12765 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 26 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/data/tdf139948.rtf | 8 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport4.cxx | 32 |
4 files changed, 66 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf139948.docx b/sw/qa/extras/ooxmlexport/data/tdf139948.docx Binary files differnew file mode 100644 index 000000000000..1b3f7df00031 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf139948.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 69591c638fcc..f199b1fa6671 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -397,6 +397,32 @@ DECLARE_OOXMLEXPORT_TEST(testTdf81507, "tdf81507.docx") xmlXPathFreeObject(pXmlObj); } +DECLARE_OOXMLEXPORT_TEST(testTdf139948, "tdf139948.docx") +{ + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), + getProperty<table::BorderLine2>(getParagraph(1, "No border"), "TopBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), + getProperty<table::BorderLine2>(getParagraph(2, "Border below"), "TopBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(88), + getProperty<table::BorderLine2>(getParagraph(3, "Borders below and above"), "TopBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(88), + getProperty<table::BorderLine2>(getParagraph(4, "Border above"), "TopBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), + getProperty<table::BorderLine2>(getParagraph(5, "No border"), "TopBorder").LineWidth); + + + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), + getProperty<table::BorderLine2>(getParagraph(1), "BottomBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), + getProperty<table::BorderLine2>(getParagraph(2), "BottomBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), + getProperty<table::BorderLine2>(getParagraph(3), "BottomBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), + getProperty<table::BorderLine2>(getParagraph(4), "BottomBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), + getProperty<table::BorderLine2>(getParagraph(5), "BottomBorder").LineWidth); +} + DECLARE_OOXMLEXPORT_TEST(testTdf144563, "tdf144563.docx") { uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/rtfexport/data/tdf139948.rtf b/sw/qa/extras/rtfexport/data/tdf139948.rtf new file mode 100644 index 000000000000..0b601a764adf --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf139948.rtf @@ -0,0 +1,8 @@ +{\rtf1\ansi
+No border\par
+\pard\brdrbtw\brdrs\brdrw50
+Border below\par
+Borders below and above\par
+Border above\par
+\pard No border\par
+}
\ No newline at end of file diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index 123b3b31ae4d..8f81b1565695 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -528,6 +528,38 @@ DECLARE_RTFEXPORT_TEST(testTdf111851, "tdf111851.rtf") CPPUNIT_ASSERT_EQUAL(COL_BLACK, getProperty<Color>(xCell6, "BackColor")); } +DECLARE_RTFEXPORT_TEST(testTdf139948, "tdf139948.rtf") +{ + CPPUNIT_ASSERT_EQUAL( + sal_uInt32(0), + getProperty<table::BorderLine2>(getParagraph(1, "No border"), "TopBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL( + sal_uInt32(0), + getProperty<table::BorderLine2>(getParagraph(2, "Border below"), "TopBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL( + sal_uInt32(88), + getProperty<table::BorderLine2>(getParagraph(3, "Borders below and above"), "TopBorder") + .LineWidth); + CPPUNIT_ASSERT_EQUAL( + sal_uInt32(88), + getProperty<table::BorderLine2>(getParagraph(4, "Border above"), "TopBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL( + sal_uInt32(0), + getProperty<table::BorderLine2>(getParagraph(5, "No border"), "TopBorder").LineWidth); + + // And let's ensure that there are no other horizontal borders + CPPUNIT_ASSERT_EQUAL( + sal_uInt32(0), getProperty<table::BorderLine2>(getParagraph(1), "BottomBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL( + sal_uInt32(0), getProperty<table::BorderLine2>(getParagraph(2), "BottomBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL( + sal_uInt32(0), getProperty<table::BorderLine2>(getParagraph(3), "BottomBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL( + sal_uInt32(0), getProperty<table::BorderLine2>(getParagraph(4), "BottomBorder").LineWidth); + CPPUNIT_ASSERT_EQUAL( + sal_uInt32(0), getProperty<table::BorderLine2>(getParagraph(5), "BottomBorder").LineWidth); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |