Beispiel #1
0
  @Test
  public void testRenderInitialWidth() throws IOException {
    lca.render(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(10, message.findCreateProperty(column, "width").asInt());
  }
Beispiel #2
0
  @Test
  public void testRenderInitialFooterSpan() throws IOException {
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(column, "footerSpan"));
  }
Beispiel #3
0
  @Test
  public void testRenderParent() throws IOException {
    lca.renderInitialization(column);

    TestMessage message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(column);
    assertEquals(WidgetUtil.getId(column.getParent()), getParent(operation));
  }
Beispiel #4
0
  @Test
  public void testRenderVisible() throws IOException {
    column.setVisible(false);
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(JsonValue.FALSE, message.findSetProperty(column, "visibility"));
  }
Beispiel #5
0
  @Test
  public void testRenderMoveable() throws IOException {
    column.setMoveable(true);
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(JsonValue.TRUE, message.findSetProperty(column, "moveable"));
  }
Beispiel #6
0
  @Test
  public void testRenderAlignment() throws IOException {
    column.setAlignment(SWT.RIGHT);
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals("right", message.findSetProperty(column, "alignment").asString());
  }
Beispiel #7
0
  @Test
  public void testRenderWidth() throws IOException {
    column.setWidth(50);
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(50, message.findSetProperty(column, "width").asInt());
  }
Beispiel #8
0
  @Test
  public void testRenderIndex() throws IOException {
    new GridColumn(grid, SWT.NONE, 0);
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(1, message.findSetProperty(column, "index").asInt());
  }
Beispiel #9
0
  @Test
  public void testRenderInitialHeaderWordWrap() throws IOException {
    lca.render(column);

    TestMessage message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(column);
    assertTrue(operation.getProperties().names().indexOf("headerWordWrap") == -1);
  }
Beispiel #10
0
  @Test
  public void testRenderCustomVariant() throws IOException {
    column.setData(RWT.CUSTOM_VARIANT, "blue");
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals("variant_blue", message.findSetProperty(column, "customVariant").asString());
  }
Beispiel #11
0
  @Test
  public void testRenderHeaderWordWrap() throws IOException {
    column.setHeaderWordWrap(true);
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(JsonValue.TRUE, message.findSetProperty(column, "headerWordWrap"));
  }
Beispiel #12
0
  @Test
  public void testRenderFooterText() throws IOException {
    column.setFooterText("foo");
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals("foo", message.findSetProperty(column, "footerText").asString());
  }
Beispiel #13
0
  @Test
  public void testRenderLeft() throws IOException {
    GridColumn column2 = new GridColumn(grid, SWT.NONE, 0);
    column2.setWidth(50);
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(50, message.findSetProperty(column, "left").asInt());
  }
Beispiel #14
0
  @Test
  public void testRenderIntialToolTipMarkupEnabled() throws IOException {
    column.setData(RWT.TOOLTIP_MARKUP_ENABLED, Boolean.TRUE);

    lca.renderChanges(column);

    TestMessage message = getProtocolMessage();
    assertTrue("foo", message.findSetProperty(column, "toolTipMarkupEnabled").asBoolean());
  }
Beispiel #15
0
  @Test
  public void testRenderDispose() throws IOException {
    lca.renderDispose(column);

    TestMessage message = Fixture.getProtocolMessage();
    Operation operation = message.getOperation(0);
    assertTrue(operation instanceof DestroyOperation);
    assertEquals(WidgetUtil.getId(column), operation.getTarget());
  }
Beispiel #16
0
  @Test
  public void testRenderCheck() throws IOException {
    column = new GridColumn(grid, SWT.CHECK);

    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(JsonValue.TRUE, message.findSetProperty(column, "check"));
  }
Beispiel #17
0
  @Test
  public void testRenderInitialization_setsOperationHandler() throws IOException {
    String id = getId(column);

    lca.renderInitialization(column);

    OperationHandler handler = RemoteObjectRegistry.getInstance().get(id).getHandler();
    assertTrue(handler instanceof GridColumnOperationHandler);
  }
