diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-12-16 14:19:16 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-12-17 09:08:18 +0100 |
commit | 252cdd5f43d65095543e317d37e1a0ea4fd839e0 (patch) | |
tree | fc1e26212a7b12f8ede93a2d7b8e84db5d9f7b9e /oox/qa | |
parent | e6915d4be4d576fdfd4d612c7968f493edba62c5 (diff) |
tdf#129961 oox: add PPTX export for table shadow as direct format
Custom shapes export shadow as part of WriteShapeEffects(), so use the
same for table shapes as well.
This needs fixing the effect export up a bit, because table shapes have
no interop grab-bag, glow or soft edge properties, but the rest of the
code can be shared.
Change-Id: Icf0b90c5b44e3d9c4115c9f3b0d56ba0852ab640
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107836
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox/qa')
-rw-r--r-- | oox/qa/unit/drawingml.cxx | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index d666b3d332a7..c7e72d458194 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -293,21 +293,37 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testCameraRotationRevolution) CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTableShadow) { + auto verify = [](const uno::Reference<lang::XComponent>& xComponent) { + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(xComponent, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage( + xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + bool bShadow = false; + CPPUNIT_ASSERT(xShape->getPropertyValue("Shadow") >>= bShadow); + + CPPUNIT_ASSERT(bShadow); + sal_Int32 nColor = 0; + CPPUNIT_ASSERT(xShape->getPropertyValue("ShadowColor") >>= nColor); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xff0000), nColor); + }; OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "table-shadow.pptx"; load(aURL); - uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); - uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), - uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); - bool bShadow = false; - CPPUNIT_ASSERT(xShape->getPropertyValue("Shadow") >>= bShadow); - // Without the accompanying fix in place, this test would have failed, because shadow on a table // was lost on import. - CPPUNIT_ASSERT(bShadow); - sal_Int32 nColor = 0; - CPPUNIT_ASSERT(xShape->getPropertyValue("ShadowColor") >>= nColor); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xff0000), nColor); + verify(getComponent()); + + uno::Reference<frame::XStorable> xStorable(getComponent(), uno::UNO_QUERY); + utl::MediaDescriptor aMediaDescriptor; + aMediaDescriptor["FilterName"] <<= OUString("Impress Office Open XML"); + utl::TempFile aTempFile; + aTempFile.EnableKillingFile(); + xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); + getComponent()->dispose(); + validate(aTempFile.GetFileName(), test::OOXML); + getComponent() = loadFromDesktop(aTempFile.GetURL()); + // Without the accompanying fix in place, this test would have failed, because shadow on a table + // was lost on export. + verify(getComponent()); } CPPUNIT_PLUGIN_IMPLEMENT(); |