summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/source/view/axes/VCartesianAxis.cxx7
-rw-r--r--sw/qa/extras/layout/data/tdf159443.odtbin0 -> 17838 bytes
-rw-r--r--sw/qa/extras/layout/layout3.cxx30
3 files changed, 37 insertions, 0 deletions
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index 8163058ad5e0..a0c4a329d76d 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -1687,6 +1687,13 @@ void VCartesianAxis::createDataTableShape(std::unique_ptr<TickFactory2D> const&
nDistance *= 2;
}
+ if (nDistance <= 0)
+ {
+ // we only have one data series so we have no TickMarks, therefor calculate and use the table size
+ auto rDelta = aEnd - aStart;
+ nDistance = basegfx::fround(rDelta.getX());
+ }
+
if (nDistance > 0)
{
m_pDataTableView->createShapes(aStart, aEnd, nDistance);
diff --git a/sw/qa/extras/layout/data/tdf159443.odt b/sw/qa/extras/layout/data/tdf159443.odt
new file mode 100644
index 000000000000..8ec733aedb06
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf159443.odt
Binary files differ
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index de11ac7d788d..f96b786cc093 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -2389,6 +2389,36 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testPageBreakInHiddenSection)
assertXPath(pXmlDoc, "//page[4]/body/section/infos/bounds"_ostr, "height"_ostr, u"0"_ustr);
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf159443)
+{
+ // Given a document with chart, which have a datatable
+ createSwDoc("tdf159443.odt");
+ SwDoc* pDoc = getSwDoc();
+ SwDocShell* pShell = pDoc->GetDocShell();
+
+ // Dump the rendering of the first page as an XML file.
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+ MetafileXmlDump dumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+ CPPUNIT_ASSERT(pXmlDoc);
+ //// Without the fix, this would fail:
+ //// - Expected: DataSeries1
+ //// - Actual : 1.25
+ //// - In <>, XPath contents of child does not match
+ assertXPathContent(
+ pXmlDoc,
+ "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/push[47]/textarray/text"_ostr,
+ "DataSeries1");
+ assertXPathContent(
+ pXmlDoc,
+ "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/push[49]/textarray/text"_ostr,
+ "Category1");
+ assertXPathContent(
+ pXmlDoc,
+ "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/push[51]/textarray/text"_ostr,
+ "4.3");
+}
+
} // end of anonymous namespace
CPPUNIT_PLUGIN_IMPLEMENT();