Beispiel #18
0
  @Test
  public void testRenderFooterFont() throws IOException {
    column.setFooterFont(new Font(display, "Arial", 20, SWT.BOLD));
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    JsonValue actual = message.findSetProperty(column, "footerFont");
    assertEquals(JsonArray.readFrom("[[\"Arial\"], 20, true, false]"), actual);
  }
Beispiel #19
0
  @Test
  public void testRenderCreate() throws IOException {
    lca.renderInitialization(column);

    TestMessage message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(column);
    assertEquals("rwt.widgets.GridColumn", operation.getType());
    assertFalse(operation.getProperties().names().contains("group"));
  }
Beispiel #20
0
  @Test
  public void testRenderToolTipMarkupEnabled() throws IOException {
    column.setData(RWT.TOOLTIP_MARKUP_ENABLED, Boolean.TRUE);
    Fixture.markInitialized(column);

    lca.renderChanges(column);

    TestMessage message = getProtocolMessage();
    assertNull(message.findSetOperation(column, "toolTipMarkupEnabled"));
  }
Beispiel #21
0
  @Test
  public void testRenderFooterSpan() throws IOException {
    createGridColumns(grid, 3, SWT.NONE);
    column.setData("footerSpan", Integer.valueOf(2));

    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(2, message.findSetProperty(column, "footerSpan").asInt());
  }
Beispiel #22
0
  @Test
  public void testRenderCreateWithAligment() throws IOException {
    column = new GridColumn(grid, SWT.RIGHT);

    lca.render(column);

    TestMessage message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(column);
    assertTrue(operation.getProperties().names().indexOf("style") == -1);
    assertEquals("right", message.findCreateProperty(column, "alignment").asString());
  }
Beispiel #23
0
  @Test
  public void testRenderGroup() throws IOException {
    GridColumnGroup group = new GridColumnGroup(grid, SWT.NONE);
    column = new GridColumn(group, SWT.NONE);

    lca.renderInitialization(column);

    TestMessage message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(column);
    assertEquals(getId(group), operation.getProperties().get("group").asString());
  }
Beispiel #24
0
  @Test
  public void testRenderHeaderWordWrapUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(column);

    column.setHeaderWordWrap(true);
    Fixture.preserveWidgets();
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(column, "headerWordWrap"));
  }
Beispiel #25
0
  @Test
  public void testRenderVisibleUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(column);

    column.setVisible(false);
    Fixture.preserveWidgets();
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(column, "visibility"));
  }
Beispiel #26
0
  @Test
  public void testRenderFooterImage() throws IOException {
    Image image = loadImage(display, Fixture.IMAGE_100x50);

    column.setFooterImage(image);
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    String imageLocation = ImageFactory.getImagePath(image);
    JsonArray expected = JsonArray.readFrom("[\"" + imageLocation + "\", 100, 50 ]");
    assertEquals(expected, message.findSetProperty(column, "footerImage"));
  }
Beispiel #27
0
  @Test
  public void testRenderFooterTextUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(column);

    column.setFooterText("foo");
    Fixture.preserveWidgets();
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(column, "footerText"));
  }
Beispiel #28
0
  @Test
  public void testRenderCheckUnchanged() throws IOException {
    column = new GridColumn(grid, SWT.CHECK);
    Fixture.markInitialized(display);
    Fixture.markInitialized(column);

    Fixture.preserveWidgets();
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(column, "check"));
  }
Beispiel #29
0
  @Test
  public void testRenderFontUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(column);

    column.setHeaderFont(new Font(display, "Arial", 20, SWT.BOLD));
    Fixture.preserveWidgets();
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(column, "font"));
  }
Beispiel #30
0
  @Test
  public void testRenderAddSelectionListener() throws Exception {
    Fixture.markInitialized(display);
    Fixture.markInitialized(column);
    Fixture.preserveWidgets();

    column.addListener(SWT.Selection, mock(Listener.class));
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(JsonValue.TRUE, message.findListenProperty(column, "Selection"));
  }