Kaydet (Commit) e8b1dab6 authored tarafından Michael Stahl's avatar Michael Stahl

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: 's avatarMichael Stahl <Michael.Stahl@cib.de>
üst 0a182c28
#!/usr/bin/env bash
java -Djavax.xml.validation.SchemaFactory:http://relaxng.org/ns/structure/1.0=org.iso_relax.verifier.jaxp.validation.RELAXNGSchemaFactoryImpl -Dorg.iso_relax.verifier.VerifierFactoryLoader=com.sun.msv.verifier.jarv.FactoryLoaderImpl -jar @TARFILE_LOCATION@/@ODFVALIDATOR_JAR@ -e "$@"
java -Djavax.xml.validation.SchemaFactory:http://relaxng.org/ns/structure/1.0=org.iso_relax.verifier.jaxp.validation.RELAXNGSchemaFactoryImpl -Dorg.iso_relax.verifier.VerifierFactoryLoader=com.sun.msv.verifier.jarv.FactoryLoaderImpl -jar @TARFILE_LOCATION@/@ODFVALIDATOR_JAR@ "$@"
......@@ -186,8 +186,8 @@ export NSS_TARBALL := nss-3.33-with-nspr-4.17.tar.gz
export ODFGEN_SHA256SUM := 2c7b21892f84a4c67546f84611eccdad6259875c971e98ddb027da66ea0ac9c2
export ODFGEN_VERSION_MICRO := 6
export ODFGEN_TARBALL := libodfgen-0.1.$(ODFGEN_VERSION_MICRO).tar.bz2
export ODFVALIDATOR_SHA256SUM := 702413413a5d8076c17fe79c0808dfba145a7260020f6c8627ea529a0cf83769
export ODFVALIDATOR_JAR := odfvalidator-1.2.0-incubating-SNAPSHOT-jar-with-dependencies+ODFTOOLKIT-460+ODFTOOLKIT-475.jar
export ODFVALIDATOR_SHA256SUM := 984f2a479df79e27e7b01a5815ac53ae64e07746b882262d8a64566494515504
export ODFVALIDATOR_JAR := odfvalidator-1.2.0-incubating-SNAPSHOT-jar-with-dependencies-971c54fd38a968f5860014b44301872706f9e540.jar
export OFFICEOTRON_SHA256SUM := f2443f27561af52324eee03a1892d9f569adc8db9e7bca55614898bc2a13a770
export OFFICEOTRON_JAR := 8249374c274932a21846fa7629c2aa9b-officeotron-0.7.4-master.jar
export OPENLDAP_SHA256SUM := cdd6cffdebcd95161a73305ec13fc7a78e9707b46ca9f84fb897cd5626df3824
......
......@@ -54,7 +54,7 @@ public:
virtual void setUp() override;
static void validate(const OUString& rURL, ValidationFormat);
void validate(const OUString& rURL, ValidationFormat) const;
};
}
......
......@@ -27,20 +27,20 @@ private:
public:
Directories();
const OUString& getSrcRootURL() { return m_aSrcRootURL; }
const OUString& getSrcRootPath() { return m_aSrcRootPath; }
const OUString& getSrcRootURL() const { return m_aSrcRootURL; }
const OUString& getSrcRootPath() const { return m_aSrcRootPath; }
// return a URL to a given path from the source directory
OUString getURLFromSrc( const OUString& rPath );
OUString getURLFromSrc(const OUString& rPath) const;
// return a Path to a given path from the source directory
OUString getPathFromSrc( const OUString& rPath );
OUString getPathFromSrc(const OUString& rPath) const;
// return a URL to a given path from the workdir directory
OUString getURLFromWorkdir( const OUString &rPath );
OUString getURLFromWorkdir(const OUString &rPath) const;
// return a Path to a given path from the workdir directory
OUString getPathFromWorkdir( const OUString &rPath );
OUString getPathFromWorkdir(const OUString &rPath) const;
};
}
......
......@@ -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 );
};
......
......@@ -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);
}
......
......@@ -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);
/**
......
......@@ -137,7 +137,7 @@ OString loadFile(const OUString& rURL)
}
#endif
void test::BootstrapFixture::validate(const OUString& rPath, test::ValidationFormat eFormat )
void test::BootstrapFixture::validate(const OUString& rPath, test::ValidationFormat eFormat) const
{
#if HAVE_EXPORT_VALIDATION
OUString var;
......@@ -166,12 +166,23 @@ void test::BootstrapFixture::validate(const OUString& rPath, test::ValidationFor
CPPUNIT_ASSERT_MESSAGE(
OUString("empty get env var " + var).toUtf8().getStr(),
!aValidator.isEmpty());
aValidator += " ";
if (eFormat == test::ODF)
{
aValidator += " -e -M "
+ m_directories.getPathFromSrc("/schema/libreoffice/OpenDocument-manifest-schema-v1.3+libreoffice.rng")
+ " -D "
+ m_directories.getPathFromSrc("/schema/libreoffice/OpenDocument-dsig-schema-v1.3+libreoffice.rng")
+ " -O "
+ m_directories.getPathFromSrc("/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng")
+ " -m "
+ m_directories.getPathFromSrc("/schema/mathml2/mathml2.xsd");
}
utl::TempFile aOutput;
aOutput.EnableKillingFile();
OUString aOutputFile = aOutput.GetFileName();
OUString aCommand = aValidator + rPath + " > " + aOutputFile;
OUString aCommand = aValidator + " " + rPath + " > " + aOutputFile;
int returnValue = system(OUStringToOString(aCommand, RTL_TEXTENCODING_UTF8).getStr());
CPPUNIT_ASSERT_EQUAL_MESSAGE(
......
......@@ -41,22 +41,22 @@ test::Directories::Directories() {
m_aWorkdirRootURL = getFileURLFromSystemPath(m_aWorkdirRootPath);
}
OUString test::Directories::getURLFromSrc( const OUString& rPath )
OUString test::Directories::getURLFromSrc(const OUString& rPath) const
{
return m_aSrcRootURL + rPath;
}
OUString test::Directories::getPathFromSrc(const OUString& rPath)
OUString test::Directories::getPathFromSrc(const OUString& rPath) const
{
return m_aSrcRootPath + rPath;
}
OUString test::Directories::getURLFromWorkdir( const OUString& rPath )
OUString test::Directories::getURLFromWorkdir(const OUString& rPath) const
{
return m_aWorkdirRootURL + rPath;
}
OUString test::Directories::getPathFromWorkdir( const OUString& rPath )
OUString test::Directories::getPathFromWorkdir(const OUString& rPath) const
{
return m_aWorkdirRootPath + rPath;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment