On Feb 12, 2007, at 18:00, Vincent Hennebert wrote:

Hi Vincent,

I think the codebase is seriously lacking of unit tests, which makes
refactoring a bit hazardous. Of course there is the wonderful
layoutengine testsuite that allows to check if a XSL-FO file is rendered
as expected (BTW, I don't remember who introduced this feature, but a
huge thanks to them, that's very useful!)

Virtually all thanks go to Jeremias here, if I remember correctly.

, but this is already at a too
high level in that it tests the code in a whole.

What I need is the possibility of unit testing one class at a time like, say, TableRowIterator. The constructor of this class takes a Table and a
ColumnSetup as arguments, so I have to create ones if I want to unit
test it. But that would be a pity to create the whole structure by hand
whereas there is already code somewhere that does it.

So my question is: is there a possibility of creating a tree of FObj
instances from a corresponding FO fragment, and use it to feed objects
from the layout engine in order to unit test them? It doesn't seem to be
the case currently, but how difficult would it be to extract that from
the current codebase?

The code that constructs a tree of FObjs is located in fop.fo.FOTreeBuilder: catching SAX startElement() events and constructing FONodes + trigger the creation of PropertyLists from the Attributes. Unfortunately, FOTreeBuilder currently only accommodates construction of a complete FOTree, starting with the root.

Once a sufficient part of the FOTree is available, the LayoutManagers are created from the FO subtrees in the main loops of the getNextKnuthElements() methods (getChildLM() -> getNextChildLMs()), ultimately triggered by AreaTreeHandler.endPageSequence().

Or is this feature already available and I totally missed it?

Nope, it's not available, but it would be beneficial either way, I think, to teach FOP to render fragments instead of complete trees (using something as a default layout-master-set?)


Cheers,

Andreas

Reply via email to