コード例 #1
0
  @Test
  public void testFiresPresentationChangeToFullScreen() {
    environment.getRemoteObject().setHandler(new VideoOperationHandler(video));
    video.addPresentationListener(presentationListener);
    JsonObject parameters = new JsonObject();
    parameters.add(PROPERTY_PRESENTATION, Presentation.FULL_SCREEN.name());

    environment.dispatchNotify(Constants.EVENT_PRESENTATION, parameters);

    verify(presentationListener).presentationChanged(Presentation.FULL_SCREEN);
  }
コード例 #2
0
  @Test
  public void testFiresPlaybackChange() {
    environment.getRemoteObject().setHandler(new VideoOperationHandler(video));
    video.addPlaybackListener(playbackListener);
    JsonObject parameters = new JsonObject();
    parameters.add(PROPERTY_PLAYBACK, Playback.ERROR.name());

    environment.dispatchNotify(Constants.EVENT_PLAYBACK, parameters);

    verify(playbackListener).playbackChanged(Playback.ERROR);
  }
コード例 #3
0
  @Test
  public void testRendersPlaybackPlayOnce() {
    environment.getRemoteObject().setHandler(new VideoOperationHandler(video));
    video.addPlaybackListener(playbackListener);
    environment.newRequest();
    JsonObject parameters = new JsonObject();
    parameters.add(PROPERTY_PLAYBACK, Playback.PLAY.name());

    environment.dispatchNotify(Constants.EVENT_PLAYBACK, parameters);

    verify(playbackListener).playbackChanged(Playback.PLAY);
    assertFalse(hasOperation(WidgetUtil.getId(video), SET, null));
  }
コード例 #4
0
  @Test
  public void testActivatesItemOnlyIfDifferentFromClientItem() {
    SwipeItemProvider itemProvider = mockProvider(2);
    mockSwipeItem(itemProvider, 0, true);
    mockSwipeItem(itemProvider, 1, true);
    Swipe swipe = new Swipe(shell, itemProvider);
    swipe.show(0);
    JsonObject properties = new JsonObject();
    properties.add("item", 1);

    environment.dispatchNotify("Swipe", properties);

    verify(remoteObject, times(1)).set("active", 0);
    verify(remoteObject, never()).set("active", 1);
  }