diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-16 16:27:16 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-16 16:28:38 +0100 |
commit | 5964792a5ab8df46475362c36d0620c8bf92223b (patch) | |
tree | d5baad8f31408c850ccbf7900fa3d99d7059ef70 | |
parent | 158b4df6033d4fdadadebeaa6099465fdef2e368 (diff) |
sw/qa/extras: document XPath checks
Change-Id: I78cd22485bd5d76ca37fa07e2e2eeae1da5bfea3
-rw-r--r-- | sw/qa/extras/README | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sw/qa/extras/README b/sw/qa/extras/README index e933843f852b..b2c003f607ce 100644 --- a/sw/qa/extras/README +++ b/sw/qa/extras/README @@ -32,6 +32,21 @@ once after the initial import -- so you can see if the export fails due to an import problem in fact -- and once after the export and import. The test method should still assert the document model only, as discussed above. +=== Direct XPath assertions + +An other alternative is to assert the resulted export document directly. +Currently this is only implemented for DOCX, which is a zipped XML, so it's +possible to evaluate XPath checks. A check looks like this: + +xmlDocPtr pXmlDoc = parseExport("word/document.xml"); +if (!pXmlDoc) + return; +assertXPath(pXmlDoc, <xpath selecting the node>, <attribute>, <value>); + +It's important to check for the NULL pointer here, it's expected that it'll be +NULL when the test runs first (after the first import), as there is nothing +exported yet. + == Helper methods When two or more tests do the same (for example determine the number of @@ -52,6 +67,9 @@ that productive. Xray can help in this case. Download it from: http://bernard.marcelly.perso.sfr.fr/index2.html +(Mirror in case a new version behaves in a strange way: +http://people.freedesktop.org/~vmiklos/2013/XrayTool52_en.sxw) + It's an SXW file, start Writer, Tools -> Options -> LibreOffice -> Security, Macro Security, and there choose Low. Then open the SXW, and click `Install Xray`. Now you can close the SXW. Open your testcase, which is imported |