コード例 #1
0
ファイル: ComboLCA_Test.java プロジェクト: paulvi/rap
  @Test
  public void testFireDefaultSelectionEvent() {
    SelectionListener listener = mock(SelectionListener.class);
    combo.addSelectionListener(listener);

    Fixture.fakeNotifyOperation(getId(combo), ClientMessageConst.EVENT_DEFAULT_SELECTION, null);
    Fixture.readDataAndProcessAction(combo);

    verify(listener, times(1)).widgetDefaultSelected(any(SelectionEvent.class));
  }
コード例 #2
0
 private void testSelectionEvent(final Scale scale) {
   final StringBuilder log = new StringBuilder();
   SelectionListener selectionListener =
       new SelectionAdapter() {
         public void widgetSelected(SelectionEvent event) {
           assertEquals(scale, event.getSource());
           assertEquals(null, event.item);
           assertEquals(SWT.NONE, event.detail);
           assertEquals(0, event.x);
           assertEquals(0, event.y);
           assertEquals(0, event.width);
           assertEquals(0, event.height);
           assertEquals(true, event.doit);
           log.append("widgetSelected");
         }
       };
   scale.addSelectionListener(selectionListener);
   String scaleId = WidgetUtil.getId(scale);
   Fixture.fakeRequestParam(JSConst.EVENT_WIDGET_SELECTED, scaleId);
   Fixture.readDataAndProcessAction(scale);
   assertEquals("widgetSelected", log.toString());
 }