pull/651/head
Mattia Iavarone 6 years ago
parent 06fbf93f06
commit f549eb9b2f
  1. 13
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/internal/utils/OrientationHelperTest.java

@ -41,6 +41,10 @@ public class OrientationHelperTest extends BaseTest {
@Test
public void testEnable() {
// On some API levels, enable() needs to be run on the UI thread.
uiSync(new Runnable() {
@Override
public void run() {
assertEquals(helper.getLastDisplayOffset(), -1);
assertEquals(helper.getLastDeviceOrientation(), -1);
@ -55,10 +59,15 @@ public class OrientationHelperTest extends BaseTest {
assertEquals(helper.getLastDisplayOffset(), -1);
assertEquals(helper.getLastDeviceOrientation(), -1);
}
});
}
@Test
public void testRotation() {
// On some API levels, enable() needs to be run on the UI thread.
uiSync(new Runnable() {
@Override
public void run() {
// Sometimes (on some APIs) the helper will trigger an update to 0
// right after enabling. But that's fine for us, times(1) will be OK either way.
helper.enable();
@ -94,4 +103,6 @@ public class OrientationHelperTest extends BaseTest {
assertEquals(helper.getLastDeviceOrientation(), 270);
verify(callback, times(1)).onDeviceOrientationChanged(270);
}
});
}
}

Loading…
Cancel
Save