예제 #1
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));
  }
예제 #2
0
  @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));
  }
예제 #3
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());
  }
예제 #4
0
  @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());
  }
예제 #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());
  }