summaryrefslogtreecommitdiff
path: root/sd/qa
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-09-23 15:27:51 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2020-09-23 17:38:37 +0200
commit701b46ae0e8d6eb162d8cb307f5a72e35f4a36a8 (patch)
treea67043e2fb89bc8fc4d68577d0810f6cbd28e252 /sd/qa
parent2db32eb614c9138e64779d5e5fc58e8cd6a9cf00 (diff)
tdf#104722: sd_layout_tests: Add unittest
Change-Id: I5b255330a3cdd6bc9a5e6d47d894a6f6346d69bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103251 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sd/qa')
-rw-r--r--sd/qa/unit/data/pptx/tdf104722.pptxbin0 -> 40497 bytes
-rw-r--r--sd/qa/unit/layout-tests.cxx48
2 files changed, 48 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf104722.pptx b/sd/qa/unit/data/pptx/tdf104722.pptx
new file mode 100644
index 000000000000..27ea41958029
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf104722.pptx
Binary files differ
diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx
new file mode 100644
index 000000000000..d6643f82420a
--- /dev/null
+++ b/sd/qa/unit/layout-tests.cxx
@@ -0,0 +1,48 @@
+/* -*- 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 "sdmodeltestbase.hxx"
+
+class SdLayoutTest : public SdModelTestBaseXML
+{
+public:
+ void testTdf104722();
+
+ CPPUNIT_TEST_SUITE(SdLayoutTest);
+
+ CPPUNIT_TEST(testTdf104722);
+
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void SdLayoutTest::testTdf104722()
+{
+ sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf104722.pptx"), PPTX);
+
+ std::shared_ptr<GDIMetaFile> xMetaFile = xDocShRef->GetPreviewMetaFile();
+ MetafileXmlDump dumper;
+
+ xmlDocUniquePtr pXmlDoc = XmlTestTools::dumpAndParse(dumper, *xMetaFile);
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ // Without the fix in place, this would have failed with
+ // - Expected: 2093
+ // - Actual : -10276
+ assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]", "x", "2093");
+
+ assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]", "y", "9273");
+
+ xDocShRef->DoClose();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SdLayoutTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */