Esempio n. 1
0
  @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());
  }
Esempio n. 2
0
  @Test
  public void testDontRenderSetDataWithoutVirtual() throws Exception {
    Fixture.markInitialized(display);
    Fixture.markInitialized(table);
    Fixture.preserveWidgets();

    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findListenOperation(table, "SetData"));
  }
Esempio n. 3
0
  @Test
  public void testDontRenderSetDataListenerTwice() throws Exception {
    table = new Table(shell, SWT.VIRTUAL | SWT.NO_SCROLL | SWT.MULTI);
    Fixture.markInitialized(display);
    Fixture.markInitialized(table);
    Fixture.preserveWidgets();

    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findListenOperation(table, "SetData"));
  }
Esempio n. 4
0
  @Test
  public void testRenderEnableCellToolTipUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(table);

    table.setData(ICellToolTipProvider.ENABLE_CELL_TOOLTIP, Boolean.TRUE);
    Fixture.preserveWidgets();
    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(table, "enableCellToolTip"));
  }
Esempio n. 5
0
  @Test
  public void testRenderItemCountUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(table);

    table.setItemCount(10);
    Fixture.preserveWidgets();
    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(table, "itemCount"));
  }
Esempio n. 6
0
  @Test
  public void testRenderCustomVariantUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(column);

    column.setData(RWT.CUSTOM_VARIANT, "blue");
    Fixture.preserveWidgets();
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(column, "customVariant"));
  }
Esempio n. 7
0
  @Test
  public void testRenderMnemonicIndexUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(group);

    group.setText("te&st");
    Fixture.preserveWidgets();
    lca.renderChanges(group);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(group, "mnemonicIndex"));
  }
Esempio n. 8
0
  @Test
  public void testRenderColumnCountUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(table);

    new TableColumn(table, SWT.NONE);
    Fixture.preserveWidgets();
    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(table, "columnCount"));
  }
Esempio n. 9
0
  @Test
  public void testRenderAlignmentUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(column);

    column.setAlignment(SWT.RIGHT);
    Fixture.preserveWidgets();
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(column, "alignment"));
  }
Esempio n. 10
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"));
  }
Esempio n. 11
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"));
  }
Esempio n. 12
0
  @Test
  public void testRenderLinesVisibleUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(table);

    table.setLinesVisible(true);
    Fixture.preserveWidgets();
    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(table, "linesVisible"));
  }
Esempio n. 13
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"));
  }
Esempio n. 14
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"));
  }
Esempio n. 15
0
  @Test
  public void testRenderShowFocusedControlUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(sc);

    sc.setShowFocusedControl(true);
    Fixture.preserveWidgets();
    lca.renderChanges(sc);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(sc, "showFocusedControl"));
  }
Esempio n. 16
0
  @Test
  public void testRenderAlwaysHideSelectionUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(table);

    table.setData(Table.ALWAYS_HIDE_SELECTION, Boolean.TRUE);
    Fixture.preserveWidgets();
    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(table, "alwaysHideSelection"));
  }
Esempio n. 17
0
  @Test
  public void testRenderScrollLeftUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(table);

    table.getAdapter(ITableAdapter.class).setLeftOffset(10);
    Fixture.preserveWidgets();
    getLCA(display).render(display);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(table, "scrollLeft"));
  }
Esempio n. 18
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"));
  }
Esempio n. 19
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"));
  }
Esempio n. 20
0
  @Test
  public void testRenderFooterSpanUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(column);
    createGridColumns(grid, 3, SWT.NONE);
    column.setData("footerSpan", Integer.valueOf(2));

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

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(column, "footerSpan"));
  }
Esempio n. 21
0
  @Test
  public void testRenderFooterImageUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(column);
    Image image = loadImage(display, Fixture.IMAGE_100x50);

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

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(column, "footerImage"));
  }
Esempio n. 22
0
  @Test
  public void testRenderSelectionListenerUnchanged() throws Exception {
    Fixture.markInitialized(display);
    Fixture.markInitialized(column);
    Fixture.preserveWidgets();

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

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findListenOperation(column, "Selection"));
  }
Esempio n. 23
0
  @Test
  public void testRenderItemMetricsUnchanged() throws IOException {
    TableItem item = new TableItem(table, SWT.NONE);
    item.setText("foo");
    Fixture.markInitialized(display);
    Fixture.markInitialized(table);

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

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(table, "itemMetrics"));
  }
Esempio n. 24
0
  @Test
  public void testRenderLeftUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(column);

    GridColumn column2 = new GridColumn(grid, SWT.NONE, 0);
    column2.setWidth(50);
    Fixture.preserveWidgets();
    lca.renderChanges(column);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(column, "left"));
  }
Esempio n. 25
0
  @Test
  public void testRenderFocusItemUnchanged() throws IOException {
    createTableItems(table, 3);
    Fixture.markInitialized(display);
    Fixture.markInitialized(table);

    table.getAdapter(ITableAdapter.class).setFocusIndex(2);
    Fixture.preserveWidgets();
    getLCA(display).render(display);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(table, "focusItem"));
  }
Esempio n. 26
0
  @Test
  public void testRenderTopItemIndexUnchanged() throws IOException {
    createTableItems(table, 3);
    Fixture.markInitialized(display);
    Fixture.markInitialized(table);

    table.setTopIndex(2);
    Fixture.preserveWidgets();
    getLCA(display).render(display);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(table, "topItemIndex"));
  }
Esempio n. 27
0
  @Test
  public void testRenderContentUnchanged() throws IOException {
    Composite content = new Composite(sc, SWT.NONE);
    Fixture.markInitialized(display);
    Fixture.markInitialized(sc);

    sc.setContent(content);
    Fixture.preserveWidgets();
    lca.renderChanges(sc);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(sc, "content"));
  }
Esempio n. 28
0
  @Test
  public void testRenderFixedColumnsUnchanged() throws IOException {
    new TableColumn(table, SWT.NONE);
    Fixture.markInitialized(display);
    Fixture.markInitialized(table);

    table.setData("fixedColumns", Integer.valueOf(1));
    Fixture.preserveWidgets();
    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(table, "fixedColumns"));
  }
Esempio n. 29
0
  @Test
  public void testRenderAddScrollBarsSelectionListener_Vertical() throws Exception {
    Fixture.markInitialized(display);
    Fixture.markInitialized(sc);
    Fixture.markInitialized(vScroll);
    Fixture.preserveWidgets();

    vScroll.addSelectionListener(new SelectionAdapter() {});
    lca.renderChanges(sc);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(JsonValue.TRUE, message.findListenProperty(vScroll, "Selection"));
  }
Esempio n. 30
0
  @Test
  public void testRenderItemHeightUnchanged() throws IOException {
    Font font = new Font(display, "Arial", 26, SWT.NONE);
    Fixture.markInitialized(display);
    Fixture.markInitialized(table);

    table.setFont(font);
    Fixture.preserveWidgets();
    lca.renderChanges(table);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(table, "itemHeight"));
  }