Code example for Camera

Methods: setPreviewCallback

0
  public void testSetPreviewCallbacks() throws Exception { 
    TestPreviewCallback callback = new TestPreviewCallback();
    assertThat(callback.camera).isNull();
    assertThat(callback.data).isNull();
 
    camera.setPreviewCallback(callback);
    shadowCamera.invokePreviewCallback("foobar".getBytes());
 
    assertThat(callback.camera).isSameAs(camera);
    assertThat(callback.data).isEqualTo("foobar".getBytes());
  } 
 
  @Test 
  public void testSetOneShotPreviewCallbacks() throws Exception { 
    TestPreviewCallback callback = new TestPreviewCallback();
    assertThat(callback.camera).isNull();
    assertThat(callback.data).isNull();
 
    camera.setOneShotPreviewCallback(callback);
    shadowCamera.invokePreviewCallback("foobar".getBytes());