"public class Test extends FlowPanel {",
" public Test() {",
" }",
"}");
GraphicalEditPart panelEditPart = canvas.getEditPart(panel);
Figure panelFigure = panelEditPart.getFigure();
// no device yet
assertEquals(new Rectangle(20, 20, 450, 300), panelFigure.getBounds());
// set device
{
UiContext context = new UiContext();
// click ToolItem to open Menu
ToolItem deviceToolItem = context.getToolItem("No device");
context.click(deviceToolItem, SWT.ARROW);
// click "device" MenuItem
{
Menu menu = (Menu) deviceToolItem.getData("designTimeMenu");
MenuItem menuItem = context.getMenuItem(menu, "QVGA");
context.click(menuItem);
}
}
// new bounds
assertEquals(new Rectangle(25, 25, 240, 320), panelFigure.getBounds());
// flip orientation
{
UiContext context = new UiContext();
ToolItem deviceToolItem = context.getToolItem("Flip orientation");
// PORTRAIT -> LANDSCAPE
context.click(deviceToolItem);
assertEquals(new Rectangle(25, 25, 320, 240), panelFigure.getBounds());
// LANDSCAPE -> PORTRAIT
context.click(deviceToolItem);
assertEquals(new Rectangle(25, 25, 240, 320), panelFigure.getBounds());
}
}