// create GWT TextBox
WidgetInfo newTextBox = createJavaInfo("com.google.gwt.user.client.ui.TextBox");
canvas.command_absolute_CREATE(newTextBox, null);
// check
assertThat(canvas.getWidgets()).excludes(newTextBox);
WidgetCanvasInfo widgetCanvas = canvas.getChildren(WidgetCanvasInfo.class).get(0);
// check presentation
{
IObjectPresentation presentation = widgetCanvas.getPresentation();
IObjectPresentation widgetPresentation = newTextBox.getPresentation();
assertThat(presentation.getText().startsWith(widgetPresentation.getText())).isTrue();
assertThat(presentation.getIcon()).isSameAs(widgetPresentation.getIcon());
}
assertThat(widgetCanvas.getWidget()).isSameAs(newTextBox);
assertEditor(
"import com.google.gwt.user.client.ui.TextBox;",
"// filler filler filler",
"public class Test extends Canvas {",
" public Test() {",
" {",
" WidgetCanvas widgetCanvas = new WidgetCanvas(new TextBox());",
" addChild(widgetCanvas);",
" }",
" }",
"}");
// check presentation
IObjectPresentation presentation = widgetCanvas.getPresentation();
assertThat(presentation.getChildrenGraphical()).excludes(newTextBox);
assertThat(presentation.getChildrenTree()).excludes(newTextBox);
// check properties
{
Property[] canvasProperties = widgetCanvas.getProperties();
Property[] textProperties = newTextBox.getProperties();
assertThat(canvasProperties).contains((Object[]) textProperties);
}
Property canvasProperty = widgetCanvas.getPropertyByTitle("Canvas");
assertThat(canvasProperty).isInstanceOf(ComplexProperty.class);
}