コード例 #1
0
ファイル: TableLCA_Test.java プロジェクト: JackWangCUMT/rap-1
  @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
ファイル: TableLCA_Test.java プロジェクト: JackWangCUMT/rap-1
  // bug 360152
  @Test
  public void testReadItemToolTipDoesNotResolveVirtualItems() {
    table = new Table(shell, SWT.VIRTUAL);
    getRemoteObject(table).setHandler(new TableOperationHandler(table));
    table.setData(ICellToolTipProvider.ENABLE_CELL_TOOLTIP, Boolean.TRUE);
    ICellToolTipAdapter toolTipAdapter = CellToolTipUtil.getAdapter(table);
    ITableAdapter tableAdapter = table.getAdapter(ITableAdapter.class);
    ICellToolTipProvider toolTipProvider = mock(ICellToolTipProvider.class);
    toolTipAdapter.setCellToolTipProvider(toolTipProvider);
    table.setItemCount(2);
    TableItem item = table.getItem(1);

    fakeCellToolTipRequest(table, getId(item), 0);
    Fixture.readDataAndProcessAction(table);

    verify(toolTipProvider).getToolTipText(item, 0);
    assertEquals(1, tableAdapter.getCreatedItems().length);
  }
コード例 #3
0
ファイル: TableLCA_Test.java プロジェクト: JackWangCUMT/rap-1
  @Test
  public void testRenderCellToolTipText_null() {
    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) {
            adapter.setCellToolTipText(null);
          }
        });

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

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