assertOrder(layout2, new int[] { 2, 0 });
}
@Test
public void shuffleChildComponents() {
CssLayout layout = new CssLayout();
for (int i = 0; i < children.length; ++i) {
layout.addComponent(children[i], i);
}
assertOrder(layout, new int[] { 0, 1, 2, 3 });
// Move C from #2 to #1
// Exhibits defect #7668
layout.addComponent(children[2], 1);
assertOrder(layout, new int[] { 0, 2, 1, 3 });
// Move C from #1 to #4 (which becomes #3 when #1 is erased)
layout.addComponent(children[2], 4);
assertOrder(layout, new int[] { 0, 1, 3, 2 });
// Keep everything in place
layout.addComponent(children[1], 1);
assertOrder(layout, new int[] { 0, 1, 3, 2 });
// Move D from #2 to #0
layout.addComponent(children[3], 0);
assertOrder(layout, new int[] { 3, 0, 1, 2 });
// Move A from #1 to end (#4 which becomes #3)
layout.addComponent(children[0]);
assertOrder(layout, new int[] { 3, 1, 2, 0 });
// Keep everything in place
layout.addComponent(children[0]);
assertOrder(layout, new int[] { 3, 1, 2, 0 });
// Move C from #2 to #0
layout.addComponentAsFirst(children[2]);
assertOrder(layout, new int[] { 2, 3, 1, 0 });
// Keep everything in place
layout.addComponentAsFirst(children[2]);
assertOrder(layout, new int[] { 2, 3, 1, 0 });
}