Code example for Camera

Methods: setPreviewCallbackWithBuffer

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