tdf#136949: sd_layout_tests: Add unittest

Change-Id: I1f0bf54f4d4207cf23c40bf26b1c977152912c8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103286
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sd/qa/unit/data/odp/tdf136949.odp b/sd/qa/unit/data/odp/tdf136949.odp
new file mode 100644
index 0000000..91f3017
--- /dev/null
+++ b/sd/qa/unit/data/odp/tdf136949.odp
Binary files differ
diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx
index d6643f8..953500d 100644
--- a/sd/qa/unit/layout-tests.cxx
+++ b/sd/qa/unit/layout-tests.cxx
@@ -12,10 +12,12 @@ class SdLayoutTest : public SdModelTestBaseXML
{
public:
    void testTdf104722();
    void testTdf136949();

    CPPUNIT_TEST_SUITE(SdLayoutTest);

    CPPUNIT_TEST(testTdf104722);
    CPPUNIT_TEST(testTdf136949);

    CPPUNIT_TEST_SUITE_END();
};
@@ -41,6 +43,26 @@ void SdLayoutTest::testTdf104722()
    xDocShRef->DoClose();
}

void SdLayoutTest::testTdf136949()
{
    sd::DrawDocShellRef xDocShRef
        = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf136949.odp"), ODP);

    std::shared_ptr<GDIMetaFile> xMetaFile = xDocShRef->GetPreviewMetaFile();
    MetafileXmlDump dumper;

    xmlDocUniquePtr pXmlDoc = XmlTestTools::dumpAndParse(dumper, *xMetaFile);
    CPPUNIT_ASSERT(pXmlDoc);

    // Without the fix in place, this test would have failed with
    // - Expected: 13687
    // - Actual  : 2832
    assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[7]/polyline/point[1]", "x", "13687");
    assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[7]/polyline/point[2]", "x", "24759");

    xDocShRef->DoClose();
}

CPPUNIT_TEST_SUITE_REGISTRATION(SdLayoutTest);

CPPUNIT_PLUGIN_IMPLEMENT();