Package org.eclipse.wb.internal.core.model.menu

Examples of org.eclipse.wb.internal.core.model.menu.IMenuItemInfo


      {
        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);
            }
          }
        }
        // "Separate item"
        {
          IMenuItemInfo itemObject = itemObjects.get(1);
          assertSame(item_2, itemObject.getModel());
          // no sub-menu
          assertNull(itemObject.getMenu());
          // no policy
          assertSame(IMenuPolicy.NOOP, itemObject.getPolicy());
        }
      }
    }
  }
View Full Code Here


      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());
          }
        }
      }
    }
View Full Code Here

    ComponentInfo button = menu.getItems().get(0);
    // IMenuItem-s
    {
      List<IMenuItemInfo> items = menuObject.getItems();
      assertThat(items).hasSize(1);
      IMenuItemInfo item = items.get(0);
      assertSame(button, item.getModel());
      // presentation
      {
        // no need for image, because parent Menu will include it
        assertNull(item.getImage());
        // some reasonable bounds
        {
          Rectangle bounds = item.getBounds();
          assertThat(bounds.x).isEqualTo(4);
          assertThat(bounds.y).isEqualTo(4);
          assertThat(bounds.width).isGreaterThan(5);
          assertThat(bounds.height).isGreaterThan(20);
        }
      }
      // access
      assertNull(item.getMenu());
      assertSame(IMenuPolicy.NOOP, item.getPolicy());
    }
  }
View Full Code Here

        "{this: com.extjs.gxt.ui.client.widget.menu.Menu} {this} {/add(item)/}",
        "  {new: com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem} {local-unique: item} {/new SeparatorMenuItem()/ /add(item)/}");
    menu.refresh();
    ItemInfo item = (ItemInfo) menu.getItems().get(0);
    //
    IMenuItemInfo itemObject = MenuObjectInfoUtils.getMenuItemInfo(item);
    assertNotNull(itemObject);
    assertSame(item, itemObject.getModel());
    // presentation
    {
      // no need for image, because parent Menu will include it
      assertNull(itemObject.getImage());
      // some reasonable bounds
      {
        Rectangle bounds = itemObject.getBounds();
        assertEquals(new Rectangle(4, 3, 450 - 4 - 4, 7), bounds);
      }
    }
    // access
    assertNull(itemObject.getMenu());
    assertSame(IMenuPolicy.NOOP, itemObject.getPolicy());
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wb.internal.core.model.menu.IMenuItemInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.