diff options
author | Matus Uzak <matus.uzak@gmail.com> | 2016-04-13 02:00:03 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2016-04-29 10:57:47 +0000 |
commit | f9c8651506adddad4941fe08e9e76a78d14a9fe0 (patch) | |
tree | 0deda8792d2aee0a1f2602e6e2e62fc4de571bfd /sd/qa | |
parent | d6ffb7405d3267f1e76aed7a5e3162b8700f6817 (diff) |
tdf#90736: PPTX import: Improved table border line style support
Map preset line dash values from ooxml to the smaller set of LO's
predefined table border line styles. Map custom dashing scheme
to a simple dashed line style.
Change-Id: Ia81d94cb7e20b05f1c2cc0c20c8ad398c5613d6c
Reviewed-on: https://gerrit.libreoffice.org/24048
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/data/pptx/tableBorderLineStyle.pptx | bin | 0 -> 51776 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 48 |
2 files changed, 48 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tableBorderLineStyle.pptx b/sd/qa/unit/data/pptx/tableBorderLineStyle.pptx Binary files differnew file mode 100644 index 000000000000..c46b7bcee819 --- /dev/null +++ b/sd/qa/unit/data/pptx/tableBorderLineStyle.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index da4d4c49db67..a9b7f0df067c 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -56,6 +56,7 @@ #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp> #include <com/sun/star/chart2/data/XDataSequence.hpp> #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> +#include <com/sun/star/table/BorderLineStyle.hpp> #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/style/ParagraphAdjust.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> @@ -97,6 +98,7 @@ public: void testBnc584721_4(); void testBnc904423(); void testShapeLineStyle(); + void testTableBorderLineStyle(); void testBnc862510_6(); void testBnc862510_7(); #if ENABLE_PDFIMPORT @@ -143,6 +145,7 @@ public: CPPUNIT_TEST(testBnc584721_4); CPPUNIT_TEST(testBnc904423); CPPUNIT_TEST(testShapeLineStyle); + CPPUNIT_TEST(testTableBorderLineStyle); CPPUNIT_TEST(testBnc862510_6); CPPUNIT_TEST(testBnc862510_7); #if ENABLE_PDFIMPORT @@ -1024,6 +1027,51 @@ void SdImportTest::testShapeLineStyle() xDocShRef->DoClose(); } +void SdImportTest::testTableBorderLineStyle() +{ + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tableBorderLineStyle.pptx"), PPTX ); + + // TODO: If you are working on improvement of table border line style + // support, then expect this unit test to fail. + + const sal_Int16 nObjBorderLineStyles[] = + { + ::table::BorderLineStyle::DASHED, + ::table::BorderLineStyle::DASH_DOT_DOT, + ::table::BorderLineStyle::DASH_DOT, + ::table::BorderLineStyle::DOTTED, + ::table::BorderLineStyle::DASHED, + ::table::BorderLineStyle::DOTTED, + ::table::BorderLineStyle::DASHED, + ::table::BorderLineStyle::DASH_DOT, + ::table::BorderLineStyle::DASH_DOT, + ::table::BorderLineStyle::SOLID, + ::table::BorderLineStyle::NONE + }; + + const SdrPage *pPage = GetPage( 1, xDocShRef ); + CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(nObjBorderLineStyles), pPage->GetObjCount()); + + sdr::table::SdrTableObj *pTableObj; + uno::Reference< table::XCellRange > xTable; + uno::Reference< beans::XPropertySet > xCell; + table::BorderLine2 aBorderLine; + + for (size_t i = 0; i < SAL_N_ELEMENTS(nObjBorderLineStyles); i++) + { + pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(i)); + CPPUNIT_ASSERT( pTableObj ); + xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW); + xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW); + xCell->getPropertyValue("TopBorder") >>= aBorderLine; + if (aBorderLine.LineWidth > 0) { + CPPUNIT_ASSERT_EQUAL(nObjBorderLineStyles[i], aBorderLine.LineStyle); + } + } + + xDocShRef->DoClose(); +} + void SdImportTest::testBnc862510_6() { // Black text was imported instead of gray |