[Libreoffice-commits] core.git: sw/qa
Miklos Vajna
vmiklos at collabora.co.uk
Mon Dec 16 07:28:57 PST 2013
sw/qa/extras/README | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
New commits:
commit 5964792a5ab8df46475362c36d0620c8bf92223b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Dec 16 16:27:16 2013 +0100
sw/qa/extras: document XPath checks
Change-Id: I78cd22485bd5d76ca37fa07e2e2eeae1da5bfea3
diff --git a/sw/qa/extras/README b/sw/qa/extras/README
index e933843..b2c003f 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
More information about the Libreoffice-commits
mailing list