assertEquals(2, tabSheet.getTabPosition(tab3));
}
@Test
public void addTabWithComponentAndIndex() {
TabSheet tabSheet = new TabSheet();
Tab tab1 = tabSheet.addTab(new Label("aaa"));
Tab tab2 = tabSheet.addTab(new Label("bbb"));
Tab tab3 = tabSheet.addTab(new Label("ccc"));
Tab tab4 = tabSheet.addTab(new Label("ddd"), 1);
Tab tab5 = tabSheet.addTab(new Label("eee"), 3);
assertEquals(0, tabSheet.getTabPosition(tab1));
assertEquals(1, tabSheet.getTabPosition(tab4));
assertEquals(2, tabSheet.getTabPosition(tab2));
assertEquals(3, tabSheet.getTabPosition(tab5));
assertEquals(4, tabSheet.getTabPosition(tab3));
// Calling addTab with existing component does not move tab
tabSheet.addTab(tab1.getComponent(), 3);
assertEquals(0, tabSheet.getTabPosition(tab1));
assertEquals(1, tabSheet.getTabPosition(tab4));
assertEquals(2, tabSheet.getTabPosition(tab2));
assertEquals(3, tabSheet.getTabPosition(tab5));
assertEquals(4, tabSheet.getTabPosition(tab3));
}