aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/test
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2011-09-30 12:52:41 +0200
committerSamuel Tardieu <sam@rfc1149.net>2011-09-30 12:52:41 +0200
commitc647126107da954deab00fabe739206ac36cb78c (patch)
tree45f5a0ee3bf2dc9ce592cb67bfceb9096377e77c /tests/src/cgeo/geocaching/test
parentff3424298e117063372427e4a5176757dc9ecd2e (diff)
downloadcgeo-c647126107da954deab00fabe739206ac36cb78c.zip
cgeo-c647126107da954deab00fabe739206ac36cb78c.tar.gz
cgeo-c647126107da954deab00fabe739206ac36cb78c.tar.bz2
Add a new test for Compatibility package
This test should pass in any supported Android version.
Diffstat (limited to 'tests/src/cgeo/geocaching/test')
-rw-r--r--tests/src/cgeo/geocaching/test/CompatibilityTest.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/test/CompatibilityTest.java b/tests/src/cgeo/geocaching/test/CompatibilityTest.java
new file mode 100644
index 0000000..1d5ef5c
--- /dev/null
+++ b/tests/src/cgeo/geocaching/test/CompatibilityTest.java
@@ -0,0 +1,35 @@
+package cgeo.geocaching.test;
+
+import cgeo.geocaching.cgeo;
+import cgeo.geocaching.compatibility.Compatibility;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+import junit.framework.Assert;
+
+@SuppressWarnings("static-method")
+public class CompatibilityTest extends ActivityInstrumentationTestCase2<cgeo> {
+
+ private cgeo activity;
+
+ public CompatibilityTest() {
+ super("cgeo.geocaching", cgeo.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ activity = getActivity();
+ }
+
+ public void testDataChanged() {
+ // This should not raise an exception in any Android version
+ Compatibility.dataChanged("cgeo.geocaching");
+ }
+
+ public void testGetDirectionNow() {
+ final float angle = Compatibility.getDirectionNow(1.0f, activity);
+ Assert.assertTrue(angle == 1.0f || angle == 91.0f || angle == 181.0f || angle == 271.0f);
+ }
+
+}