Hi,
Some time ago I implemented a rough unit test framework for
TableRowIterator [1]. Feeling the need for unit testing the FO tree code
I went ahead and integrated it into the existing fotree framework. There
are now two different sets of testcases:
- those in the existing ‘testcases’ sub-directory of test/fotree: FO
files decorated with assertions for checking the values of properties;
- those in the new ‘unittests’ sub-directory: FO files used as a basis
for programming “classical” unit tests (checking classes from the FObj
hierarchy). It’s more than simply checking the value of a property, so
it’s simpler to program them and call the necessary methods from the
classes. For example, checking that the column setup in tables behaves
properly.
Those tests are launched along with the former ones by running ‘ant
junit-fotree’
Any comments welcome. I’ll integrate the TableRowIterator test later on
when I’ve moved the class into the FO tree code.
While I’m on it:
> +public class TooManyColumnsTestCase extends FOTreeUnitTester {
> +
> + private FOTreeUnitTester.FOEventHandlerFactory tableHandlerFactory;
> +
> + public TooManyColumnsTestCase() throws Exception {
> + super();
> + tableHandlerFactory = new FOTreeUnitTester.FOEventHandlerFactory() {
> + public FOEventHandler createFOEventHandler(FOUserAgent ua) {
> + return new TableHandler(ua);
> + }
> + };
> + }
> +
> + private void launchTest(String filename) throws Exception {
> + try {
> + setUp(filename, tableHandlerFactory);
> + fail();
> + } catch (ValidationException e) {
> + // TODO check location
> + }
> + }
I tried to implement the suitable getters on FOPException, but when used
in the testing environment they seem to always return 0. As this is not
so important I’ll have a look into it later on, but if anyone has an
immediate idea of what’s going on...
Thanks,
Vincent
[1]
http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-dev/200702.mbox/[EMAIL
PROTECTED]