@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));
  }
  @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_usesOperationHandler() {
    ScrolledCompositeOperationHandler handler = spy(new ScrolledCompositeOperationHandler(sc));
    getRemoteObject(getId(sc)).setHandler(handler);

    Fixture.fakeNotifyOperation(getId(sc), "Help", new JsonObject());
    lca.readData(sc);

    verify(handler).handleNotifyHelp(sc, new JsonObject());
  }
  @Test
  public void testReadData_usesOperationHandler() {
    TableOperationHandler handler = spy(new TableOperationHandler(table));
    getRemoteObject(getId(table)).setHandler(handler);

    Fixture.fakeNotifyOperation(getId(table), "Help", new JsonObject());
    lca.readData(table);

    verify(handler).handleNotifyHelp(table, new JsonObject());
  }
Exemple #5
0
  @Test
  public void testReadData_usesOperationHandler() {
    GroupOperationHandler handler = spy(new GroupOperationHandler(group));
    getRemoteObject(getId(group)).setHandler(handler);

    Fixture.fakeNotifyOperation(getId(group), "Help", new JsonObject());
    lca.readData(group);

    verify(handler).handleNotifyHelp(group, new JsonObject());
  }