diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-09-09 13:19:27 +0200 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-09-09 14:02:19 +0200 |
commit | 5681725f1a2535a13b86104d8b8a33f750f34efc (patch) | |
tree | 8dc2dbb5c3ac204336878637c2c911c1b8e62b96 /sd | |
parent | 7ad83656484db970a9539f0fd73c387cda15d40b (diff) |
bnc#480256: OOXML import: unit test for table background property
Change-Id: I97bf0bd1ea8cf8ece30a2fa328c5c7a8b0549a4a
Diffstat (limited to 'sd')
-rwxr-xr-x | sd/qa/unit/data/pptx/bnc480256.pptx | bin | 0 -> 35990 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/bnc480256.pptx b/sd/qa/unit/data/pptx/bnc480256.pptx Binary files differnew file mode 100755 index 000000000000..71e91c2f4581 --- /dev/null +++ b/sd/qa/unit/data/pptx/bnc480256.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 259004c85505..f49d6aa19550 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -76,6 +76,7 @@ public: void testN862510_4(); void testBnc870237(); void testBnc887225(); + void testBnc480256(); void testCreationDate(); CPPUNIT_TEST_SUITE(SdFiltersTest); @@ -97,6 +98,7 @@ public: CPPUNIT_TEST(testN862510_4); CPPUNIT_TEST(testBnc870237); CPPUNIT_TEST(testBnc887225); + CPPUNIT_TEST(testBnc480256); CPPUNIT_TEST(testCreationDate); CPPUNIT_TEST_SUITE_END(); @@ -661,6 +663,52 @@ void SdFiltersTest::testBnc887225() xDocShRef->DoClose(); } +void SdFiltersTest::testBnc480256() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc480256.pptx"), PPTX); + // In the document, there are two tables with table background properties. + // Make sure colors are set properly for individual cells. + + // TODO: If you are working on improving table background support, expect + // this unit test to fail. In that case, feel free to change the numbers. + + SdDrawDocument *pDoc = xDocShRef->GetDoc(); + CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); + const SdrPage *pPage = pDoc->GetPage(1); + CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL ); + + sdr::table::SdrTableObj *pTableObj; + uno::Reference< table::XCellRange > xTable; + uno::Reference< beans::XPropertySet > xCell; + sal_Int32 nColor; + + pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0)); + CPPUNIT_ASSERT( pTableObj ); + xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW); + + xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW); + xCell->getPropertyValue("FillColor") >>= nColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(10208238), nColor); + + xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW); + xCell->getPropertyValue("FillColor") >>= nColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(13032959), nColor); + + pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(1)); + CPPUNIT_ASSERT( pTableObj ); + xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW); + + xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW); + xCell->getPropertyValue("FillColor") >>= nColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(7056614), nColor); + + xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW); + xCell->getPropertyValue("FillColor") >>= nColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(4626400), nColor); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); |