示例#1
0
  @Test
  public void testRenderInitialization_setsOperationHandler() throws IOException {
    String id = getId(progressBar);
    lca.renderInitialization(progressBar);

    OperationHandler handler = RemoteObjectRegistry.getInstance().get(id).getHandler();
    assertTrue(handler instanceof ProgressBarOperationHandler);
  }
示例#2
0
  @Test
  public void testRenderState() throws IOException {
    progressBar.setState(SWT.ERROR);
    lca.renderChanges(progressBar);

    Message message = Fixture.getProtocolMessage();
    assertEquals("error", message.findSetProperty(progressBar, "state").asString());
  }
示例#3
0
  @Test
  public void testRenderCreate() throws IOException {
    lca.renderInitialization(progressBar);

    Message message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(progressBar);
    assertEquals("rwt.widgets.ProgressBar", operation.getType());
  }
示例#4
0
  @Test
  public void testRenderInitialState() throws IOException {
    lca.render(progressBar);

    Message message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(progressBar);
    assertTrue(operation.getPropertyNames().indexOf("state") == -1);
  }
示例#5
0
  @Test
  public void testRenderSelection() throws IOException {
    progressBar.setSelection(10);
    lca.renderChanges(progressBar);

    Message message = Fixture.getProtocolMessage();
    assertEquals(10, message.findSetProperty(progressBar, "selection").asInt());
  }
示例#6
0
  @Test
  public void testRenderParent() throws IOException {
    lca.renderInitialization(progressBar);

    Message message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(progressBar);
    assertEquals(WidgetUtil.getId(progressBar.getParent()), operation.getParent());
  }
示例#7
0
  @Test
  public void testRenderChanges_rendersClientListener() throws IOException {
    progressBar.addListener(SWT.MouseEnter, new ClientListener(""));

    lca.renderChanges(progressBar);

    Message message = Fixture.getProtocolMessage();
    assertNotNull(message.findCallOperation(progressBar, "addListener"));
  }
示例#8
0
  @Test
  public void testReadData_usesOperationHandler() {
    ProgressBarOperationHandler handler = spy(new ProgressBarOperationHandler(progressBar));
    getRemoteObject(getId(progressBar)).setHandler(handler);

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

    verify(handler).handleNotifyHelp(progressBar, new JsonObject());
  }
示例#9
0
  @Test
  public void testRenderStateUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(progressBar);

    progressBar.setState(SWT.ERROR);
    Fixture.preserveWidgets();
    lca.renderChanges(progressBar);

    Message message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(progressBar, "state"));
  }
示例#10
0
  @Test
  public void testRenderMaxmumUnchanged() throws IOException {
    Fixture.markInitialized(display);
    Fixture.markInitialized(progressBar);

    progressBar.setMaximum(10);
    Fixture.preserveWidgets();
    lca.renderChanges(progressBar);

    Message message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(progressBar, "maximum"));
  }
示例#11
0
  @Test
  public void testRenderCreateWithVerticalAndIndeterminate() throws IOException {
    progressBar = new ProgressBar(shell, SWT.VERTICAL | SWT.INDETERMINATE);

    lca.renderInitialization(progressBar);

    Message message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(progressBar);
    Object[] styles = operation.getStyles();
    assertTrue(Arrays.asList(styles).contains("VERTICAL"));
    assertTrue(Arrays.asList(styles).contains("INDETERMINATE"));
  }