include/test/xmltesttools.hxx | 1 oox/qa/unit/export.cxx | 53 ------------------------------------- sw/qa/unit/swmodeltestbase.cxx | 55 -------------------------------------- test/source/xmltesttools.cxx | 58 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 106 deletions(-)
New commits: commit 1ba1bb1cacdc8825d01559859100a2b575967e55 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Jun 3 20:55:12 2021 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Jun 4 09:05:12 2021 +0200 test: introduce XmlTestTools::registerOOXMLNamespaces() to reduce copy&paste sc/ could potentially benefit from this as well, that's not yet done here. Change-Id: I03d0b4afa21a02c74d34aab6e03ab53991df29dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116679 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/include/test/xmltesttools.hxx b/include/test/xmltesttools.hxx index b56bb12db5d2..a4f0ef30d8ba 100644 --- a/include/test/xmltesttools.hxx +++ b/include/test/xmltesttools.hxx @@ -98,6 +98,7 @@ protected: void assertXPathNoAttribute(const xmlDocUniquePtr& pXmlDoc, const OString& rXPath, const OString& rAttribute); static void registerODFNamespaces(xmlXPathContextPtr& pXmlXpathCtx); + static void registerOOXMLNamespaces(xmlXPathContextPtr& pXmlXpathCtx); }; #endif diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 6e6620ab63a4..20ae35c6b727 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -55,58 +55,7 @@ void Test::tearDown() void Test::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) { - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w"), - BAD_CAST("http://schemas.openxmlformats.org/wordprocessingml/2006/main")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("v"), BAD_CAST("urn:schemas-microsoft-com:vml")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("mc"), - BAD_CAST("http://schemas.openxmlformats.org/markup-compatibility/2006")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("wps"), - BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingShape")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("wpg"), - BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingGroup")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("wp"), - BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("wp14"), - BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("a"), - BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/main")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("pic"), - BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/picture")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("rels"), - BAD_CAST("http://schemas.openxmlformats.org/package/2006/relationships")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w14"), - BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordml")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("m"), - BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/math")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("ContentType"), - BAD_CAST("http://schemas.openxmlformats.org/package/2006/content-types")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("lc"), - BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("cp"), - BAD_CAST("http://schemas.openxmlformats.org/package/2006/metadata/core-properties")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("extended-properties"), - BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/extended-properties")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("custom-properties"), - BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/custom-properties")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("vt"), - BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("dcterms"), BAD_CAST("http://purl.org/dc/terms/")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("a14"), - 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("o"), - BAD_CAST("urn:schemas-microsoft-com:office:office")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w10"), - BAD_CAST("urn:schemas-microsoft-com:office:word")); + XmlTestTools::registerOOXMLNamespaces(pXmlXpathCtx); } void Test::loadAndSave(const OUString& rURL, const OUString& rFilterName) diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx index 7a158abf7e3b..9cb362bf3ff5 100644 --- a/sw/qa/unit/swmodeltestbase.cxx +++ b/sw/qa/unit/swmodeltestbase.cxx @@ -697,60 +697,7 @@ xmlDocUniquePtr SwModelTestBase::parseExportInternal(const OUString& url, void SwModelTestBase::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) { // docx - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w"), - BAD_CAST("http://schemas.openxmlformats.org/wordprocessingml/2006/main")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("v"), BAD_CAST("urn:schemas-microsoft-com:vml")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("mc"), - BAD_CAST("http://schemas.openxmlformats.org/markup-compatibility/2006")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("wps"), - BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingShape")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("wpg"), - BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingGroup")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("wp"), - BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("wp14"), - BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("a"), - BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/main")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("pic"), - BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/picture")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("rels"), - BAD_CAST("http://schemas.openxmlformats.org/package/2006/relationships")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w14"), - BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordml")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w15"), - BAD_CAST("http://schemas.microsoft.com/office/word/2012/wordml")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("m"), - BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/math")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("ContentType"), - BAD_CAST("http://schemas.openxmlformats.org/package/2006/content-types")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("lc"), - BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("cp"), - BAD_CAST("http://schemas.openxmlformats.org/package/2006/metadata/core-properties")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("extended-properties"), - BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/extended-properties")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("custom-properties"), - BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/custom-properties")); - xmlXPathRegisterNs( - pXmlXpathCtx, BAD_CAST("vt"), - BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("dcterms"), BAD_CAST("http://purl.org/dc/terms/")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("a14"), - 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("o"), - BAD_CAST("urn:schemas-microsoft-com:office:office")); - xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w10"), - BAD_CAST("urn:schemas-microsoft-com:office:word")); + XmlTestTools::registerOOXMLNamespaces(pXmlXpathCtx); // odt XmlTestTools::registerODFNamespaces(pXmlXpathCtx); // reqif-xhtml diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx index 7d01690aee82..5822179e06e0 100644 --- a/test/source/xmltesttools.cxx +++ b/test/source/xmltesttools.cxx @@ -353,4 +353,62 @@ void XmlTestTools::registerODFNamespaces(xmlXPathContextPtr& pXmlXpathCtx) BAD_CAST("http://www.w3.org/TR/css3-text/")); } +void XmlTestTools::registerOOXMLNamespaces(xmlXPathContextPtr& pXmlXpathCtx) +{ + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w"), + BAD_CAST("http://schemas.openxmlformats.org/wordprocessingml/2006/main")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("v"), BAD_CAST("urn:schemas-microsoft-com:vml")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("mc"), + BAD_CAST("http://schemas.openxmlformats.org/markup-compatibility/2006")); + xmlXPathRegisterNs( + pXmlXpathCtx, BAD_CAST("wps"), + BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingShape")); + xmlXPathRegisterNs( + pXmlXpathCtx, BAD_CAST("wpg"), + BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingGroup")); + xmlXPathRegisterNs( + pXmlXpathCtx, BAD_CAST("wp"), + BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing")); + xmlXPathRegisterNs( + pXmlXpathCtx, BAD_CAST("wp14"), + BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("a"), + BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/main")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("pic"), + BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/picture")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("rels"), + BAD_CAST("http://schemas.openxmlformats.org/package/2006/relationships")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w14"), + BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordml")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w15"), + BAD_CAST("http://schemas.microsoft.com/office/word/2012/wordml")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("m"), + BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/math")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("ContentType"), + BAD_CAST("http://schemas.openxmlformats.org/package/2006/content-types")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("lc"), + BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas")); + xmlXPathRegisterNs( + pXmlXpathCtx, BAD_CAST("cp"), + BAD_CAST("http://schemas.openxmlformats.org/package/2006/metadata/core-properties")); + xmlXPathRegisterNs( + pXmlXpathCtx, BAD_CAST("extended-properties"), + BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/extended-properties")); + xmlXPathRegisterNs( + pXmlXpathCtx, BAD_CAST("custom-properties"), + BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/custom-properties")); + xmlXPathRegisterNs( + pXmlXpathCtx, BAD_CAST("vt"), + BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("dcterms"), BAD_CAST("http://purl.org/dc/terms/")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("a14"), + 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("o"), + BAD_CAST("urn:schemas-microsoft-com:office:office")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w10"), + BAD_CAST("urn:schemas-microsoft-com:office:word")); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits