diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-09-25 09:03:54 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-12-06 08:23:34 +0100 |
commit | 1db193c6c744289139b1df2af0b8defcf974b238 (patch) | |
tree | 2651e967a8fb4c72ea7b715ee48aef648b993b62 /sd | |
parent | fa38d98155a857908641380c7a1a5a34fafe934e (diff) |
tdf#126084 import svg image from ooxml document that use svgBlip elem.
In an OOXML document the svg image is defined in an svgBlip, which
is an OOXML extension. This change checks for the svgBlip element
and imports that instead the normal "blip" element that is still
provided as a fallback (PNG image).
Add roundtrip SVG image test for ODF and OOXML, Impress and Writer.
testGraphicBlipXLSX test failed after this change, because some
component was missing. Changed to enable use_rdb for all chart2
export tests, so issues like this won't happen anymore.
Change-Id: Idf0e754775254d7dcfd0321dfca2ed6d00c42c09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157238
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/odp/SvgImageTest.odp | bin | 0 -> 15922 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 31 |
2 files changed, 31 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odp/SvgImageTest.odp b/sd/qa/unit/data/odp/SvgImageTest.odp Binary files differnew file mode 100644 index 000000000000..38b92df80896 --- /dev/null +++ b/sd/qa/unit/data/odp/SvgImageTest.odp diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index c39d110c3022..92b36ecacce7 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -1927,6 +1927,37 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testTdf153179) CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getPage(0)->getCount()); } +CPPUNIT_TEST_FIXTURE(SdExportTest, testSvgImageSupport) +{ + for (OUString const& rFormat : { u"impress8"_ustr, u"Impress Office Open XML"_ustr }) + { + // Load the original file + createSdImpressDoc("odp/SvgImageTest.odp"); + const OString sFailedMessage = "Failed on filter: " + rFormat.toUtf8(); + saveAndReload(rFormat); + + // Check whether graphic was exported well + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, + uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_Int32(1), + xDrawPagesSupplier->getDrawPages()->getCount()); + uno::Reference<drawing::XDrawPage> xDrawPage( + xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xDrawPage.is()); + uno::Reference<drawing::XShape> xImage(xDrawPage->getByIndex(0), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet(xImage, uno::UNO_QUERY_THROW); + + uno::Reference<graphic::XGraphic> xGraphic; + xPropertySet->getPropertyValue("Graphic") >>= xGraphic; + CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is()); + Graphic aGraphic(xGraphic); + auto pVectorGraphic = aGraphic.getVectorGraphicData(); + CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pVectorGraphic); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), VectorGraphicDataType::Svg, + pVectorGraphic->getType()); + } +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |