sd/qa/unit/data/pptx/tdf146731.pptx |binary
 sd/qa/unit/layout-tests.cxx         |   26 ++++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

New commits:
commit 703167d4fb6e1d1e7bb72bfd79cfa0ae140ca89f
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Jan 17 18:33:58 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Jan 17 21:32:08 2022 +0100

    tdf#146731: sd_layout: Add unittest
    
    Change-Id: I50e7c1e89a217c845612d02942a22d9ef1abbea8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128511
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sd/qa/unit/data/pptx/tdf146731.pptx 
b/sd/qa/unit/data/pptx/tdf146731.pptx
new file mode 100644
index 000000000000..3862e45461a3
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf146731.pptx differ
diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx
index 102c6a8153b0..4ea92807c49a 100644
--- a/sd/qa/unit/layout-tests.cxx
+++ b/sd/qa/unit/layout-tests.cxx
@@ -17,6 +17,7 @@ public:
     void testTdf128212();
     void testColumnsLayout();
     void tdf143258_testTbRlLayout();
+    void testTdf146731();
 
     CPPUNIT_TEST_SUITE(SdLayoutTest);
 
@@ -26,6 +27,7 @@ public:
     CPPUNIT_TEST(testTdf128212);
     CPPUNIT_TEST(testColumnsLayout);
     CPPUNIT_TEST(tdf143258_testTbRlLayout);
+    CPPUNIT_TEST(testTdf146731);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -276,6 +278,30 @@ void SdLayoutTest::tdf143258_testTbRlLayout()
     xDocShRef->DoClose();
 }
 
+void SdLayoutTest::testTdf146731()
+{
+    sd::DrawDocShellRef xDocShRef
+        = 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf146731.pptx"), 
PPTX);
+
+    std::shared_ptr<GDIMetaFile> xMetaFile = xDocShRef->GetPreviewMetaFile();
+    MetafileXmlDump dumper;
+
+    xmlDocUniquePtr pXmlDoc = XmlTestTools::dumpAndParse(dumper, *xMetaFile);
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[3]/polyline[1]", 
"width", "187");
+    assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[4]/polyline[1]", 
"width", "187");
+    assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[5]/polyline[1]", 
"width", "187");
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: 30
+    // - Actual  : 187
+    assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[6]/polyline[1]", 
"width", "30");
+    assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[7]/polyline[1]", 
"width", "187");
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdLayoutTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();

Reply via email to