// get unsupported adaptable
assertNull(bar.getAdapter(String.class));
assertNull(item.getAdapter(String.class));
// IMenuInfo
{
IMenuInfo barObject = MenuObjectInfoUtils.getMenuInfo(bar);
assertSame(bar, barObject.getModel());
assertSame(bar, barObject.getToolkitModel());
// presentation
{
// no need for image, because this MenuBar is visible on usual screen shot
assertNull(barObject.getImage());
// some reasonable bounds
{
Rectangle bounds = barObject.getBounds();
assertThat(bounds.x).isEqualTo(0);
assertThat(bounds.y).isEqualTo(-1);
assertThat(bounds.width).isEqualTo(450);
assertThat(bounds.height).isGreaterThan(20);
}
}
// access
assertTrue(barObject.isHorizontal());
{
List<IMenuItemInfo> itemObjects = barObject.getItems();
assertThat(itemObjects).hasSize(1);
{
IMenuItemInfo itemObject = itemObjects.get(0);
assertSame(item, itemObject.getModel());
// presentation
{
// no need for image, because parent MenuBar is visible on usual screen shot
assertNull(itemObject.getImage());
// some reasonable bounds
{
Rectangle bounds = itemObject.getBounds();
assertThat(bounds.x).isEqualTo(3);
assertThat(bounds.y).isEqualTo(3);
assertThat(bounds.width).isGreaterThan(100);
assertThat(bounds.height).isGreaterThan(15);
}
}
// no policy
assertSame(IMenuPolicy.NOOP, itemObject.getPolicy());
// sub menu
{
IMenuInfo menuObject = itemObject.getMenu();
assertSame(subMenu, menuObject.getModel());
}
}
}
}
}