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 <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli
2022-01-17 18:33:58 +01:00
parent e7b01e4a5a
commit 703167d4fb
2 changed files with 26 additions and 0 deletions

Binary file not shown.

View File

@@ -17,6 +17,7 @@ public:
void testTdf128212(); void testTdf128212();
void testColumnsLayout(); void testColumnsLayout();
void tdf143258_testTbRlLayout(); void tdf143258_testTbRlLayout();
void testTdf146731();
CPPUNIT_TEST_SUITE(SdLayoutTest); CPPUNIT_TEST_SUITE(SdLayoutTest);
@@ -26,6 +27,7 @@ public:
CPPUNIT_TEST(testTdf128212); CPPUNIT_TEST(testTdf128212);
CPPUNIT_TEST(testColumnsLayout); CPPUNIT_TEST(testColumnsLayout);
CPPUNIT_TEST(tdf143258_testTbRlLayout); CPPUNIT_TEST(tdf143258_testTbRlLayout);
CPPUNIT_TEST(testTdf146731);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
}; };
@@ -276,6 +278,30 @@ void SdLayoutTest::tdf143258_testTbRlLayout()
xDocShRef->DoClose(); 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_TEST_SUITE_REGISTRATION(SdLayoutTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();