public void testAddComponentObjectint() { int index = 2; JComponent comp = new JLabel("label"); comp.setName("labelName"); Object constraints = "label"; tabbed.add(comp, constraints, index); assertEquals("index", index, tabbed.indexOfComponent(comp)); assertEquals("title", constraints, tabbed.getTitleAt(index)); tabbed.remove(comp); comp = new JLabel("label"); comp.setName("labelName"); constraints = BasicIconFactory.createEmptyFrameIcon(); // just some icon tabbed.add(comp, constraints, index); assertEquals("title", "", tabbed.getTitleAt(index)); assertEquals("icon", constraints, tabbed.getIconAt(index)); tabbed.remove(comp); comp = new JLabel("label"); comp.setName("labelName"); constraints = new Integer(3); // just some Object tabbed.add(comp, constraints, 1); if (BasicSwingTestCase.isHarmony()) { assertEquals("title", "labelName", tabbed.getTitleAt(tabbed.indexOfComponent(comp))); } assertNull("icon", tabbed.getIconAt(tabbed.indexOfComponent(comp))); tabbed.remove(comp); }
public void testIndexOfTabIcon() { Icon otherIcon = BasicIconFactory.getCheckBoxIcon(); assertEquals("index of null", 0, tabbed.indexOfTab((Icon) null)); tabbed.setIconAt(1, someIcon); assertEquals(1, tabbed.indexOfTab(someIcon)); assertEquals("no icon", -1, tabbed.indexOfTab(otherIcon)); }