public void testRenderAddSelectionListener() throws Exception {
    Scale scale = new Scale(shell, SWT.NONE);
    Fixture.markInitialized(display);
    Fixture.markInitialized(scale);
    Fixture.preserveWidgets();

    scale.addSelectionListener(new SelectionAdapter() {});
    lca.renderChanges(scale);

    Message message = Fixture.getProtocolMessage();
    assertEquals(Boolean.TRUE, message.findListenProperty(scale, "selection"));
  }
  public void testRenderSelectionListenerUnchanged() throws Exception {
    Scale scale = new Scale(shell, SWT.NONE);
    Fixture.markInitialized(display);
    Fixture.markInitialized(scale);
    Fixture.preserveWidgets();

    scale.addSelectionListener(new SelectionAdapter() {});
    Fixture.preserveWidgets();
    lca.renderChanges(scale);

    Message message = Fixture.getProtocolMessage();
    assertNull(message.findListenOperation(scale, "selection"));
  }
 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());
 }