Package org.terasology.logic.behavior.nui

Examples of org.terasology.logic.behavior.nui.RenderableNode$NodeTreeAccessor


        Assert.assertEquals(two, one.getChild(0));
    }

    @Test
    public void testConnectToConnectedDecorator() {
        RenderableNode one = new RenderableNode();
        one.setNode(decorator(null));
        RenderableNode two = new RenderableNode();
        two.setNode(node());
        ((Port.OutputPort) one.getPortList().ports().get(0)).setTarget(two.getInputPort());

        RenderableNode three = new RenderableNode();
        three.setNode(node());
        ((Port.OutputPort) one.getPortList().ports().get(0)).setTarget(three.getInputPort());

        Assert.assertEquals(one, three.getInputPort().getTargetPort().getSourceNode());
        Assert.assertEquals(one.getPortList().ports().get(0), three.getInputPort().getTargetPort());
        Assert.assertEquals(null, two.getInputPort().getTargetPort());

        Assert.assertEquals(1, one.getChildrenCount());
        Assert.assertEquals(three, one.getChild(0));
    }
View Full Code Here


        Assert.assertEquals(three, one.getChild(0));
    }

    @Test
    public void testConnectToConnectedDecorator2() {
        RenderableNode one = new RenderableNode();
        one.setNode(decorator(null));
        RenderableNode two = new RenderableNode();
        two.setNode(decorator(null));
        ((Port.OutputPort) one.getPortList().ports().get(0)).setTarget(two.getInputPort());
        RenderableNode three = new RenderableNode();
        three.setNode(decorator(null));
        ((Port.OutputPort) three.getPortList().ports().get(0)).setTarget(two.getInputPort());

        Assert.assertEquals(three, two.getInputPort().getTargetPort().getSourceNode());
        Assert.assertEquals(three.getPortList().ports().get(0), two.getInputPort().getTargetPort());

        Assert.assertEquals(1, three.getChildrenCount());
        Assert.assertEquals(two, three.getChild(0));

        Assert.assertEquals(0, one.getChildrenCount());
    }
View Full Code Here

        Assert.assertEquals(0, one.getChildrenCount());
    }

    @Test
    public void testDisconnectDecorator() {
        RenderableNode one = new RenderableNode();
        one.setNode(decorator(null));
        RenderableNode two = new RenderableNode();
        two.setNode(node());
        ((Port.OutputPort) one.getPortList().ports().get(0)).setTarget(two.getInputPort());

        Assert.assertEquals(1, one.getChildrenCount());
        Assert.assertEquals(two, one.getChild(0));
        ((Port.OutputPort) one.getPortList().ports().get(0)).setTarget(null);

        Assert.assertEquals(0, one.getChildrenCount());
        Assert.assertEquals(null, two.getInputPort().getTargetPort());
    }
View Full Code Here

        Assert.assertEquals(null, two.getInputPort().getTargetPort());
    }

    @Test
    public void testConnectComposite() {
        RenderableNode parent = new RenderableNode();
        parent.setNode(composite());
        RenderableNode one = new RenderableNode();
        one.setNode(node());
        RenderableNode two = new RenderableNode();
        two.setNode(node());

        ((Port.OutputPort) parent.getPortList().ports().get(0)).setTarget(one.getInputPort());
        ((Port.OutputPort) parent.getPortList().ports().get(2)).setTarget(two.getInputPort());

        Assert.assertEquals(parent, one.getInputPort().getTargetPort().getSourceNode());
        Assert.assertEquals(parent, two.getInputPort().getTargetPort().getSourceNode());
        Assert.assertEquals(parent.getPortList().ports().get(1), one.getInputPort().getTargetPort());
        Assert.assertEquals(parent.getPortList().ports().get(3), two.getInputPort().getTargetPort());

        Assert.assertEquals(2, parent.getChildrenCount());

        Assert.assertEquals(one, parent.getChild(0));
        Assert.assertEquals(two, parent.getChild(1));
View Full Code Here

TOP

Related Classes of org.terasology.logic.behavior.nui.RenderableNode$NodeTreeAccessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.