summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-09-25 09:03:54 +0200
committerTomaž Vajngerl <quikee@gmail.com>2023-12-06 08:23:34 +0100
commit1db193c6c744289139b1df2af0b8defcf974b238 (patch)
tree2651e967a8fb4c72ea7b715ee48aef648b993b62 /sw
parentfa38d98155a857908641380c7a1a5a34fafe934e (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 'sw')
-rw-r--r--sw/qa/extras/globalfilter/data/SvgImageTest.odtbin0 -> 13608 bytes
-rw-r--r--sw/qa/extras/globalfilter/globalfilter.cxx37
2 files changed, 37 insertions, 0 deletions
diff --git a/sw/qa/extras/globalfilter/data/SvgImageTest.odt b/sw/qa/extras/globalfilter/data/SvgImageTest.odt
new file mode 100644
index 000000000000..3b37fe7998ef
--- /dev/null
+++ b/sw/qa/extras/globalfilter/data/SvgImageTest.odt
Binary files differ
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
index c12e300ebfaa..3eda6b6354e8 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -68,6 +68,7 @@ public:
void testDropDownFormField();
void testDateFormField();
void testDateFormFieldCharacterFormatting();
+ void testSvgImageSupport();
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testEmbeddedGraphicRoundtrip);
@@ -91,6 +92,7 @@ public:
CPPUNIT_TEST(testDropDownFormField);
CPPUNIT_TEST(testDateFormField);
CPPUNIT_TEST(testDateFormFieldCharacterFormatting);
+ CPPUNIT_TEST(testSvgImageSupport);
CPPUNIT_TEST_SUITE_END();
};
@@ -2214,6 +2216,41 @@ void Test::testDateFormFieldCharacterFormatting()
}
}
+void Test::testSvgImageSupport()
+{
+ OUString aFilterNames[] = {
+ "writer8",
+ "Office Open XML Text",
+ };
+
+ for (OUString const & rFilterName : aFilterNames)
+ {
+ // Check whether the export code swaps in the image which was swapped out before by auto mechanism
+
+ createSwDoc("SvgImageTest.odt");
+
+ // Export the document and import again for a check
+ saveAndReload(rFilterName);
+
+ // Check whether graphic exported well after it was swapped out
+ const OString sFailedMessage = "Failed on filter: "_ostr + rFilterName.toUtf8();
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 1, getShapes());
+
+ // First image
+ uno::Reference<drawing::XShape> xImage(getShape(1), 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_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();