use of org.eclipse.elk.alg.test.framework.annotations.TestAfterProcessor in project elk by eclipse.
the class InLayerConstraintProcessorTest method testValidNodeOrder.
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Tests
@TestAfterProcessor(InLayerConstraintProcessor.class)
public void testValidNodeOrder(final Object graph) {
LGraph lGraph = (LGraph) graph;
for (Layer layer : lGraph) {
InLayerConstraint lastConstraint = null;
for (LNode node : layer) {
InLayerConstraint currentConstraint = node.getProperty(InternalProperties.IN_LAYER_CONSTRAINT);
if (lastConstraint != null && currentConstraint != lastConstraint) {
// if the value changes check valid transitions
String error = "Invalid constraint transition: " + lastConstraint.name() + " -> " + currentConstraint.name();
if (currentConstraint == InLayerConstraint.NONE) {
assertTrue(error, lastConstraint == InLayerConstraint.TOP);
} else if (currentConstraint == InLayerConstraint.BOTTOM) {
assertTrue(error, lastConstraint == InLayerConstraint.TOP || lastConstraint == InLayerConstraint.NONE);
}
lastConstraint = currentConstraint;
}
lastConstraint = currentConstraint;
}
}
}
use of org.eclipse.elk.alg.test.framework.annotations.TestAfterProcessor in project elk by eclipse.
the class SortByInputModelProcessorTest method preserveNodeAndEdgeOrder.
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Tests
@TestAfterProcessor(LayerSweepCrossingMinimizer.class)
public void preserveNodeAndEdgeOrder(final Object graph) {
LGraph lgraph = (LGraph) graph;
int layerIndex = 0;
for (Layer layer : lgraph) {
int nodeIndex = 0;
for (LNode node : layer.getNodes()) {
if (node.getType() == NodeType.NORMAL) {
assertEquals("A node is on an unexpected position.", "n_l" + layerIndex + "p" + nodeIndex, node.toString());
}
nodeIndex++;
}
layerIndex++;
}
}
use of org.eclipse.elk.alg.test.framework.annotations.TestAfterProcessor in project elk by eclipse.
the class LayerConstraintProcessorTest method noEmptyLayers.
/**
* All labels on ports and edges have an assigned {@link LabelSide}.
*/
@TestAfterProcessor(LayerConstraintPostprocessor.class)
public void noEmptyLayers(Object graph) {
LGraph lGraph = (LGraph) graph;
lGraph.getLayers().stream().forEach(layer -> assertTrue(!layer.getNodes().isEmpty()));
}
use of org.eclipse.elk.alg.test.framework.annotations.TestAfterProcessor in project elk by eclipse.
the class BasicLayerAssignmentTest method testEdgesPointTowardsNextLayers.
@TestAfterProcessor(CoffmanGrahamLayerer.class)
@TestAfterProcessor(InteractiveLayerer.class)
@TestAfterProcessor(LongestPathLayerer.class)
@TestAfterProcessor(MinWidthLayerer.class)
@TestAfterProcessor(NetworkSimplexLayerer.class)
@TestAfterProcessor(StretchWidthLayerer.class)
public void testEdgesPointTowardsNextLayers(final Object graph) {
LGraph lGraph = (LGraph) graph;
// Assign increasing IDs to the layers
int nextLayerId = 0;
for (Layer layer : lGraph) {
layer.id = nextLayerId++;
}
for (Layer layer : lGraph) {
for (LNode node : layer) {
int nodeLayerId = node.getLayer().id;
for (LEdge edge : node.getOutgoingEdges()) {
assertTrue(nodeLayerId < edge.getTarget().getNode().getLayer().id);
}
}
}
}
use of org.eclipse.elk.alg.test.framework.annotations.TestAfterProcessor in project elk by eclipse.
the class BasicLayerAssignmentTest method testNoLayerlessNodes.
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Tests
@TestAfterProcessor(CoffmanGrahamLayerer.class)
@TestAfterProcessor(InteractiveLayerer.class)
@TestAfterProcessor(LongestPathLayerer.class)
@TestAfterProcessor(MinWidthLayerer.class)
@TestAfterProcessor(NetworkSimplexLayerer.class)
@TestAfterProcessor(StretchWidthLayerer.class)
public void testNoLayerlessNodes(final Object graph) {
LGraph lGraph = (LGraph) graph;
assertTrue(lGraph.getLayerlessNodes().isEmpty());
}
Aggregations