@Test public void testRedraw() { final Table[] table = {null}; shell.setSize(100, 100); Button button = new Button(shell, SWT.PUSH); getRemoteObject(button).setHandler(new ButtonOperationHandler(button)); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { table[0] = new Table(shell, SWT.VIRTUAL); table[0].setItemCount(500); table[0].setSize(90, 90); assertFalse(isItemVirtual(table[0], 0)); table[0].clearAll(); table[0].redraw(); } }); shell.open(); Fixture.fakeNotifyOperation(getId(button), ClientMessageConst.EVENT_SELECTION, null); Fixture.readDataAndProcessAction(display); assertFalse(isItemVirtual(table[0], 0)); }
@Test public void testReadData_ScrollBarsSelectionEvent() { sc.setContent(new Composite(sc, SWT.NONE)); SelectionListener selectionListener = mock(SelectionListener.class); hScroll.addSelectionListener(selectionListener); vScroll.addSelectionListener(selectionListener); Fixture.fakeNotifyOperation(getId(hScroll), "Selection", null); Fixture.fakeNotifyOperation(getId(vScroll), "Selection", null); Fixture.readDataAndProcessAction(sc); verify(selectionListener, times(2)).widgetSelected(any(SelectionEvent.class)); }
// 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); }