Fix code style and unit test issues for the compass fix.
This commit is contained in:
committed by
Łukasz Paczos
parent
e3b2452ba2
commit
d230172b3c
@@ -107,7 +107,8 @@ class LocationComponentCompassEngine implements CompassEngine, SensorEventListen
|
||||
if (lastAccuracySensorStatus == SensorManager.SENSOR_STATUS_UNRELIABLE) {
|
||||
Logger.d(TAG, "Compass sensor is unreliable, device calibration is needed.");
|
||||
// Update the heading, even if the sensor is unreliable.
|
||||
// This makes it possible to use a different indicator for the unreliable case, instead of just changing the RenderMode to NORMAL.
|
||||
// This makes it possible to use a different indicator for the unreliable case,
|
||||
// instead of just changing the RenderMode to NORMAL.
|
||||
//return;
|
||||
}
|
||||
if (event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR) {
|
||||
|
||||
@@ -58,7 +58,6 @@ public class CompassEngineTest {
|
||||
@Test
|
||||
public void whenGyroscopeIsNull_fallbackToGravity() {
|
||||
SensorManager sensorManager = mock(SensorManager.class);
|
||||
when(sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE)).thenReturn(null);
|
||||
new LocationComponentCompassEngine(windowManager, sensorManager);
|
||||
|
||||
verify(sensorManager, times(1)).getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
|
||||
@@ -67,7 +66,6 @@ public class CompassEngineTest {
|
||||
@Test
|
||||
public void whenGyroscopeIsNull_fallbackToMagneticField() {
|
||||
SensorManager sensorManager = mock(SensorManager.class);
|
||||
when(sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE)).thenReturn(null);
|
||||
new LocationComponentCompassEngine(windowManager, sensorManager);
|
||||
|
||||
verify(sensorManager, times(1)).getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
|
||||
|
||||
Reference in New Issue
Block a user