[Libreoffice-commits] core.git: sd/qa
Matúš Kukan
matus.kukan at collabora.com
Tue Sep 9 05:03:17 PDT 2014
sd/qa/unit/data/pptx/bnc480256.pptx |binary
sd/qa/unit/import-tests.cxx | 48 ++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+)
New commits:
commit 5681725f1a2535a13b86104d8b8a33f750f34efc
Author: Matúš Kukan <matus.kukan at collabora.com>
Date: Tue Sep 9 13:19:27 2014 +0200
bnc#480256: OOXML import: unit test for table background property
Change-Id: I97bf0bd1ea8cf8ece30a2fa328c5c7a8b0549a4a
diff --git a/sd/qa/unit/data/pptx/bnc480256.pptx b/sd/qa/unit/data/pptx/bnc480256.pptx
new file mode 100755
index 0000000..71e91c2
Binary files /dev/null and b/sd/qa/unit/data/pptx/bnc480256.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 259004c..f49d6aa 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();
More information about the Libreoffice-commits
mailing list