//
// Tests
//
////////////////////////////////////////////////////////////////////////////
public void test_filled() throws Exception {
CompositeInfo composite =
parseJavaInfo(
"public class Test extends Composite {",
" public Test() {",
" {",
" Button button = new Button();",
" initWidget(button);",
" }",
" }",
"}");
assertHierarchy(
"{this: com.google.gwt.user.client.ui.Composite} {this} {/initWidget(button)/}",
" {new: com.google.gwt.user.client.ui.Button} {local-unique: button} {/new Button()/ /initWidget(button)/}");
WidgetInfo button = composite.getWidget();
// do refresh()
composite.refresh();
assertFalse(composite.isEmpty());
// check Composite bounds
{
Rectangle bounds = composite.getBounds();
assertEquals(new Rectangle(0, 0, 450, 300), bounds);
}
{
Image image = composite.getImage();
assertNotNull(image);
assertThat(image.getBounds().width).isEqualTo(450);
assertThat(image.getBounds().height).isEqualTo(300);
}
// check Button bounds
{
Rectangle bounds = button.getBounds();
assertEquals(new Rectangle(0, 0, 450, 300), bounds);
}
// set new bounds
{
composite.getTopBoundsSupport().setSize(500, 250);
composite.refresh();
assertEquals(new Rectangle(0, 0, 500, 250), composite.getBounds());
}
}