[Libreoffice-commits] core.git: sc/qa test/source
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jun 4 10:29:09 UTC 2021
sc/qa/unit/pivottable_filters_test.cxx | 34 ------------------------
sc/qa/unit/subsequent_export-test.cxx | 34 +-----------------------
sc/qa/unit/subsequent_export-test2.cxx | 45 +--------------------------------
test/source/xmltesttools.cxx | 14 ++++++++++
4 files changed, 19 insertions(+), 108 deletions(-)
New commits:
commit 2b62ead4dab909438a1d68f879f6f0329ca9291d
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Jun 4 10:30:19 2021 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Jun 4 12:28:26 2021 +0200
sc: use XmlTestTools::registerOOXMLNamespaces()
after 1ba1bb1cacdc8825d01559859100a2b575967e55
<test: introduce XmlTestTools::registerOOXMLNamespaces() to reduce
copy&paste>
Change-Id: I5f8fcb977233c30bae74e7cc9fde45d41a523b85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116686
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx
index f03b874ba7f3..cfca0c29cadf 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -176,39 +176,7 @@ void ScPivotTableFiltersTest::tearDown()
void ScPivotTableFiltersTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
{
- static const struct
- {
- xmlChar* pPrefix;
- xmlChar* pURI;
- } aNamespaces[] = {
- { BAD_CAST("w"), BAD_CAST("http://schemas.openxmlformats.org/wordprocessingml/2006/main") },
- { BAD_CAST("x"), BAD_CAST("http://schemas.openxmlformats.org/spreadsheetml/2006/main") },
- { BAD_CAST("v"), BAD_CAST("urn:schemas-microsoft-com:vml") },
- { BAD_CAST("c"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/chart") },
- { BAD_CAST("a"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/main") },
- { BAD_CAST("mc"), BAD_CAST("http://schemas.openxmlformats.org/markup-compatibility/2006") },
- { BAD_CAST("wps"),
- BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingShape") },
- { BAD_CAST("wpg"),
- BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingGroup") },
- { BAD_CAST("wp"),
- BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing") },
- { BAD_CAST("office"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:office:1.0") },
- { BAD_CAST("table"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:table:1.0") },
- { BAD_CAST("text"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:text:1.0") },
- { BAD_CAST("style"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:style:1.0") },
- { BAD_CAST("draw"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:drawing:1.0") },
- { BAD_CAST("xlink"), BAD_CAST("http://www.w3c.org/1999/xlink") },
- { BAD_CAST("xdr"),
- BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing") },
- { BAD_CAST("x"), BAD_CAST("http://schemas.openxmlformats.org/spreadsheetml/2006/main") },
- { BAD_CAST("r"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/relationships") },
- { BAD_CAST("number"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0") }
- };
- for (size_t i = 0; i < SAL_N_ELEMENTS(aNamespaces); ++i)
- {
- xmlXPathRegisterNs(pXmlXPathCtx, aNamespaces[i].pPrefix, aNamespaces[i].pURI);
- }
+ XmlTestTools::registerOOXMLNamespaces(pXmlXPathCtx);
}
namespace
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index adbf755bb462..bb22dbfefe36 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -318,38 +318,8 @@ private:
void ScExportTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
{
- static const struct { xmlChar* pPrefix; xmlChar* pURI; } aNamespaces[] =
- {
- { BAD_CAST("w"), BAD_CAST("http://schemas.openxmlformats.org/wordprocessingml/2006/main") },
- { BAD_CAST("x"), BAD_CAST("http://schemas.openxmlformats.org/spreadsheetml/2006/main") },
- { BAD_CAST("v"), BAD_CAST("urn:schemas-microsoft-com:vml") },
- { BAD_CAST("c"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/chart") },
- { BAD_CAST("a"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/main") },
- { BAD_CAST("mc"), BAD_CAST("http://schemas.openxmlformats.org/markup-compatibility/2006") },
- { BAD_CAST("wps"), BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingShape") },
- { BAD_CAST("wpg"), BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingGroup") },
- { BAD_CAST("wp"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing") },
- { BAD_CAST("office"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:office:1.0") },
- { BAD_CAST("table"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:table:1.0") },
- { BAD_CAST("text"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:text:1.0") },
- { BAD_CAST("style"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:style:1.0") },
- { BAD_CAST("draw"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:drawing:1.0") },
- { BAD_CAST("xlink"), BAD_CAST("http://www.w3c.org/1999/xlink") },
- { BAD_CAST("xdr"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing") },
- { BAD_CAST("xx"), BAD_CAST("urn:schemas-microsoft-com:office:excel") },
- { BAD_CAST("r"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/relationships") },
- { BAD_CAST("number"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0") },
- { BAD_CAST("loext"), BAD_CAST("urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0") },
- { BAD_CAST("tableooo"), BAD_CAST("http://openoffice.org/2009/table") },
- { BAD_CAST("ContentType"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/content-types") },
- { BAD_CAST("x14"), BAD_CAST("http://schemas.microsoft.com/office/spreadsheetml/2009/9/main") },
- { BAD_CAST("xm"), BAD_CAST("http://schemas.microsoft.com/office/excel/2006/main") },
- { BAD_CAST("x12ac"), BAD_CAST("http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac") },
- };
- for(size_t i = 0; i < SAL_N_ELEMENTS(aNamespaces); ++i)
- {
- xmlXPathRegisterNs(pXmlXPathCtx, aNamespaces[i].pPrefix, aNamespaces[i].pURI );
- }
+ XmlTestTools::registerOOXMLNamespaces(pXmlXPathCtx);
+ XmlTestTools::registerODFNamespaces(pXmlXPathCtx);
}
void ScExportTest::test()
diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx
index 5bfcaf0778fe..a47b9a413996 100644
--- a/sc/qa/unit/subsequent_export-test2.cxx
+++ b/sc/qa/unit/subsequent_export-test2.cxx
@@ -311,49 +311,8 @@ void ScExportTest2::tearDown()
void ScExportTest2::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
{
- static const struct
- {
- xmlChar* pPrefix;
- xmlChar* pURI;
- } aNamespaces[] = {
- { BAD_CAST("w"), BAD_CAST("http://schemas.openxmlformats.org/wordprocessingml/2006/main") },
- { BAD_CAST("x"), BAD_CAST("http://schemas.openxmlformats.org/spreadsheetml/2006/main") },
- { BAD_CAST("v"), BAD_CAST("urn:schemas-microsoft-com:vml") },
- { BAD_CAST("c"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/chart") },
- { BAD_CAST("a"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/main") },
- { BAD_CAST("mc"), BAD_CAST("http://schemas.openxmlformats.org/markup-compatibility/2006") },
- { BAD_CAST("wps"),
- BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingShape") },
- { BAD_CAST("wpg"),
- BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingGroup") },
- { BAD_CAST("wp"),
- BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing") },
- { BAD_CAST("office"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:office:1.0") },
- { BAD_CAST("table"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:table:1.0") },
- { BAD_CAST("text"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:text:1.0") },
- { BAD_CAST("style"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:style:1.0") },
- { BAD_CAST("draw"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:drawing:1.0") },
- { BAD_CAST("xlink"), BAD_CAST("http://www.w3c.org/1999/xlink") },
- { BAD_CAST("xdr"),
- BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing") },
- { BAD_CAST("xx"), BAD_CAST("urn:schemas-microsoft-com:office:excel") },
- { BAD_CAST("r"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/relationships") },
- { BAD_CAST("number"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0") },
- { BAD_CAST("loext"),
- BAD_CAST("urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0") },
- { BAD_CAST("tableooo"), BAD_CAST("http://openoffice.org/2009/table") },
- { BAD_CAST("ContentType"),
- BAD_CAST("http://schemas.openxmlformats.org/package/2006/content-types") },
- { BAD_CAST("x14"),
- BAD_CAST("http://schemas.microsoft.com/office/spreadsheetml/2009/9/main") },
- { BAD_CAST("xm"), BAD_CAST("http://schemas.microsoft.com/office/excel/2006/main") },
- { BAD_CAST("x12ac"),
- BAD_CAST("http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac") },
- };
- for (size_t i = 0; i < SAL_N_ELEMENTS(aNamespaces); ++i)
- {
- xmlXPathRegisterNs(pXmlXPathCtx, aNamespaces[i].pPrefix, aNamespaces[i].pURI);
- }
+ XmlTestTools::registerOOXMLNamespaces(pXmlXPathCtx);
+ XmlTestTools::registerODFNamespaces(pXmlXPathCtx);
}
void ScExportTest2::testMatrixMultiplicationXLSX()
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 5822179e06e0..2305c2d203f4 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -405,6 +405,20 @@ void XmlTestTools::registerOOXMLNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
BAD_CAST("http://schemas.microsoft.com/office/drawing/2010/main"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("c"),
BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/chart"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("x"),
+ BAD_CAST("http://schemas.openxmlformats.org/spreadsheetml/2006/main"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("r"),
+ BAD_CAST("http://schemas.openxmlformats.org/package/2006/relationships"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("xx"),
+ BAD_CAST("urn:schemas-microsoft-com:office:excel"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("xdr"),
+ BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("x14"),
+ BAD_CAST("http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("xm"),
+ BAD_CAST("http://schemas.microsoft.com/office/excel/2006/main"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("x12ac"),
+ BAD_CAST("http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("o"),
BAD_CAST("urn:schemas-microsoft-com:office:office"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w10"),
More information about the Libreoffice-commits
mailing list