Exemple #1
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);
  }
  @Test
  public void testRenderItemMetrics() throws IOException {
    TableItem item = new TableItem(table, SWT.NONE);
    item.setText("foo");

    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    JsonArray expected = JsonArray.readFrom("[[0, 0, 26, 3, 0, 3, 20]]");
    assertEquals(expected, message.findSetProperty(table, "itemMetrics"));
  }
  @Test
  public void testRenderOrigin() throws IOException {
    Composite content = new Composite(sc, SWT.NONE);
    sc.setContent(content);

    sc.setOrigin(1, 2);
    lca.renderChanges(sc);

    TestMessage message = Fixture.getProtocolMessage();
    JsonArray expected = JsonArray.readFrom("[ 1, 2 ]");
    assertEquals(expected, message.findSetProperty(sc, "origin"));
  }
Exemple #4
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"));
  }
  @Test
  public void testRenderCreateWithCheck() throws IOException {
    table = new Table(shell, SWT.CHECK);

    lca.renderInitialization(table);

    TestMessage message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(table);
    assertTrue(getStyles(operation).contains("CHECK"));
    JsonArray expected = JsonArray.readFrom("[4, 21]");
    assertEquals(expected, operation.getProperties().get("checkBoxMetrics"));
  }