summaryrefslogtreecommitdiff
path: root/chart2/qa/extras
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-12-10 12:34:50 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-12-14 12:56:52 +0000
commit56e17186ffcda7e93530bef3a06120584bb7d579 (patch)
tree71f3de002cb1e822da6d7fc5d5241dd94f45d8f8 /chart2/qa/extras
parent8bdb85f8c7f31e51328afa51a584c3cfdea1c06f (diff)
[API CHANGE] Merge sfx2::XmlDump into css::qa::XDumper
Both sfx2::XmlDump and css::qa::XDumper were (only) used to dump various data from ChartModel and ChartView instances in debugging (e.g., F12 and Shift-F12 in an SW_DEBUG=1 Writer) and testing scenarios. The problem with XmlDump was that it was used as the target of a dynamic_cast from a UNO type, which is dangerous (see the upcoming commit introducing loplugin:unocast for details). One fix would have been to replace that dynamic_cast with a use of XUnoTunnel, and make ChartModel and ChartView implement that. But those classes already implement XDumper, so it looks more natural to use XDumper for that purpose too. However, the information that was obtained via XDumper was rather different from the information that was obtained via XmlDump. So make an incompatible change to the (unpublished) XDumper, adding a kind parameter distinguishing the original behavior of XDumper (kind == "shapes") from the original behavior of XmlDump (kind == ""). Change-Id: Ia7379bedfc45ab62a298fdc2f030cebaf21c4885 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144145 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'chart2/qa/extras')
-rw-r--r--chart2/qa/extras/xshape/chart2xshape.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/chart2/qa/extras/xshape/chart2xshape.cxx b/chart2/qa/extras/xshape/chart2xshape.cxx
index 23e3f93eaafa..92605a71199c 100644
--- a/chart2/qa/extras/xshape/chart2xshape.cxx
+++ b/chart2/qa/extras/xshape/chart2xshape.cxx
@@ -63,6 +63,11 @@ private:
namespace
{
+OUString getShapeDump(css::uno::Reference<css::chart::XChartDocument> const& doc)
+{
+ return css::uno::Reference<css::qa::XDumper>(doc, css::uno::UNO_QUERY_THROW)->dump("shapes");
+}
+
bool checkDumpAgainstFile(std::u16string_view rDump, std::u16string_view aFilePath,
char const* toleranceFile)
{
@@ -80,8 +85,7 @@ OUString Chart2XShapeTest::getXShapeDumpString()
{
uno::Reference<chart::XChartDocument> xChartDoc(getChartCompFromSheet(0, 0, mxComponent),
UNO_QUERY_THROW);
- uno::Reference<qa::XDumper> xDumper(xChartDoc, UNO_QUERY_THROW);
- return xDumper->dump();
+ return getShapeDump(xChartDoc);
}
xmlDocUniquePtr Chart2XShapeTest::getXShapeDumpXmlDoc()
@@ -132,8 +136,7 @@ void Chart2XShapeTest::testTdf149204()
// - Attr: sizeX
loadFromURL(u"pptx/tdf149204.pptx");
uno::Reference<chart::XChartDocument> xChartDoc = getChartDocFromDrawImpress(0, 0);
- uno::Reference<qa::XDumper> xDumper(xChartDoc, UNO_QUERY_THROW);
- compareAgainstReference(xDumper->dump(), u"tdf149204.xml");
+ compareAgainstReference(getShapeDump(xChartDoc), u"tdf149204.xml");
}
void Chart2XShapeTest::testTdf151424()
@@ -251,8 +254,7 @@ void Chart2XShapeTest::testTdf88154LabelRotatedLayout()
{
loadFromURL(u"pptx/tdf88154_LabelRotatedLayout.pptx");
uno::Reference<chart::XChartDocument> xChartDoc = getChartDocFromDrawImpress(0, 5);
- uno::Reference<qa::XDumper> xDumper(xChartDoc, UNO_QUERY_THROW);
- OUString rDump = xDumper->dump();
+ OUString rDump = getShapeDump(xChartDoc);
OString aXmlDump = OUStringToOString(rDump, RTL_TEXTENCODING_UTF8);
xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast<const xmlChar*>(aXmlDump.getStr())));