use of org.eclipse.elk.core.AbstractLayoutProvider in project elk by eclipse.
the class DirectLayoutTest method testELKLayered.
/**
* Test a plain Java layout using the ELK Layered algorithm.
*/
@Test
public void testELKLayered() {
// create a KGraph for layout
ElkNode parentNode = GraphTestUtils.createSimpleGraph();
// add layout options to the elements of the graph
addLayeredOptions(parentNode);
// create a progress monitor
IElkProgressMonitor progressMonitor = new BasicProgressMonitor();
// create the layout provider
AbstractLayoutProvider layoutProvider = new LayeredLayoutProvider();
layoutProvider.initialize(null);
// perform layout on the created graph
layoutProvider.layout(parentNode, progressMonitor);
// execute a trivial junit test
for (ElkNode child : parentNode.getChildren()) {
if (child.getX() <= 0 || child.getY() <= 0) {
Assert.fail("Not all node coordinates have been set properly.");
}
}
// output layout information
printLayoutInfo(parentNode, progressMonitor);
}
Aggregations