[Libreoffice-commits] core.git: chart2/qa test/source

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 8 13:36:59 UTC 2021


 chart2/qa/extras/chart2export.cxx   |   24 +-----------------------
 chart2/qa/extras/chart2geometry.cxx |   32 ++------------------------------
 test/source/xmltesttools.cxx        |    2 ++
 3 files changed, 5 insertions(+), 53 deletions(-)

New commits:
commit 6e1758e5d852820b626d99b2208157ce7caeaca2
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Jun 8 12:54:05 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Jun 8 15:36:17 2021 +0200

    chart2: use registerOOXMLNamespaces and registerODFNamespaces
    
    Change-Id: I2ee15ec29fbf5fc4fcaea035a9cd99ba49453a4e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116831
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 817f3d1734a2..dabf7b4ed277 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -404,29 +404,7 @@ xmlDocUniquePtr Chart2ExportTest::parseExport(const OUString& rDir, const OUStri
 
 void Chart2ExportTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
 {
-    static struct { char const * pPrefix; char const * pURI; } const aNamespaces[] =
-    {
-        { "w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
-        { "v", "urn:schemas-microsoft-com:vml" },
-        { "c", "http://schemas.openxmlformats.org/drawingml/2006/chart" },
-        { "a", "http://schemas.openxmlformats.org/drawingml/2006/main" },
-        { "mc", "http://schemas.openxmlformats.org/markup-compatibility/2006" },
-        { "wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" },
-        { "wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" },
-        { "wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" },
-        { "office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0" },
-        { "table", "urn:oasis:names:tc:opendocument:xmlns:table:1.0" },
-        { "text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0" },
-        { "xlink", "http://www.w3c.org/1999/xlink" },
-        { "c15", "http://schemas.microsoft.com/office/drawing/2012/chart" }
-    };
-    for(size_t i = 0; i < SAL_N_ELEMENTS(aNamespaces); ++i)
-    {
-        xmlXPathRegisterNs(
-            pXmlXPathCtx,
-            reinterpret_cast<xmlChar const *>(aNamespaces[i].pPrefix),
-            reinterpret_cast<xmlChar const *>(aNamespaces[i].pURI));
-    }
+    XmlTestTools::registerOOXMLNamespaces(pXmlXPathCtx);
 }
 
 namespace {
diff --git a/chart2/qa/extras/chart2geometry.cxx b/chart2/qa/extras/chart2geometry.cxx
index 4f57654a3587..d6c243ccfd76 100644
--- a/chart2/qa/extras/chart2geometry.cxx
+++ b/chart2/qa/extras/chart2geometry.cxx
@@ -139,36 +139,8 @@ xmlDocUniquePtr Chart2GeometryTest::parseExport(const OUString& rDir, const OUSt
 
 void Chart2GeometryTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
 {
-    static struct
-    {
-        char const* pPrefix;
-        char const* pURI;
-    } const aNamespaces[] = {
-        // OOXML
-        { "w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
-        { "v", "urn:schemas-microsoft-com:vml" },
-        { "c", "http://schemas.openxmlformats.org/drawingml/2006/chart" },
-        { "a", "http://schemas.openxmlformats.org/drawingml/2006/main" },
-        { "mc", "http://schemas.openxmlformats.org/markup-compatibility/2006" },
-        { "wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" },
-        { "wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" },
-        { "wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" },
-        { "c15", "http://schemas.microsoft.com/office/drawing/2012/chart" },
-        // ODF
-        { "office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0" },
-        { "chart", "urn:oasis:names:tc:opendocument:xmlns:chart:1.0" },
-        { "draw", "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" },
-        { "style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0" },
-        { "svg", "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" },
-        { "table", "urn:oasis:names:tc:opendocument:xmlns:table:1.0" },
-        { "text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0" },
-        { "xlink", "http://www.w3c.org/1999/xlink" },
-    };
-    for (size_t i = 0; i < SAL_N_ELEMENTS(aNamespaces); ++i)
-    {
-        xmlXPathRegisterNs(pXmlXPathCtx, reinterpret_cast<xmlChar const*>(aNamespaces[i].pPrefix),
-                           reinterpret_cast<xmlChar const*>(aNamespaces[i].pURI));
-    }
+    XmlTestTools::registerOOXMLNamespaces(pXmlXPathCtx);
+    XmlTestTools::registerODFNamespaces(pXmlXPathCtx);
 }
 
 static OString OU2O(std::u16string_view sOUSource)
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 10a304fac745..12aed37f18e0 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -438,6 +438,8 @@ void XmlTestTools::registerOOXMLNamespaces(xmlXPathContextPtr& pXmlXpathCtx)
                        BAD_CAST("http://schemas.microsoft.com/office/powerpoint/2010/main"));
     xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("dgm"),
                        BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/diagram"));
+    xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("c15"),
+                       BAD_CAST("http://schemas.microsoft.com/office/drawing/2012/chart"));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list