diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2014-12-14 14:46:04 +0100 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2014-12-14 14:46:04 +0100 |
commit | a51ccd03c339f0b1330d726ebcce73573808b9dc (patch) | |
tree | cf5a32ecf394829cfe3ff3a757adda3a367a5868 /tests | |
parent | bb4c556dc2bc602725e53d39bf4df4484723154d (diff) | |
download | cgeo-a51ccd03c339f0b1330d726ebcce73573808b9dc.zip cgeo-a51ccd03c339f0b1330d726ebcce73573808b9dc.tar.gz cgeo-a51ccd03c339f0b1330d726ebcce73573808b9dc.tar.bz2 |
fix geocoder test
The suppressed Android test didn't fit into the offset range, therefore
increasing the offset and always enabling the test.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/cgeo/geocaching/location/GeocoderTest.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/tests/src/cgeo/geocaching/location/GeocoderTest.java b/tests/src/cgeo/geocaching/location/GeocoderTest.java index cce093a..f53c074 100644 --- a/tests/src/cgeo/geocaching/location/GeocoderTest.java +++ b/tests/src/cgeo/geocaching/location/GeocoderTest.java @@ -10,26 +10,31 @@ import org.assertj.core.data.Offset; import rx.Observable; +import android.annotation.TargetApi; import android.location.Address; -import android.test.suitebuilder.annotation.Suppress; +import android.location.Geocoder; +import android.os.Build; public class GeocoderTest extends CGeoTestCase { private static final String TEST_ADDRESS = "46 rue Barrault, Paris, France"; private static final double TEST_LATITUDE = 48.82677; private static final double TEST_LONGITUDE = 2.34644; - private static final Offset<Double> TEST_OFFSET = Offset.offset(0.00010); - - @Suppress // Some emulators don't have access to Google Android geocoder - public void testAndroidGeocoder() { - testGeocoder(new AndroidGeocoder(CgeoApplication.getInstance()).getFromLocationName(TEST_ADDRESS), "Android"); + private static final Offset<Double> TEST_OFFSET = Offset.offset(0.00050); + + @TargetApi(Build.VERSION_CODES.GINGERBREAD) + public static void testAndroidGeocoder() { + // Some emulators don't have access to Google Android geocoder + if (Geocoder.isPresent()) { + testGeocoder(new AndroidGeocoder(CgeoApplication.getInstance()).getFromLocationName(TEST_ADDRESS), "Android"); + } } - public void testGCGeocoder() { + public static void testGCGeocoder() { testGeocoder(GCGeocoder.getFromLocationName(TEST_ADDRESS), "GC"); } - public void testMapQuestGeocoder() { + public static void testMapQuestGeocoder() { testGeocoder(MapQuestGeocoder.getFromLocationName(TEST_ADDRESS), "MapQuest"); } |