tdf#112126 Added Unit Test

Change-Id: Ia02d0846ee932188a90687a2f29183e34e01c4c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129922
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sd/qa/unit/data/tdf112126.odg b/sd/qa/unit/data/tdf112126.odg
new file mode 100644
index 0000000..f291a39
--- /dev/null
+++ b/sd/qa/unit/data/tdf112126.odg
Binary files differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 8d4898f..fd2380a 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -94,6 +94,7 @@ public:
    void testTdf140714();
    void testMasterPageBackgroundFullSize();
    void testColumnsODG();
    void testTdf112126();

    CPPUNIT_TEST_SUITE(SdExportTest);

@@ -141,7 +142,7 @@ public:
    CPPUNIT_TEST(testTdf140714);
    CPPUNIT_TEST(testMasterPageBackgroundFullSize);
    CPPUNIT_TEST(testColumnsODG);

    CPPUNIT_TEST(testTdf112126);
    CPPUNIT_TEST_SUITE_END();

    virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -1715,6 +1716,24 @@ void SdExportTest::testColumnsODG()
    tempFile.EnableKillingFile();
}

void SdExportTest::testTdf112126()
{
    sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/tdf112126.odg"), ODG);
    utl::TempFile tempFile;
    xDocShRef = saveAndReload(xDocShRef.get(), ODG, &tempFile);
    uno::Reference<drawing::XDrawPage> xPage(getPage(0, xDocShRef));
    uno::Reference<beans::XPropertySet> xPropertySet(xPage, uno::UNO_QUERY);

    OUString xPageName;
    xPropertySet->getPropertyValue("LinkDisplayName") >>= xPageName;

    // without the fix in place, it fails with
    // - Expected: Page 1
    // - Actual  : Slide 1
    CPPUNIT_ASSERT_EQUAL(OUString("Page 1"), xPageName);
    xDocShRef->DoClose();
}

CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);

CPPUNIT_PLUGIN_IMPLEMENT();