Пример #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());
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }