From 1bc8726a3ae59c10c87abc993aa053da621c4436 Mon Sep 17 00:00:00 2001 From: Gülşah Köse Date: Fri, 27 Dec 2019 21:06:08 +0300 Subject: tdf#107604 Handle predefined table styles. Handle table styles that we have just style-id and have not corresponding style defination in tableStyle.xml Change-Id: Id06f5508d5eb1330b5bac1634c520c3066c09139 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86068 Tested-by: Jenkins Reviewed-by: Andras Timar Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86326 --- sd/qa/unit/data/pptx/predefined-table-style.pptx | Bin 0 -> 36430 bytes sd/qa/unit/import-tests.cxx | 30 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 sd/qa/unit/data/pptx/predefined-table-style.pptx (limited to 'sd') diff --git a/sd/qa/unit/data/pptx/predefined-table-style.pptx b/sd/qa/unit/data/pptx/predefined-table-style.pptx new file mode 100644 index 000000000000..5c3429f9e949 Binary files /dev/null and b/sd/qa/unit/data/pptx/predefined-table-style.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 5cab4e7ae8cd..79a856d031f6 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -137,6 +137,7 @@ public: void testN862510_4(); void testBnc870237(); void testBnc887225(); + void testPredefinedTableStyle(); void testBnc591147(); void testCreationDate(); void testBnc584721_1(); @@ -236,6 +237,7 @@ public: CPPUNIT_TEST(testN862510_4); CPPUNIT_TEST(testBnc870237); CPPUNIT_TEST(testBnc887225); + CPPUNIT_TEST(testPredefinedTableStyle); CPPUNIT_TEST(testBnc591147); CPPUNIT_TEST(testCreationDate); CPPUNIT_TEST(testBnc584721_1); @@ -877,6 +879,34 @@ void SdImportTest::testCreationDate() xDocShRef->DoClose(); } +void SdImportTest::testPredefinedTableStyle() +{ + // 073A0DAA-6AF3-43AB-8588-CEC1D06C72B9 (Medium Style 2) + sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/predefined-table-style.pptx"), PPTX ); + const SdrPage *pPage = GetPage( 1, xDocShRef ); + + sdr::table::SdrTableObj *pTableObj = dynamic_cast(pPage->GetObj(0)); + CPPUNIT_ASSERT( pTableObj ); + + uno::Reference< table::XCellRange > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW); + uno::Reference< beans::XPropertySet > xCell; + sal_Int32 nColor; + + xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW); + xCell->getPropertyValue("FillColor") >>= nColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nColor); + + xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW); + xCell->getPropertyValue("FillColor") >>= nColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(13421772), nColor); + + xCell.set(xTable->getCellByPosition(0, 2), uno::UNO_QUERY_THROW); + xCell->getPropertyValue("FillColor") >>= nColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(15198183), nColor); + + xDocShRef->DoClose(); +} + void SdImportTest::testBnc887225() { sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc887225.pptx"), PPTX ); -- cgit