Search in sources :

Example 1 with ComplexPanel

use of com.google.gwt.user.client.ui.ComplexPanel in project gwt-test-utils by gwt-test-utils.

the class ComplexPanelTest method visible.

@Test
public void visible() {
    // Given
    ComplexPanel panel = new FlowPanel();
    // Preconditions
    assertThat(panel.isVisible()).isEqualTo(true);
    // When
    panel.setVisible(false);
    // Then
    assertThat(panel.isVisible()).isEqualTo(false);
}
Also used : ComplexPanel(com.google.gwt.user.client.ui.ComplexPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Test(org.junit.Test)

Example 2 with ComplexPanel

use of com.google.gwt.user.client.ui.ComplexPanel in project gwt-test-utils by gwt-test-utils.

the class ComplexPanelTest method remove.

@Test
public void remove() {
    // Given
    ComplexPanel panel = new FlowPanel();
    Button b = new Button();
    panel.add(b);
    // Preconditions
    assertThat(panel.getWidgetCount()).isEqualTo(1);
    assertThat(b.getParent()).isEqualTo(panel);
    // When
    panel.remove(b);
    // Then
    assertThat(panel.getWidgetCount()).isEqualTo(0);
    assertThat(b.getParent()).isNull();
}
Also used : Button(com.google.gwt.user.client.ui.Button) ComplexPanel(com.google.gwt.user.client.ui.ComplexPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Test(org.junit.Test)

Example 3 with ComplexPanel

use of com.google.gwt.user.client.ui.ComplexPanel in project gwt-test-utils by gwt-test-utils.

the class ComplexPanelTest method remove_ByIndex.

@Test
public void remove_ByIndex() {
    // Given
    ComplexPanel panel = new FlowPanel();
    Button b0 = new Button();
    panel.add(b0);
    Button b1 = new Button();
    panel.add(b1);
    // When
    panel.remove(1);
    // Then
    assertThat(panel.getWidgetCount()).isEqualTo(1);
    assertThat(panel.getWidget(0)).isEqualTo(b0);
    assertThat(b0.getParent()).isEqualTo(panel);
    assertThat(b1.getParent()).isNull();
}
Also used : Button(com.google.gwt.user.client.ui.Button) ComplexPanel(com.google.gwt.user.client.ui.ComplexPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Test(org.junit.Test)

Example 4 with ComplexPanel

use of com.google.gwt.user.client.ui.ComplexPanel in project gwt-test-utils by gwt-test-utils.

the class ComplexPanelTest method add.

@Test
public void add() {
    // Given
    ComplexPanel panel = new FlowPanel();
    RootPanel.get().add(panel);
    assertThat(panel.isAttached()).isTrue();
    assertThat(panel.getWidgetCount()).isEqualTo(0);
    Button b1 = new Button();
    assertThat(b1.isAttached()).isFalse();
    assertThat(b1.getParent()).isNull();
    // When
    panel.add(b1);
    // Then
    assertThat(b1.isAttached()).isTrue();
    assertThat(b1.getParent()).isEqualTo(panel);
    assertThat(panel.getWidgetCount()).isEqualTo(1);
    assertThat(panel.getWidget(0)).isEqualTo(b1);
    assertThat(panel.getWidgetIndex(b1)).isEqualTo(0);
}
Also used : Button(com.google.gwt.user.client.ui.Button) ComplexPanel(com.google.gwt.user.client.ui.ComplexPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Test(org.junit.Test)

Example 5 with ComplexPanel

use of com.google.gwt.user.client.ui.ComplexPanel in project gwt-test-utils by gwt-test-utils.

the class ComplexPanelTest method title.

@Test
public void title() {
    // Given
    ComplexPanel panel = new FlowPanel();
    // When
    panel.setTitle("title");
    // Then
    assertThat(panel.getTitle()).isEqualTo("title");
}
Also used : ComplexPanel(com.google.gwt.user.client.ui.ComplexPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Test(org.junit.Test)

Aggregations

ComplexPanel (com.google.gwt.user.client.ui.ComplexPanel)6 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)6 Test (org.junit.Test)6 Button (com.google.gwt.user.client.ui.Button)4