assertNull(menu.getAdapter(List.class));
assertNull(item_1.getAdapter(List.class));
}
// IMenuInfo
{
IMenuInfo menuObject = MenuObjectInfoUtils.getMenuInfo(menu);
assertSame(menu, menuObject.getModel());
// presentation
{
// no need for image, because this MenuBar is visible on usual screen shot
assertNull(menuObject.getImage());
// some reasonable bounds
{
Rectangle bounds = menuObject.getBounds();
assertThat(bounds.x).isEqualTo(10);
assertThat(bounds.y).isEqualTo(10);
assertThat(bounds.width).isGreaterThan(30);
assertThat(bounds.height).isGreaterThan(20);
}
}
// access
assertTrue(menuObject.isHorizontal());
{
List<IMenuItemInfo> itemObjects = menuObject.getItems();
assertThat(itemObjects).hasSize(2);
// "Sub" item
{
IMenuItemInfo itemObject = itemObjects.get(0);
assertSame(item_1, itemObject.getModel());
// presentation
{
// items don't have screen shot, we show them on menu shots
assertNull(itemObject.getImage());
// reasonable bounds
{
Rectangle bounds = itemObject.getBounds();
assertThat(bounds.x).isEqualTo(2);
assertThat(bounds.y).isEqualTo(2);
assertThat(bounds.width).isGreaterThan(30);
assertThat(bounds.height).isGreaterThan(20);
}
}
// sub-menu
{
IMenuInfo subMenuObject = itemObject.getMenu();
assertSame(subMenu, subMenuObject.getModel());
// access
assertFalse(subMenuObject.isHorizontal());
{
List<IMenuItemInfo> subMenuItemObjects = subMenuObject.getItems();
assertThat(subMenuItemObjects).hasSize(2);
assertSame(subMenuItem_1, subMenuItemObjects.get(0).getModel());
assertSame(subMenuItem_2, subMenuItemObjects.get(1).getModel());
}
// presentation
assertNotNull(subMenuObject.getImage());
{
Rectangle bounds = subMenuObject.getBounds();
assertThat(bounds.width).isGreaterThan(85);
assertThat(bounds.height).isGreaterThan(45);
}
}
}