Exemple #1
0
  @Test
  public void testRenderInitialFooterSpan() throws IOException {
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(column, "footerSpan"));
  }
Exemple #2
0
  @Test
  public void testRenderInitialMnemonicIndex() throws IOException {
    lca.renderChanges(group);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(group, "mnemonicIndex"));
  }
  @Test
  public void testRenderCellToolTipText() {
    Fixture.markInitialized(display);
    Fixture.markInitialized(table);
    getRemoteObject(table).setHandler(new TableOperationHandler(table));
    createTableItems(table, 5);
    final ICellToolTipAdapter adapter = CellToolTipUtil.getAdapter(table);
    adapter.setCellToolTipProvider(
        new ICellToolTipProvider() {
          @Override
          public void getToolTipText(Item item, int columnIndex) {
            StringBuilder buffer = new StringBuilder();
            buffer.append("[");
            buffer.append(WidgetUtil.getId(item));
            buffer.append(",");
            buffer.append(columnIndex);
            buffer.append("]");
            adapter.setCellToolTipText(buffer.toString());
          }
        });

    String itemId = WidgetUtil.getId(table.getItem(2));
    fakeCellToolTipRequest(table, itemId, 0);
    Fixture.executeLifeCycleFromServerThread();

    TestMessage message = Fixture.getProtocolMessage();
    String expected = "[" + itemId + ",0]";
    assertEquals(expected, message.findSetProperty(table, "cellToolTipText").asString());
  }
Exemple #4
0
  @Test
  public void testRenderInitialWidth() throws IOException {
    lca.render(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(10, message.findCreateProperty(column, "width").asInt());
  }
  @Test
  public void testRenderInitialItemMetrics() throws IOException {
    lca.render(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertNotNull(message.findSetOperation(table, "itemMetrics"));
  }
Exemple #6
0
  @Test
  public void testReadLeft() {
    final List<Event> events = new LinkedList<Event>();
    GridColumn[] columns = createGridColumns(grid, 2, SWT.NONE);
    column.addListener(SWT.Move, new LoggingControlListener(events));
    columns[0].addListener(SWT.Move, new LoggingControlListener(events));
    columns[1].addListener(SWT.Move, new LoggingControlListener(events));

    // Simulate request that initializes widgets
    Fixture.fakeNewRequest();
    Fixture.executeLifeCycleFromServerThread();
    // Simulate request that changes column left
    int newLeft = 3;
    Fixture.fakeNewRequest();
    JsonObject parameters = new JsonObject().add("left", newLeft);
    Fixture.fakeCallOperation(getId(columns[0]), "move", parameters);
    Fixture.executeLifeCycleFromServerThread();

    assertEquals(2, events.size());
    Event event = events.get(0);
    assertSame(columns[0], event.widget);
    event = events.get(1);
    assertSame(column, event.widget);
    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(20, message.findSetProperty(column, "left").asInt());
    assertEquals(0, message.findSetProperty(columns[0], "left").asInt());
  }
Exemple #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());
  }
Exemple #8
0
  @Test
  public void testRenderMnemonicIndex() throws IOException {
    group.setText("te&st");
    lca.renderChanges(group);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(2, message.findSetProperty(group, "mnemonicIndex").asInt());
  }
  @Test
  public void testRenderShowFocusedControl() throws IOException {
    sc.setShowFocusedControl(true);
    lca.renderChanges(sc);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(JsonValue.TRUE, message.findSetProperty(sc, "showFocusedControl"));
  }
Exemple #10
0
  @Test
  public void testRenderAlwaysHideSelection() throws IOException {
    table.setData(Table.ALWAYS_HIDE_SELECTION, Boolean.TRUE);
    lca.renderChanges(table);

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

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals("foo", message.findSetProperty(column, "footerText").asString());
  }
Exemple #12
0
  @Test
  public void testRenderVisible() throws IOException {
    column.setVisible(false);
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(JsonValue.FALSE, message.findSetProperty(column, "visibility"));
  }
Exemple #13
0
  @Test
  public void testRenderHeaderHeight() throws IOException {
    table.setHeaderVisible(true);
    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(31, message.findSetProperty(table, "headerHeight").asInt());
  }
Exemple #14
0
  @Test
  public void testRenderColumnCount() throws IOException {
    new TableColumn(table, SWT.NONE);
    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(1, message.findSetProperty(table, "columnCount").asInt());
  }
Exemple #15
0
  @Test
  public void testRenderInitialColumnOrder() throws IOException {
    lca.render(table);

    TestMessage message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(table);
    assertTrue(operation.getProperties().names().indexOf("columnOrder") == -1);
  }
Exemple #16
0
  @Test
  public void testRenderItemCount() throws IOException {
    table.setItemCount(10);
    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(10, message.findSetProperty(table, "itemCount").asInt());
  }
Exemple #17
0
  @Test
  public void testRenderEnableCellToolTip() throws IOException {
    table.setData(ICellToolTipProvider.ENABLE_CELL_TOOLTIP, Boolean.TRUE);
    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(JsonValue.TRUE, message.findSetProperty(table, "enableCellToolTip"));
  }
Exemple #18
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());
  }
Exemple #19
0
  @Test
  public void testRenderMoveable() throws IOException {
    column.setMoveable(true);
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(JsonValue.TRUE, message.findSetProperty(column, "moveable"));
  }
Exemple #20
0
  @Test
  public void testRenderLinesVisible() throws IOException {
    table.setLinesVisible(true);
    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(JsonValue.TRUE, message.findSetProperty(table, "linesVisible"));
  }
Exemple #21
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);
  }
  @Test
  public void testRenderParent() throws IOException {
    lca.renderInitialization(sc);

    TestMessage message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(sc);
    assertEquals(getId(sc.getParent()), getParent(operation));
  }
Exemple #23
0
  @Test
  public void testRenderInitialScrollLeft() throws IOException {
    getLCA(display).render(display);

    TestMessage message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(table);
    assertFalse(operation.getProperties().names().contains("scrollLeft"));
  }
Exemple #24
0
  @Test
  public void testRenderCreate() throws IOException {
    lca.renderInitialization(group);

    TestMessage message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(group);
    assertEquals("rwt.widgets.Group", operation.getType());
  }
Exemple #25
0
  @Test
  public void testRenderHeaderWordWrap() throws IOException {
    column.setHeaderWordWrap(true);
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(JsonValue.TRUE, message.findSetProperty(column, "headerWordWrap"));
  }
Exemple #26
0
  @Test
  public void testRenderInitialSortDirection() throws IOException {
    lca.render(table);

    TestMessage message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(table);
    assertFalse(operation.getProperties().names().contains("sortDirection"));
  }
  @Test
  public void testRenderInitialShowFocusedControl() throws IOException {
    lca.render(sc);

    TestMessage message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(sc);
    assertFalse(operation.getProperties().names().contains("showFocusedControl"));
  }
Exemple #28
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());
  }
  @Test
  public void testRenderInitialScrollBarsVisible() throws IOException {
    lca.render(sc);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(hScroll, "visibility"));
    assertNull(message.findSetOperation(vScroll, "visibility"));
  }
Exemple #30
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());
  }