Skip to content

Commit

Permalink
Fix CameraOptions tests
Browse files Browse the repository at this point in the history
  • Loading branch information
natario1 committed Jan 4, 2019
1 parent 4f6ef72 commit 07f421e
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public void testEmpty() {
assertTrue(o.getSupportedPictureAspectRatios().isEmpty());
assertTrue(o.getSupportedPictureSizes().isEmpty());
assertTrue(o.getSupportedWhiteBalance().isEmpty());
assertTrue(o.getSupportedFlash().isEmpty());
assertTrue(o.getSupportedHdr().isEmpty());
assertEquals(1, o.getSupportedFlash().size()); // Flash.OFF is always there
assertEquals(1, o.getSupportedHdr().size()); // Hdr.OFF is always there
assertFalse(o.isAutoFocusSupported());
assertFalse(o.isExposureCorrectionSupported());
assertFalse(o.isZoomSupported());
Expand Down Expand Up @@ -247,16 +247,20 @@ public void testWhiteBalance() {
public void testFlash() {
Camera.Parameters params = mock(Camera.Parameters.class);
when(params.getSupportedFlashModes()).thenReturn(Arrays.asList(
Camera.Parameters.FLASH_MODE_OFF, // Supported
Camera.Parameters.FLASH_MODE_AUTO, // Supported
Camera.Parameters.FLASH_MODE_TORCH, // Supported
Camera.Parameters.FLASH_MODE_RED_EYE // Not supported
));

CameraOptions o = new CameraOptions(params, false);
Collection<Flash> f = o.getSupportedControls(Flash.class);
assertEquals(f.size(), 2);
assertEquals(f.size(), 3);
assertTrue(f.contains(Flash.OFF));
assertTrue(f.contains(Flash.AUTO));
assertTrue(f.contains(Flash.TORCH));

assertTrue(o.supports(Flash.OFF));
assertTrue(o.supports(Flash.AUTO));
assertTrue(o.supports(Flash.TORCH));
}
Expand All @@ -275,6 +279,7 @@ public void testHdr() {
assertEquals(h.size(), 2);
assertTrue(h.contains(Hdr.OFF));
assertTrue(h.contains(Hdr.ON));

assertTrue(o.supports(Hdr.OFF));
assertTrue(o.supports(Hdr.ON));
}
Expand Down

0 comments on commit 07f421e

Please sign in to comment.