Add MS binary format validation in writer export tests
Validation is done with Microsoft Office Binary File Format Validator if it
is enabled. Since currently all doc files are not passing validation, they
are included into validation blacklist.
Change-Id: Ia36c5c9f2248122b13401a6d2834b729dbb75d6c
Reviewed-on: https://gerrit.libreoffice.org/26422
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index fca647b..8cff2ea 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -644,11 +644,25 @@ protected:
// too many validation errors right now
validate(maTempFile.GetFileName(), test::OOXML);
}
else if(aFilterName == "writer8")
else if(aFilterName == "writer8"
|| aFilterName == "OpenDocument Text Flat XML")
{
// still a few validation errors
validate(maTempFile.GetFileName(), test::ODF);
}
else if(aFilterName == "MS Word 97")
{
validate(maTempFile.GetFileName(), test::MSBINARY);
}
else
{
OString aMessage("validation requested, but don't know how to validate ");
aMessage += filename;
aMessage += " (";
aMessage += OUStringToOString(aFilterName, RTL_TEXTENCODING_UTF8);
aMessage += ")";
CPPUNIT_FAIL(aMessage.getStr());
}
}
discardDumpedLayout();
if (mustCalcLayoutOf(filename))
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 15dd31a..6ff9590 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -46,6 +46,39 @@ public:
// If the testcase is stored in some other format, it's pointless to test.
return OString(filename).endsWith(".doc");
}
/**
* Validation handling
*/
bool mustValidate(const char* filename) const override
{
const std::vector<const char*> aBlacklist =
{
// the following doc exports currently don't pass binary validation
"tdf56321_flipImage_both.doc",
"cjklist30.doc",
"cjklist31.doc",
"cjklist34.doc",
"cjklist35.doc",
"fdo77454.doc",
"new-page-styles.doc",
"tdf36117_verticalAdjustment.doc",
"bnc636128.doc",
"tdf92281.doc",
"fdo59530.doc",
"fdo56513.doc",
"tscp.doc",
"zoom.doc",
"comments-nested.doc",
"commented-table.doc",
"zoomtype.doc",
"n325936.doc",
"first-header-footer.doc"
};
// Don't bother with non-.doc files; weed out blacklisted .doc files
return (OString(filename).endsWith(".doc") && std::find(aBlacklist.begin(), aBlacklist.end(), filename) == aBlacklist.end());
}
protected:
bool CjkNumberedListTestHelper(sal_Int16 &nValue)
{