summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-01-29 13:55:05 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-01-29 19:02:39 +0100
commit71a737c5b81bdf9dce75f8f575da2f98e70f0418 (patch)
tree36773b222da05a13d33b325013b64161cc7738a1 /sd
parent5f10bae4559aa7eb6cc7988a320bfbf588b13edc (diff)
tdf#146876: sd_layout_tests: Add unittest
Change-Id: I4df3b153750be8d650f2c3b0ea5bd840b4397c27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129134 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/odp/tdf146876.odpbin0 -> 11620 bytes
-rw-r--r--sd/qa/unit/layout-tests.cxx35
2 files changed, 35 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odp/tdf146876.odp b/sd/qa/unit/data/odp/tdf146876.odp
new file mode 100644
index 000000000000..edb361fbab30
--- /dev/null
+++ b/sd/qa/unit/data/odp/tdf146876.odp
Binary files differ
diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx
index 32a1d40f0191..25c70341ea1c 100644
--- a/sd/qa/unit/layout-tests.cxx
+++ b/sd/qa/unit/layout-tests.cxx
@@ -56,6 +56,41 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf135843)
xDocShRef->DoClose();
}
+CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf146876)
+{
+ sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf146876.odp"), ODP);
+
+ std::shared_ptr<GDIMetaFile> xMetaFile = xDocShRef->GetPreviewMetaFile();
+ MetafileXmlDump dumper;
+
+ xmlDocUniquePtr pXmlDoc = XmlTestTools::dumpAndParse(dumper, *xMetaFile);
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ // Check the shape is inside the (5000,8500) - (11500,12500) area
+ for (size_t i = 2; i < 4; ++i)
+ {
+ for (size_t j = 1; j < 6; ++j)
+ {
+ const OString xPath = "/metafile/push[1]/push[1]/push[" + OString::number(i)
+ + "]/polyline/point[" + OString::number(j) + "]";
+ const sal_Int32 nX = getXPath(pXmlDoc, xPath.getStr(), "x").toInt32();
+ const sal_Int32 nY = getXPath(pXmlDoc, xPath.getStr(), "y").toInt32();
+
+ // Without the fix in place, this test would have failed with
+ // - Expected greater or equal than: 5000
+ // - Actual : 0
+ CPPUNIT_ASSERT_GREATEREQUAL(sal_Int32(5000), nX);
+ CPPUNIT_ASSERT_LESSEQUAL(sal_Int32(11500), nX);
+
+ CPPUNIT_ASSERT_GREATEREQUAL(sal_Int32(8500), nY);
+ CPPUNIT_ASSERT_LESSEQUAL(sal_Int32(12500), nY);
+ }
+ }
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf136949)
{
sd::DrawDocShellRef xDocShRef