testing document conversion


Being able to properly read many different file formats is important for KOffice success. By ‘read’, I mean ‘convert to ODF’ because the conversion and reading is strictly separated in KOffice. KWord will convert a .doc file to a .odt file before loading it into the internal rendering and editing structure. There is even a nice separate program called ‘koconverter’ that can convert files on the command-line.

So far, there were no decent tests to avoid regressions in our filters. I have written a small framework (well, a shell script, but framework sounds better) that makes it simple to write tests. There are a number of tests there now for converting ppt files, but it would be great to have them for other input formats too. And here is where I hope you will help. All you need is a small input file that highlights a feature or problem and a small XSL file. The XSL file contains the test.

Look at this small example. Suppose you have a file, it can be a .doc, .docx or another office format. The file contains only one image and you want to have an automated test to verify that the ODF that is created also has one image. The following XSL file tests this:

the tests:

XSL and XPath.


Post a comment