summaryrefslogtreecommitdiff
path: root/xmloff/qa/unit
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-03-28 18:21:04 +0200
committerRegina Henschel <rb.henschel@t-online.de>2021-10-28 14:15:35 +0200
commit773465fb95c1be48f8fdf406d2d39caa142050db (patch)
tree0a68a536590bca7ca589bfd35943de420e2d9caf /xmloff/qa/unit
parent899434244fb8b632159a82c1f61262a15058708c (diff)
tdf#141301: extrusion-skew angle value -135 is not written to file...
whereas it should since not default value (Regina) Hopefully in some years missing values are unlikely and bug tdf#141127 can be fixed. (Regina) I have added a unit test to Julien's patch. Change-Id: Ia2aabd8e724e3c3db9ae8a87cb27707aa7040fb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113257 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'xmloff/qa/unit')
-rw-r--r--xmloff/qa/unit/data/tdf141301_Extrusion_Skew.odgbin0 -> 9838 bytes
-rw-r--r--xmloff/qa/unit/draw.cxx38
2 files changed, 37 insertions, 1 deletions
diff --git a/xmloff/qa/unit/data/tdf141301_Extrusion_Skew.odg b/xmloff/qa/unit/data/tdf141301_Extrusion_Skew.odg
new file mode 100644
index 000000000000..757289d43849
--- /dev/null
+++ b/xmloff/qa/unit/data/tdf141301_Extrusion_Skew.odg
Binary files differ
diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx
index d386e92a2da6..3b0cda0f0383 100644
--- a/xmloff/qa/unit/draw.cxx
+++ b/xmloff/qa/unit/draw.cxx
@@ -9,21 +9,26 @@
#include <test/bootstrapfixture.hxx>
#include <unotest/macros_test.hxx>
+#include <test/xmltesttools.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
#include <unotools/mediadescriptor.hxx>
#include <unotools/tempfile.hxx>
+#include <unotools/ucbstreamhelper.hxx>
using namespace ::com::sun::star;
constexpr OUStringLiteral DATA_DIRECTORY = u"/xmloff/qa/unit/data/";
/// Covers xmloff/source/draw/ fixes.
-class XmloffDrawTest : public test::BootstrapFixture, public unotest::MacrosTest
+class XmloffDrawTest : public test::BootstrapFixture,
+ public unotest::MacrosTest,
+ public XmlTestTools
{
private:
uno::Reference<lang::XComponent> mxComponent;
@@ -31,6 +36,7 @@ private:
public:
void setUp() override;
void tearDown() override;
+ void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override;
uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
};
@@ -49,6 +55,11 @@ void XmloffDrawTest::tearDown()
test::BootstrapFixture::tearDown();
}
+void XmloffDrawTest::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
+{
+ XmlTestTools::registerODFNamespaces(pXmlXpathCtx);
+}
+
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextBoxLoss)
{
// Load a document that has a shape with a textbox in it. Save it to ODF and reload.
@@ -75,6 +86,31 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextBoxLoss)
CPPUNIT_ASSERT(bTextBox);
}
+CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf141301_Extrusion_Angle)
+{
+ // Load a document that has a custom shape with extrusion direction as set by LO as its default.
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf141301_Extrusion_Skew.odg";
+ getComponent() = loadFromDesktop(aURL, "com.sun.star.comp.drawing.DrawingDocument");
+
+ // Prepare use of XPath
+ uno::Reference<frame::XStorable> xStorable(getComponent(), uno::UNO_QUERY);
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ utl::MediaDescriptor aMediaDescriptor;
+ aMediaDescriptor["FilterName"] <<= OUString("draw8");
+ xStorable->storeAsURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
+ uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
+ = packages::zip::ZipFileAccess::createWithURL(mxComponentContext, aTempFile.GetURL());
+ uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName("content.xml"),
+ uno::UNO_QUERY);
+ std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
+ xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+
+ // Without fix draw:extrusion-skew="50 -135" was not written to file although "50 -135" is not
+ // default in ODF, but only default inside LO.
+ assertXPath(pXmlDoc, "//draw:enhanced-geometry", "extrusion-skew", "50 -135");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */