use of org.eclipse.swt.widgets.MenuItem in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_Menu method test_getParentItem.
@Test
public void test_getParentItem() {
MenuItem mItem = new MenuItem(menu, SWT.CASCADE);
Menu newMenu = new Menu(shell, SWT.DROP_DOWN);
assertNull(newMenu.getParentItem());
mItem.setMenu(newMenu);
assertEquals(newMenu.getParentItem(), mItem);
}
use of org.eclipse.swt.widgets.MenuItem in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_Menu method test_ConstructorLorg_eclipse_swt_widgets_MenuItem.
@Test
public void test_ConstructorLorg_eclipse_swt_widgets_MenuItem() {
Menu newMenu;
MenuItem mItem = null;
try {
newMenu = new Menu(mItem);
newMenu.dispose();
fail("No exception thrown for parent == null");
} catch (IllegalArgumentException e) {
}
mItem = new MenuItem(menu, SWT.NULL);
newMenu = new Menu(mItem);
}
use of org.eclipse.swt.widgets.MenuItem in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_Menu method test_getItemI.
@Test
public void test_getItemI() {
MenuItem mItem0 = new MenuItem(menu, SWT.NULL);
MenuItem mItem1 = new MenuItem(menu, SWT.NULL);
assertEquals(menu.getItem(0), mItem0);
assertEquals(menu.getItem(1), mItem1);
}
use of org.eclipse.swt.widgets.MenuItem in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_Menu method test_getItemCount.
@Test
public void test_getItemCount() {
int number = 10;
for (int i = 0; i < number; i++) {
assertEquals(menu.getItemCount(), i);
new MenuItem(menu, 0);
}
}
use of org.eclipse.swt.widgets.MenuItem in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_Menu method test_getItems.
@Test
public void test_getItems() {
int number = 5;
MenuItem[] items = new MenuItem[number];
for (int i = 0; i < number; i++) {
items[i] = new MenuItem(menu, 0);
}
assertArrayEquals(":a:", items, menu.getItems());
menu.getItems()[0].dispose();
assertArrayEquals(":b:", new MenuItem[] { items[1], items[2], items[3], items[4] }, menu.getItems());
menu.getItems()[3].dispose();
assertArrayEquals(":c:", new MenuItem[] { items[1], items[2], items[3] }, menu.getItems());
menu.getItems()[1].dispose();
assertArrayEquals(":d:", new MenuItem[] { items[1], items[3] }, menu.getItems());
}
Aggregations