Search in sources :

Example 11 with RecursiveGraphLayoutEngine

use of org.eclipse.elk.core.RecursiveGraphLayoutEngine 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)

Example 12 with RecursiveGraphLayoutEngine

use of org.eclipse.elk.core.RecursiveGraphLayoutEngine in project elk by eclipse.

the class Issue682Test method test.

@Test
public void test() {
    Triple<ElkNode, ElkNode, ElkLabel> uut = testGraph();
    new RecursiveGraphLayoutEngine().layout(uut.getFirst(), new NullElkProgressMonitor());
    // Label position
    ElkLabel label = uut.getThird();
    assertThat(label.getX(), closeTo(54.0, EPSILON));
    assertThat(label.getY(), closeTo(21.0, EPSILON));
    // Node dimension
    assertThat(uut.getSecond().getWidth(), closeTo(label.getX() + label.getWidth() + 32, EPSILON));
// TODO the following line fails, it looks like the label's height is applied twice.
// assertThat(uut.getSecond().getHeight(), closeTo(label.getY() + label.getHeight() + 43, EPSILON));
}
Also used : NullElkProgressMonitor(org.eclipse.elk.core.util.NullElkProgressMonitor) ElkNode(org.eclipse.elk.graph.ElkNode) ElkLabel(org.eclipse.elk.graph.ElkLabel) RecursiveGraphLayoutEngine(org.eclipse.elk.core.RecursiveGraphLayoutEngine) Test(org.junit.Test)

Example 13 with RecursiveGraphLayoutEngine

use of org.eclipse.elk.core.RecursiveGraphLayoutEngine in project elk by eclipse.

the class ExperimentStatement method evaluate.

@Override
public void evaluate() throws Throwable {
    createTestGraph();
    // Create a test controller if we have whitebox tests and the layout algorithm
    TestController testController = null;
    if (!this.experimentRunner.getParentRunner().getWhiteboxTests().isEmpty()) {
        TestAlgorithm algorithm = experimentRunner.getExperimentalObject().getLayoutAlgorithm();
        testController = new TestController(algorithm.getAlgorithmData().getId());
        testController.addLayoutExecutionListener(this);
    }
    // Let the recursive graph layout engine run the layout algorithm (if we have a test controller, that will
    // automatically cause white box tests to run)
    RecursiveGraphLayoutEngine layoutEngine = new RecursiveGraphLayoutEngine();
    layoutEngine.layout(testGraph, testController, new BasicProgressMonitor());
    // Stop listening to the test controller
    if (testController != null) {
        testController.removeLayoutExecutionListener(this);
    }
    // Run blackbox tests now that the layout algorithm has finished
    runBlackboxTests();
    // Cleanly handle all whitebox tests that did not execute because their processors didn't run
    simulateWhiteboxTestsForNotifiers();
    testGraph = null;
}
Also used : TestAlgorithm(org.eclipse.elk.alg.test.framework.algorithm.TestAlgorithm) TestController(org.eclipse.elk.core.testing.TestController) RecursiveGraphLayoutEngine(org.eclipse.elk.core.RecursiveGraphLayoutEngine) BasicProgressMonitor(org.eclipse.elk.core.util.BasicProgressMonitor)

Aggregations

RecursiveGraphLayoutEngine (org.eclipse.elk.core.RecursiveGraphLayoutEngine)13 BasicProgressMonitor (org.eclipse.elk.core.util.BasicProgressMonitor)10 Test (org.junit.Test)9 ElkNode (org.eclipse.elk.graph.ElkNode)7 NullElkProgressMonitor (org.eclipse.elk.core.util.NullElkProgressMonitor)3 IGraphLayoutEngine (org.eclipse.elk.core.IGraphLayoutEngine)2 LayoutMetaDataService (org.eclipse.elk.core.data.LayoutMetaDataService)2 IElkProgressMonitor (org.eclipse.elk.core.util.IElkProgressMonitor)2 ElkGraphElement (org.eclipse.elk.graph.ElkGraphElement)2 ElkPort (org.eclipse.elk.graph.ElkPort)2 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 LayeredOptions (org.eclipse.elk.alg.layered.options.LayeredOptions)1 SporeMetaDataProvider (org.eclipse.elk.alg.spore.options.SporeMetaDataProvider)1 TestAlgorithm (org.eclipse.elk.alg.test.framework.algorithm.TestAlgorithm)1 LayoutConfigurator (org.eclipse.elk.core.LayoutConfigurator)1 UnsupportedConfigurationException (org.eclipse.elk.core.UnsupportedConfigurationException)1 LayoutAlgorithmData (org.eclipse.elk.core.data.LayoutAlgorithmData)1 LayoutAlgorithmResolver (org.eclipse.elk.core.data.LayoutAlgorithmResolver)1 PortSide (org.eclipse.elk.core.options.PortSide)1