Search in sources :

Example 1 with NullElkProgressMonitor

use of org.eclipse.elk.core.util.NullElkProgressMonitor in project elk by eclipse.

the class AllowNonFlowPortsToSwitchSidesTest method testOnlySwitchPortSidesIfPermitted.

@Test
public void testOnlySwitchPortSidesIfPermitted() {
    final ElkNode graph = createSimpleGraph(portConstraints, node1MaySwitchPortSides, node2MaySwitchPortSides);
    final ElkEdge e1 = graph.getContainedEdges().get(0);
    final ElkEdge e2 = graph.getContainedEdges().get(1);
    layeredLayout.layout(graph, new NullElkProgressMonitor());
    assertEquals(edgesIntersect, intersect(e1, e2));
}
Also used : NullElkProgressMonitor(org.eclipse.elk.core.util.NullElkProgressMonitor) ElkNode(org.eclipse.elk.graph.ElkNode) ElkEdge(org.eclipse.elk.graph.ElkEdge) Test(org.junit.Test)

Example 2 with NullElkProgressMonitor

use of org.eclipse.elk.core.util.NullElkProgressMonitor in project elk by eclipse.

the class SelfLoopPreprocessorTest method testPortsHidden.

// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Actual Tests
private void testPortsHidden(final PortConstraints portConstraints) {
    TestGraph testGraph = new TestGraph(portConstraints);
    slPreprocessor.process(testGraph.testGraph, new NullElkProgressMonitor());
    // Only the regular and unconnected ports should be left
    assertEquals(testGraph.regularPorts.size() + testGraph.unconnectedPorts.size(), testGraph.selfLoopNode.getPorts().size());
    assertTrue(testGraph.selfLoopNode.getPorts().containsAll(testGraph.regularPorts));
    assertTrue(testGraph.selfLoopNode.getPorts().containsAll(testGraph.unconnectedPorts));
    testHiddenEdges(testGraph);
}
Also used : NullElkProgressMonitor(org.eclipse.elk.core.util.NullElkProgressMonitor)

Example 3 with NullElkProgressMonitor

use of org.eclipse.elk.core.util.NullElkProgressMonitor in project elk by eclipse.

the class SelfLoopPreprocessorTest method testPortsUntouched.

private void testPortsUntouched(PortConstraints portConstraints) {
    TestGraph testGraph = new TestGraph(portConstraints);
    slPreprocessor.process(testGraph.testGraph, new NullElkProgressMonitor());
    // All ports should be left
    assertEquals(testGraph.regularPorts.size() + testGraph.onlySelfLoopPorts.size() + testGraph.unconnectedPorts.size(), testGraph.selfLoopNode.getPorts().size());
    testHiddenEdges(testGraph);
}
Also used : NullElkProgressMonitor(org.eclipse.elk.core.util.NullElkProgressMonitor)

Example 4 with NullElkProgressMonitor

use of org.eclipse.elk.core.util.NullElkProgressMonitor in project elk by eclipse.

the class Issue562Test method test.

@Test
public void test() {
    // Create the basic graph structure
    ElkNode graph = ElkGraphUtil.createGraph();
    ElkNode n1 = ElkGraphUtil.createNode(graph);
    ElkPort p1 = ElkGraphUtil.createPort(n1);
    ElkPort p2 = ElkGraphUtil.createPort(n1);
    ElkEdge e = ElkGraphUtil.createSimpleEdge(p1, p2);
    // Create a layout configurator to apply options, just as it would happen in the DiagramLayoutEngine
    LayoutConfigurator config = new LayoutConfigurator();
    config.configure(n1).setProperty(CoreOptions.INSIDE_SELF_LOOPS_ACTIVATE, true);
    config.configure(e).setProperty(CoreOptions.INSIDE_SELF_LOOPS_YO, true);
    // Apply the configurator and a layout algorithm resolver, just like the DiagramLayoutEngine does
    ElkUtil.applyVisitors(graph, config, new LayoutAlgorithmResolver());
    // Apply layout. We don't want an UnsupportedConfigurationException to be thrown
    try {
        new RecursiveGraphLayoutEngine().layout(graph, new NullElkProgressMonitor());
    } catch (UnsupportedConfigurationException ex) {
        fail(ex.toString());
    }
}
Also used : NullElkProgressMonitor(org.eclipse.elk.core.util.NullElkProgressMonitor) ElkNode(org.eclipse.elk.graph.ElkNode) UnsupportedConfigurationException(org.eclipse.elk.core.UnsupportedConfigurationException) ElkPort(org.eclipse.elk.graph.ElkPort) RecursiveGraphLayoutEngine(org.eclipse.elk.core.RecursiveGraphLayoutEngine) LayoutAlgorithmResolver(org.eclipse.elk.core.data.LayoutAlgorithmResolver) ElkEdge(org.eclipse.elk.graph.ElkEdge) LayoutConfigurator(org.eclipse.elk.core.LayoutConfigurator) Test(org.junit.Test)

Example 5 with NullElkProgressMonitor

use of org.eclipse.elk.core.util.NullElkProgressMonitor in project elk by eclipse.

the class Issue680Test method test.

@Test
public void test() {
    Triple<ElkNode, ElkNode, ElkNode> nodes = testGraph();
    new RecursiveGraphLayoutEngine().layout(nodes.getFirst(), new NullElkProgressMonitor());
    assertThat(nodes.getSecond().getY(), closeTo(157.0, EPSILON));
    assertThat(nodes.getThird().getY(), closeTo(57.0, EPSILON));
}
Also used : NullElkProgressMonitor(org.eclipse.elk.core.util.NullElkProgressMonitor) ElkNode(org.eclipse.elk.graph.ElkNode) RecursiveGraphLayoutEngine(org.eclipse.elk.core.RecursiveGraphLayoutEngine) Test(org.junit.Test)

Aggregations

NullElkProgressMonitor (org.eclipse.elk.core.util.NullElkProgressMonitor)6 ElkNode (org.eclipse.elk.graph.ElkNode)4 Test (org.junit.Test)4 RecursiveGraphLayoutEngine (org.eclipse.elk.core.RecursiveGraphLayoutEngine)3 ElkEdge (org.eclipse.elk.graph.ElkEdge)2 LayoutConfigurator (org.eclipse.elk.core.LayoutConfigurator)1 UnsupportedConfigurationException (org.eclipse.elk.core.UnsupportedConfigurationException)1 LayoutAlgorithmResolver (org.eclipse.elk.core.data.LayoutAlgorithmResolver)1 ElkLabel (org.eclipse.elk.graph.ElkLabel)1 ElkPort (org.eclipse.elk.graph.ElkPort)1