package org.helioviewer.gl3d;

import junit.framework.Assert;

import org.helioviewer.gl3d.scenegraph.GL3DGroup;
import org.junit.Test;

public class GL3DGroupTest {
    @Test
    public void testMoveUp() {
        GL3DGroup group = new GL3DGroup("Test Group");
        GL3DGroup child1 = new GL3DGroup("Test Child 1");
        GL3DGroup child2 = new GL3DGroup("Test Child 2");
        group.addNode(child1);
        group.addNode(child2);

        Assert.assertEquals(child1, group.getChild(0));
        Assert.assertEquals(child2, group.getChild(1));
        Assert.assertEquals(null, group.getChild(2));

        group.moveNode(child2, 0);

        Assert.assertEquals(child1, group.getChild(1));
        Assert.assertEquals(child2, group.getChild(0));

        group = new GL3DGroup("Test Group");
        child1 = new GL3DGroup("Test Child 1");
        child2 = new GL3DGroup("Test Child 2");
        GL3DGroup child3 = new GL3DGroup("Test Child 3");
        group.addNode(child1);
        group.addNode(child2);
        group.addNode(child3);

        group.moveNode(child3, 0);

        Assert.assertEquals(child3, group.getChild(0));
        Assert.assertEquals(child1, group.getChild(1));
        Assert.assertEquals(child2, group.getChild(2));

        group.moveNode(child1, 0);

        Assert.assertEquals(child1, group.getChild(0));
        Assert.assertEquals(child3, group.getChild(1));
        Assert.assertEquals(child2, group.getChild(2));
    }

    @Test
    public void testMoveDown() {
        GL3DGroup group = new GL3DGroup("Test Group");
        GL3DGroup child1 = new GL3DGroup("Test Child 1");
        GL3DGroup child2 = new GL3DGroup("Test Child 2");
        group.addNode(child1);
        group.addNode(child2);

        Assert.assertEquals(child1, group.getChild(0));
        Assert.assertEquals(child2, group.getChild(1));
        Assert.assertEquals(null, group.getChild(2));

        group.moveNode(child1, 1);

        Assert.assertEquals(child2, group.getChild(0));
        Assert.assertEquals(child1, group.getChild(1));

        group = new GL3DGroup("Test Group");
        child1 = new GL3DGroup("Test Child 1");
        child2 = new GL3DGroup("Test Child 2");
        GL3DGroup child3 = new GL3DGroup("Test Child 3");
        group.addNode(child1);
        group.addNode(child2);
        group.addNode(child3);

        group.moveNode(child1, 2);

        Assert.assertEquals(child2, group.getChild(0));
        Assert.assertEquals(child3, group.getChild(1));
        Assert.assertEquals(child1, group.getChild(2));

        group.moveNode(child2, 1);

        Assert.assertEquals(child3, group.getChild(0));
        Assert.assertEquals(child2, group.getChild(1));
        Assert.assertEquals(child1, group.getChild(2));

        group.moveNode(child2, 1);

        Assert.assertEquals(child3, group.getChild(0));
        Assert.assertEquals(child2, group.getChild(1));
        Assert.assertEquals(child1, group.getChild(2));
    }

}

@@ -35,30 +35,44 @@
 ort 
-junit.framework.Assert
+static org.junit.Assert.assertEquals
 ;%0A%0Ai
@@ -448,39 +448,32 @@
 ild2);%0A%0A        
-Assert.
 assertEquals(chi
@@ -497,39 +497,32 @@
 ld(0));%0A        
-Assert.
 assertEquals(chi
@@ -546,39 +546,32 @@
 ld(1));%0A        
-Assert.
 assertEquals(nul
@@ -630,39 +630,32 @@
 2, 0);%0A%0A        
-Assert.
 assertEquals(chi
@@ -679,39 +679,32 @@
 ld(1));%0A        
-Assert.
 assertEquals(chi
@@ -1058,39 +1058,32 @@
 3, 0);%0A%0A        
-Assert.
 assertEquals(chi
@@ -1107,39 +1107,32 @@
 ld(0));%0A        
-Assert.
 assertEquals(chi
@@ -1156,39 +1156,32 @@
 ld(1));%0A        
-Assert.
 assertEquals(chi
@@ -1242,39 +1242,32 @@
 1, 0);%0A%0A        
-Assert.
 assertEquals(chi
@@ -1291,39 +1291,32 @@
 ld(0));%0A        
-Assert.
 assertEquals(chi
@@ -1340,39 +1340,32 @@
 ld(1));%0A        
-Assert.
 assertEquals(chi
@@ -1673,39 +1673,32 @@
 ild2);%0A%0A        
-Assert.
 assertEquals(chi
@@ -1722,39 +1722,32 @@
 ld(0));%0A        
-Assert.
 assertEquals(chi
@@ -1771,39 +1771,32 @@
 ld(1));%0A        
-Assert.
 assertEquals(nul
@@ -1855,39 +1855,32 @@
 1, 1);%0A%0A        
-Assert.
 assertEquals(chi
@@ -1904,39 +1904,32 @@
 ld(0));%0A        
-Assert.
 assertEquals(chi
@@ -2283,39 +2283,32 @@
 1, 2);%0A%0A        
-Assert.
 assertEquals(chi
@@ -2332,39 +2332,32 @@
 ld(0));%0A        
-Assert.
 assertEquals(chi
@@ -2381,39 +2381,32 @@
 ld(1));%0A        
-Assert.
 assertEquals(chi
@@ -2467,39 +2467,32 @@
 2, 1);%0A%0A        
-Assert.
 assertEquals(chi
@@ -2516,39 +2516,32 @@
 ld(0));%0A        
-Assert.
 assertEquals(chi
@@ -2565,39 +2565,32 @@
 ld(1));%0A        
-Assert.
 assertEquals(chi
@@ -2651,39 +2651,32 @@
 2, 1);%0A%0A        
-Assert.
 assertEquals(chi
@@ -2700,39 +2700,32 @@
 ld(0));%0A        
-Assert.
 assertEquals(chi
@@ -2757,23 +2757,16 @@
         
-Assert.
 assertEq

make not deprecated