From 267c6f2ac71f92999e969232431ba04678e7437e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 07:54:39 +0200 Subject: Adding upstream version 4:24.2.0. Signed-off-by: Daniel Baumann --- sw/qa/extras/fodfexport/data/SvgImageTest.fodt | 321 +++++++++++++++++++++ .../fodfexport/data/tdf113696-writerimage.odt | Bin 0 -> 18341 bytes sw/qa/extras/fodfexport/data/tdf113696.odt | Bin 0 -> 10731 bytes sw/qa/extras/fodfexport/fodfexport.cxx | 79 +++++ 4 files changed, 400 insertions(+) create mode 100644 sw/qa/extras/fodfexport/data/SvgImageTest.fodt create mode 100644 sw/qa/extras/fodfexport/data/tdf113696-writerimage.odt create mode 100644 sw/qa/extras/fodfexport/data/tdf113696.odt create mode 100644 sw/qa/extras/fodfexport/fodfexport.cxx (limited to 'sw/qa/extras/fodfexport') diff --git a/sw/qa/extras/fodfexport/data/SvgImageTest.fodt b/sw/qa/extras/fodfexport/data/SvgImageTest.fodt new file mode 100644 index 0000000000..4246a7cb5e --- /dev/null +++ b/sw/qa/extras/fodfexport/data/SvgImageTest.fodt @@ -0,0 +1,321 @@ + + + + 2023-12-01T21:40:25.0108966092023-12-02T14:20:24.763250978PT2M41S2LibreOffice/7.6.3.1$Linux_X86_64 LibreOffice_project/60$Build-1 + + + 0 + 0 + 58104 + 33657 + true + false + + + view2 + 20551 + 17866 + 0 + 0 + 58103 + 33655 + 0 + 1 + false + 100 + false + false + false + false + false + false + + + + + true + false + true + false + true + false + false + 0 + true + false + true + false + false + false + false + true + false + false + + false + false + true + false + false + true + true + false + false + false + false + false + false + true + false + false + 925541 + false + + true + false + false + 982611 + true + false + false + false + 1 + true + true + false + false + true + false + false + true + true + true + false + true + 0 + + false + true + true + true + + 0 + true + false + false + false + high-resolution + true + true + false + false + true + false + false + false + false + true + + true + false + true + false + + false + false + false + true + false + false + false + false + false + false + false + false + false + false + 0 + true + false + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCEtLSBDcmVhdGVkIHdp + dGggSW5rc2NhcGUgKGh0dHA6Ly93d3cuaW5rc2NhcGUub3JnLykgLS0+Cjxzdmcgd2lkdGg9 + IjEwbW0iIGhlaWdodD0iMTBtbSIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTAgMTAi + IHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiA8cmVjdCB4PSIxIiB5PSIx + IiB3aWR0aD0iOCIgaGVpZ2h0PSI4IiByeD0iMiIgcnk9IjIiIGZpbGw9IiMwZmM5NTQiIHN0 + cm9rZS13aWR0aD0iMi4xMTY3Ii8+Cjwvc3ZnPgo= + + + + iVBORw0KGgoAAAANSUhEUgAAACcAAAAnCAYAAACMo1E1AAABqklEQVRYhe2Yu0oDQRiFzxkV + xCLpUihaii9gtIyXeKmDzyBIfBltxEcIWtoYCWurWKutly5CVlALszkWEsGZzaqru4mwX3lm + lv9j57Y7lIRBxfRbIIpMLi7DX3XgxeZILmguQiyTHP/OMxG0BdxDqj++NBsqee3I2lELIn9W + WaW4A3L6F0LhSNeS2fbna/Ufy+XPN7Yo7QAc+nOxDxQIqPrFg71vy+XPKqsEj5IV66IA1Fpr + 9vDEbnEWBL3SMMWE39inikPomF16JWcuO3K5scJyInMsCmImN1pYsOOQrURLafg4mE7ZieyA + 0mQ6NnZdTNmZIydwLB2dr+sO9AmRycUlk4tLJheXTC4umVxcMrm4/C85Qs/9ECH1ZGfu9xx5 + m46OVRe4sTN3WKWe/5FJQuDYzhy5x5dmA9J1OkpddOk/N0/t1B3WkteWzDagICWxADLVsKuJ + 0NXqz9fqAqrJCyqAzFZrrtYIa+25lfjFgz11zDqEq4TELiGz0pqr7ffqEXmRA7zfAORGCwsw + nTKFCZAj8X30KuKOVN1/evB+dcvUb/7XCTFIDLTcG/DxnDT71BIPAAAAAElFTkSuQmCC + + + + + + \ No newline at end of file diff --git a/sw/qa/extras/fodfexport/data/tdf113696-writerimage.odt b/sw/qa/extras/fodfexport/data/tdf113696-writerimage.odt new file mode 100644 index 0000000000..f8aee08360 Binary files /dev/null and b/sw/qa/extras/fodfexport/data/tdf113696-writerimage.odt differ diff --git a/sw/qa/extras/fodfexport/data/tdf113696.odt b/sw/qa/extras/fodfexport/data/tdf113696.odt new file mode 100644 index 0000000000..03e0612a3d Binary files /dev/null and b/sw/qa/extras/fodfexport/data/tdf113696.odt differ diff --git a/sw/qa/extras/fodfexport/fodfexport.cxx b/sw/qa/extras/fodfexport/fodfexport.cxx new file mode 100644 index 0000000000..2cf5bf42a7 --- /dev/null +++ b/sw/qa/extras/fodfexport/fodfexport.cxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include +#include +#include + +class Test : public SwModelTestBase +{ +public: + Test() + : SwModelTestBase("/sw/qa/extras/fodfexport/data/", "OpenDocument Text Flat XML") + { + } +}; + +DECLARE_FODFEXPORT_TEST(testTdf113696, "tdf113696.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + // Test that an image which is written in svm format (image/x-vclgraphic) + // is accompanied by a png fallback graphic. + if (xmlDocUniquePtr pXmlDoc = parseExportedFile()) + { + assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/" + "draw:image[@draw:mime-type='image/x-vclgraphic']"_ostr); + assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/" + "draw:image[@draw:mime-type='image/png']"_ostr); + } +} + +DECLARE_FODFEXPORT_TEST(testTdf113696WriterImage, "tdf113696-writerimage.odt") +{ + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + // Same as testTdf113696, but with a writer image instead of a draw image + // (they use different code paths). + if (xmlDocUniquePtr pXmlDoc = parseExportedFile()) + { + assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/" + "draw:image[@draw:mime-type='image/x-vclgraphic']"_ostr); + assertXPath(pXmlDoc, "/office:document/office:body/office:text/text:p/draw:frame/" + "draw:image[@draw:mime-type='image/png']"_ostr); + } +} + +DECLARE_FODFEXPORT_TEST(testSvgImageRoundtrip, "SvgImageTest.fodt") +{ + // Related to tdf#123396 + + // We should have one image (shape) + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + + // Get the shape and extract the Graphic + uno::Reference xShape = getShape(1); + uno::Reference XPropertySet(xShape, uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT(XPropertySet.is()); + uno::Reference xGraphic; + XPropertySet->getPropertyValue("Graphic") >>= xGraphic; + CPPUNIT_ASSERT(xGraphic.is()); + Graphic aGraphic(xGraphic); + + // The graphic should be SVG - so should contain a VectorGraphicData + auto const& pVectorGraphicData = aGraphic.getVectorGraphicData(); + CPPUNIT_ASSERT(pVectorGraphicData); + + // The VectorGraphicData type should be SVG + CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Svg, pVectorGraphicData->getType()); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3