diff options
author | Sushil Shinde <sushil.shinde@synerzip.com> | 2015-03-03 19:14:25 +0530 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2015-03-20 08:13:00 +0000 |
commit | 63442ec636d637e05d7d585817df531dbbeb96d9 (patch) | |
tree | 7194425a0741d5be07c1c36533f1a9dc37ca47b0 /sd/qa | |
parent | 5f904b2646771b5270efc59dd38bcf4122741c12 (diff) |
tdf#89806 : Fixed background fill export for table cell.
1. Table cell properties were exproted empty if file
saved as .pptx file.
2. Now added code to export table cell fill properties
in 'tcPr'(Table cell properties xml tag)
3. Added unit test to check exported table cell fill
properties.
Change-Id: Ica6005a65c7eefb8629c808f2a54764f98badb11
Reviewed-on: https://gerrit.libreoffice.org/14734
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/data/odp/Table_with_Cell_Fill.odp | bin | 0 -> 28869 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 55 |
2 files changed, 55 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odp/Table_with_Cell_Fill.odp b/sd/qa/unit/data/odp/Table_with_Cell_Fill.odp Binary files differnew file mode 100644 index 000000000000..1a06f235e1df --- /dev/null +++ b/sd/qa/unit/data/odp/Table_with_Cell_Fill.odp diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index ed02bc99147b..d6645dd809e1 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -55,6 +55,8 @@ #include <com/sun/star/awt/XBitmap.hpp> #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> +#include <svx/svdotable.hxx> #include <config_features.h> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> @@ -81,6 +83,7 @@ public: void testSwappedOutImageExport(); void testLinkedGraphicRT(); void testImageWithSpecialID(); + void testTableCellFillProperties(); #if !defined WNT void testBnc822341(); #endif @@ -103,6 +106,7 @@ public: CPPUNIT_TEST(testSwappedOutImageExport); CPPUNIT_TEST(testLinkedGraphicRT); CPPUNIT_TEST(testImageWithSpecialID); + CPPUNIT_TEST(testTableCellFillProperties); #if !defined WNT CPPUNIT_TEST(testBnc822341); #endif @@ -725,6 +729,57 @@ void SdExportTest::testImageWithSpecialID() xDocShRef->DoClose(); } } +void SdExportTest::testTableCellFillProperties() +{ + std::shared_ptr< comphelper::ConfigurationChanges > batch(comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Cache::GraphicManager::TotalCacheSize::set(sal_Int32(1), batch); + batch->commit(); + + // Load the original file + ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/Table_with_Cell_Fill.odp"), ODP); + + // Export the document and import again for a check + uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY); + uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); + utl::MediaDescriptor aMediaDescriptor; + aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[PPTX].pFilterName), RTL_TEXTENCODING_UTF8); + + utl::TempFile aTempFile; + aTempFile.EnableKillingFile(); + xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); + xComponent.set(xStorable, uno::UNO_QUERY); + xComponent->dispose(); + xDocShRef = loadURL(aTempFile.GetURL(), PPTX); + + 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 = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0)); + CPPUNIT_ASSERT( pTableObj ); + uno::Reference< table::XCellRange > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW); + uno::Reference< beans::XPropertySet > xCell; + + // Test Solid fill color + sal_Int32 nColor; + xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW); + xCell->getPropertyValue("FillColor") >>= nColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(6750207), nColor); + + // Test Picture fill type for cell + drawing::FillStyle aFillStyle( drawing::FillStyle_NONE ); + xCell.set(xTable->getCellByPosition(0, 1), uno::UNO_QUERY_THROW); + xCell->getPropertyValue("FillStyle") >>= aFillStyle; + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, aFillStyle); + + // Test Gradient fill type for cell + xCell.set(xTable->getCellByPosition(1, 0), uno::UNO_QUERY_THROW); + xCell->getPropertyValue("FillStyle") >>= aFillStyle; + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, aFillStyle); + + xDocShRef->DoClose(); +} #if !defined WNT |