ImageBundleInfo bundle = ImageBundleContainerInfo.getBundles(frame).get(0);
List<ImageBundlePrototypeDescription> prototypes = bundle.getPrototypes();
prototype = prototypes.get(0);
}
// create new Image
ImageInfo newImage = prototype.createImageWidget();
newImage.putArbitraryValue(JavaInfo.FLAG_MANUAL_COMPONENT, Boolean.TRUE);
// check live properties
{
assertNotNull(newImage.getImage());
assertThat(newImage.getPreferredSize().width).isEqualTo(10);
assertThat(newImage.getPreferredSize().height).isEqualTo(20);
assertThat(newImage.shouldSetReasonableSize()).isFalse();
}
// do add
frame.command_CREATE2(newImage, null);
assertEditor(
"public class Test implements EntryPoint {",
" private static final MyImageBundle m_myBundle = GWT.create(MyImageBundle.class);",
" public void onModuleLoad() {",
" RootPanel rootPanel = RootPanel.get();",
" {",
" Image image = m_myBundle.first().createImage();",
" rootPanel.add(image);",
" }",
" }",
"}");
// permissions
{
CreationSupport creationSupport = newImage.getCreationSupport();
assertTrue(creationSupport.canReorder());
assertTrue(creationSupport.canReparent());
assertTrue(creationSupport.canDelete());
}
// assert that "image" is bound to AST
{
ASTNode node = getNode("image = ");
assertTrue(newImage.isRepresentedBy(node));
}
}