assertOrder(grid, new int[] { 0, 1, 2, 3 });
}
@Test
public void testAddComponents() {
GridLayout grid = new GridLayout(2, 2);
grid.addComponents(children);
assertContentPositions(grid);
assertOrder(grid, new int[] { 0, 1, 2, 3 });
Label extra = new Label("Extra");
Label extra2 = new Label("Extra2");
grid.addComponents(extra, extra2);
assertSame(grid.getComponent(0, 2), extra);
assertSame(grid.getComponent(1, 2), extra2);
grid.removeAllComponents();
grid.addComponents(extra, extra2);
assertSame(grid.getComponent(0, 0), extra);
assertSame(grid.getComponent(1, 0), extra2);
grid.addComponents(children);
assertOrder(grid, new int[] { -1, -1, 0, 1, 2, 3 });
grid.removeComponent(extra);
grid.removeComponent(extra2);
assertOrder(grid, new int[] { 0, 1, 2, 3 });
grid.addComponents(extra2, extra);
assertSame(grid.getComponent(0, 3), extra2);
assertSame(grid.getComponent(1, 3), extra);
assertOrder(grid, new int[] { 0, 1, 2, 3, -1, -1 });
grid.removeComponent(extra2);
grid.removeComponent(extra);
grid.setCursorX(0);
grid.setCursorY(0);
grid.addComponents(extra, extra2);
assertSame(grid.getComponent(0, 0), extra);
assertSame(grid.getComponent(1, 0), extra2);
assertOrder(grid, new int[] { -1, -1, 0, 1, 2, 3 });
grid = new GridLayout();
grid.addComponents(children);
assertContentPositions(grid);
assertOrder(grid, new int[] { 0, 1, 2, 3 });
}