diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-06-22 18:34:01 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-06-29 12:59:30 +0200 |
commit | e8b1dab67fd041103546e5427dd75b40ddb0431a (patch) | |
tree | a1109aeaf7f30a59dab2c64c4322bd7caabdffc1 /sc | |
parent | 0a182c2841fa48029bfd66814f2fa4cb59e907d3 (diff) |
test: invoke ODF validator with custom schemas
This requires a new validator jar for the -m flag to specify
MathML schema.
Change-Id: If99cf70f386a16a90ba676f8f5ff65a537c9ce56
Reviewed-on: https://gerrit.libreoffice.org/56487
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/helper/qahelper.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/helper/xpath.cxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/helper/xpath.hxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 42 |
4 files changed, 27 insertions, 25 deletions
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 98fe290f9dc7..bc9f3db5d891 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -203,7 +203,7 @@ public: ScDocShellRef saveAndReload( ScDocShell* pShell, sal_Int32 nFormat ); - static std::shared_ptr<utl::TempFile> exportTo( ScDocShell* pShell, sal_Int32 nFormat ); + std::shared_ptr<utl::TempFile> exportTo(ScDocShell* pShell, sal_Int32 nFormat); void miscRowHeightsTest( TestParam const * aTestValues, unsigned int numElems ); }; diff --git a/sc/qa/unit/helper/xpath.cxx b/sc/qa/unit/helper/xpath.cxx index 562facc84f1e..a28b5851986d 100644 --- a/sc/qa/unit/helper/xpath.cxx +++ b/sc/qa/unit/helper/xpath.cxx @@ -18,9 +18,9 @@ #include <com/sun/star/packages/zip/ZipFileAccess.hpp> -xmlDocPtr XPathHelper::parseExport(ScDocShell& rShell, uno::Reference<lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile, sal_Int32 nFormat) +xmlDocPtr XPathHelper::parseExport2(ScBootstrapFixture & rFixture, ScDocShell& rShell, uno::Reference<lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile, sal_Int32 nFormat) { - std::shared_ptr<utl::TempFile> pTempFile = ScBootstrapFixture::exportTo(&rShell, nFormat); + std::shared_ptr<utl::TempFile> pTempFile = rFixture.exportTo(&rShell, nFormat); return parseExport(pTempFile, xSFactory, rFile); } diff --git a/sc/qa/unit/helper/xpath.hxx b/sc/qa/unit/helper/xpath.hxx index ddffd31a4585..f8ca5684c541 100644 --- a/sc/qa/unit/helper/xpath.hxx +++ b/sc/qa/unit/helper/xpath.hxx @@ -32,6 +32,8 @@ using namespace com::sun::star; +class ScBootstrapFixture; + namespace XPathHelper { /** @@ -44,7 +46,7 @@ namespace XPathHelper * test several files in the same exported xml file you need to export the file manually * and call the parseExport method that takes a TempFile */ - SCQAHELPER_DLLPUBLIC xmlDocPtr parseExport(ScDocShell& rShell, uno::Reference< lang::XMultiServiceFactory> const & xSFactory, + SCQAHELPER_DLLPUBLIC xmlDocPtr parseExport2(ScBootstrapFixture &, ScDocShell& rShell, uno::Reference< lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile, sal_Int32 nFormat); /** diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 105852550b6c..09364c8de62e 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -422,7 +422,7 @@ void ScExportTest::testTdf111876() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); OUString sTarget = getXPath(pDoc, "/r:Relationships/r:Relationship", "Target"); @@ -1302,7 +1302,7 @@ void ScExportTest::testBuiltinRangesXLSX() CPPUNIT_ASSERT(xDocSh.is()); xShell->DoClose(); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); //assert the existing OOXML built-in names are still there @@ -3073,7 +3073,7 @@ void ScExportTest::testRelativePathsODS() ScDocShellRef xDocSh = loadDoc("fdo79305.", FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "content.xml", FORMAT_ODS); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "content.xml", FORMAT_ODS); CPPUNIT_ASSERT(pDoc); OUString aURL = getXPath(pDoc, "/office:document-content/office:body/office:spreadsheet/table:table/table:table-row[2]/table:table-cell[2]/text:p/text:a", "href"); @@ -3404,7 +3404,7 @@ void ScExportTest::testSheetTextBoxHyperlinkXLSX() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/xdr:wsDr[1]/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:nvSpPr[1]/xdr:cNvPr[1]/a:hlinkClick[1]", 1); @@ -3417,7 +3417,7 @@ void ScExportTest::testFontSizeXLSX() ScDocShellRef xDocSh = loadDoc("fontSize.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); OUString fontSize = getXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr", "sz"); @@ -3433,7 +3433,7 @@ void ScExportTest::testSheetCharacterKerningSpaceXLSX() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); OUString CharKerningSpace = getXPath(pDoc, @@ -3453,7 +3453,7 @@ void ScExportTest::testSheetCondensedCharacterSpaceXLSX() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); OUString CondensedCharSpace = getXPath(pDoc, @@ -3470,7 +3470,7 @@ void ScExportTest::testTextUnderlineColorXLSX() ScDocShellRef xDocSh = loadDoc("underlineColor.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); // Make sure the underline type is double line assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody/a:p[1]/a:r[1]/a:rPr", "u", "dbl"); @@ -3495,7 +3495,7 @@ void ScExportTest::testSheetRunParagraphPropertyXLSX() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/sharedStrings.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/sharedStrings.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); OUString aColor = getXPath(pDoc, "/x:sst/x:si/x:r[1]/x:rPr[1]/x:color", "rgb"); @@ -3510,7 +3510,7 @@ void ScExportTest::testPreserveTextWhitespaceXLSX() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/sharedStrings.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/sharedStrings.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:sst/x:si/x:t", "space", "preserve"); xDocSh->DoClose(); @@ -3522,7 +3522,7 @@ void ScExportTest::testPreserveTextWhitespace2XLSX() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/sharedStrings.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/sharedStrings.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:sst/x:si[1]/x:t", "space", "preserve"); assertXPath(pDoc, "/x:sst/x:si[2]/x:r[1]/x:t", "space", "preserve"); @@ -3535,7 +3535,7 @@ void ScExportTest::testHiddenShapeXLSX() ScDocShellRef xDocSh = loadDoc("hiddenShape.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:nvSpPr/xdr:cNvPr", "hidden", "1"); } @@ -3545,7 +3545,7 @@ void ScExportTest::testHyperlinkXLSX() ScDocShellRef xDocSh = loadDoc("hyperlink.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/r:Relationships/r:Relationship", "Target", "#Sheet2!A1"); } @@ -3721,7 +3721,7 @@ void ScExportTest::testMatrixMultiplicationXLSX() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); OUString CellFormulaRange = getXPath(pDoc, @@ -3847,7 +3847,7 @@ void ScExportTest::testTextDirectionXLSX() ScDocShellRef xDocSh = loadDoc("writingMode.", FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", "readingOrder", "1");//LTR @@ -3859,7 +3859,7 @@ void ScExportTest::testTdf88657ODS() ScDocShellRef xDocSh = loadDoc("tdf88657.", FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "styles.xml", FORMAT_ODS); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "styles.xml", FORMAT_ODS); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "//number:fraction", "min-denominator-digits", "3"); @@ -3870,7 +3870,7 @@ void ScExportTest::testConditionalFormatRangeListXLSX() ScDocShellRef xDocSh = loadDoc("conditionalformat_rangelist.", FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.is()); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "//x:conditionalFormatting", "sqref", "F4 F10"); @@ -3883,7 +3883,7 @@ void ScExportTest::testEscapeCharInNumberFormatXLSX() xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX); CPPUNIT_ASSERT( xDocSh.is() ); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); const sal_Unicode cEuro (8364); // € symbol @@ -3910,7 +3910,7 @@ void ScExportTest::testNatNumInNumberFormatXLSX() xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX); // Convert [NatNum5] to [DBNum2] in Chinese CPPUNIT_ASSERT( xDocSh.is() ); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "[DBNum2][$-804]General;[RED][DBNum2][$-804]General"); @@ -3947,7 +3947,7 @@ void ScExportTest::testExtendedLCIDXLSX() xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX); CPPUNIT_ASSERT( xDocSh.is() ); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); // Check export assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "[$-107041E]DD\\-MM\\-YYYY"); @@ -4018,7 +4018,7 @@ void ScExportTest::testHyperlinkTargetFrameODS() OUString aTargetFrame = pURLData->GetTargetFrame(); CPPUNIT_ASSERT_EQUAL(OUString("_blank"), aTargetFrame); - xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "content.xml", FORMAT_ODS); + xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "content.xml", FORMAT_ODS); CPPUNIT_ASSERT(pDoc); OUString aTargetFrameExport = getXPath(pDoc, "/office:document-content/office:body/office:spreadsheet/table:table/table:table-row[2]/table:table-cell[2]/text:p/text:a", "target-frame-name"); |