aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2014-04-05 20:30:31 +0200
committerSamuel Tardieu <sam@rfc1149.net>2014-04-05 20:30:31 +0200
commitff836c41e90deeb735f5b7b9c9e88872b9cb68fe (patch)
treec9671c04308d3dbc3bc398872c1a98a1f5098f27
parentb05075a3b3c76ae32baf1b88b6b8152c0594987f (diff)
downloadcgeo-ff836c41e90deeb735f5b7b9c9e88872b9cb68fe.zip
cgeo-ff836c41e90deeb735f5b7b9c9e88872b9cb68fe.tar.gz
cgeo-ff836c41e90deeb735f5b7b9c9e88872b9cb68fe.tar.bz2
Update Robotium library
Also, reenable the test. It will be disabled again if it does not work reliably on the continuous integration server.
-rw-r--r--tests/libs/docs/robotium-solo-3.6-javadoc.jarbin42583 -> 0 bytes
-rw-r--r--tests/libs/docs/robotium-solo-5.1-javadoc.jarbin0 -> 82789 bytes
-rw-r--r--tests/libs/robotium-solo-3.6.jarbin59067 -> 0 bytes
-rw-r--r--tests/libs/robotium-solo-3.6.jar.properties1
-rw-r--r--tests/libs/robotium-solo-5.1.jarbin0 -> 112036 bytes
-rw-r--r--tests/libs/robotium-solo-5.1.jar.properties1
-rw-r--r--tests/src/cgeo/geocaching/files/SimpleDirChooserUITest.java33
7 files changed, 20 insertions, 15 deletions
diff --git a/tests/libs/docs/robotium-solo-3.6-javadoc.jar b/tests/libs/docs/robotium-solo-3.6-javadoc.jar
deleted file mode 100644
index db4e75b..0000000
--- a/tests/libs/docs/robotium-solo-3.6-javadoc.jar
+++ /dev/null
Binary files differ
diff --git a/tests/libs/docs/robotium-solo-5.1-javadoc.jar b/tests/libs/docs/robotium-solo-5.1-javadoc.jar
new file mode 100644
index 0000000..92ebff2
--- /dev/null
+++ b/tests/libs/docs/robotium-solo-5.1-javadoc.jar
Binary files differ
diff --git a/tests/libs/robotium-solo-3.6.jar b/tests/libs/robotium-solo-3.6.jar
deleted file mode 100644
index 4280906..0000000
--- a/tests/libs/robotium-solo-3.6.jar
+++ /dev/null
Binary files differ
diff --git a/tests/libs/robotium-solo-3.6.jar.properties b/tests/libs/robotium-solo-3.6.jar.properties
deleted file mode 100644
index 10e60fa..0000000
--- a/tests/libs/robotium-solo-3.6.jar.properties
+++ /dev/null
@@ -1 +0,0 @@
-doc=./docs/robotium-solo-3.6-javadoc.jar \ No newline at end of file
diff --git a/tests/libs/robotium-solo-5.1.jar b/tests/libs/robotium-solo-5.1.jar
new file mode 100644
index 0000000..1931dd9
--- /dev/null
+++ b/tests/libs/robotium-solo-5.1.jar
Binary files differ
diff --git a/tests/libs/robotium-solo-5.1.jar.properties b/tests/libs/robotium-solo-5.1.jar.properties
new file mode 100644
index 0000000..9df11e1
--- /dev/null
+++ b/tests/libs/robotium-solo-5.1.jar.properties
@@ -0,0 +1 @@
+doc=./docs/robotium-solo-5.1-javadoc.jar \ No newline at end of file
diff --git a/tests/src/cgeo/geocaching/files/SimpleDirChooserUITest.java b/tests/src/cgeo/geocaching/files/SimpleDirChooserUITest.java
index 05b4ee1..985733a 100644
--- a/tests/src/cgeo/geocaching/files/SimpleDirChooserUITest.java
+++ b/tests/src/cgeo/geocaching/files/SimpleDirChooserUITest.java
@@ -1,18 +1,18 @@
package cgeo.geocaching.files;
-import com.jayway.android.robotium.solo.Solo;
+import cgeo.geocaching.Intents;
+
+import com.robotium.solo.Solo;
import android.annotation.TargetApi;
+import android.content.Intent;
import android.os.Build;
import android.test.ActivityInstrumentationTestCase2;
-import android.test.suitebuilder.annotation.Suppress;
import android.widget.CheckBox;
import java.util.ArrayList;
@TargetApi(Build.VERSION_CODES.FROYO)
-@Suppress()
-/* This test breaks the continuous integration server, do not run it for now. */
public class SimpleDirChooserUITest extends ActivityInstrumentationTestCase2<SimpleDirChooser> {
private Solo solo;
@@ -24,9 +24,14 @@ public class SimpleDirChooserUITest extends ActivityInstrumentationTestCase2<Sim
@Override
public void setUp() throws Exception {
super.setUp();
+ setActivityIntent(new Intent().putExtra(Intents.EXTRA_START_DIR, "").putExtra(SimpleDirChooser.EXTRA_CHOOSE_FOR_WRITING, false));
solo = new Solo(getInstrumentation(), getActivity());
}
+ public ArrayList<CheckBox> getCurrentCheckBoxes() {
+ return solo.getCurrentViews(CheckBox.class);
+ }
+
public void testSingleSelection() throws InterruptedException {
// normally our activity should be ready, but we already had Jenkins report no checkboxes right here at the beginning
solo.waitForActivity(solo.getCurrentActivity().getClass().getSimpleName(), 2000);
@@ -37,11 +42,11 @@ public class SimpleDirChooserUITest extends ActivityInstrumentationTestCase2<Sim
// according to the documentation, automatic pauses only happen in the clickXYZ() methods.
// Therefore lets introduce a manual pause after the scrolling methods.
- final int lastIndex = solo.getCurrentCheckBoxes().size() - 1;
+ final int lastIndex = getCurrentCheckBoxes().size() - 1;
solo.clickOnCheckBox(lastIndex);
- assertTrue(solo.getCurrentCheckBoxes().get(lastIndex).isChecked());
- assertFalse(solo.getCurrentCheckBoxes().get(0).isChecked());
+ assertTrue(solo.isCheckBoxChecked(lastIndex));
+ assertFalse(solo.isCheckBoxChecked(0));
assertChecked("Clicked last checkbox", 1);
solo.scrollUp();
@@ -54,23 +59,23 @@ public class SimpleDirChooserUITest extends ActivityInstrumentationTestCase2<Sim
pause();
solo.clickOnCheckBox(0);
assertChecked("Clicked first checkbox", 1);
- assertTrue(solo.getCurrentCheckBoxes().get(0).isChecked());
+ assertTrue(solo.isCheckBoxChecked(0));
solo.clickOnCheckBox(1);
assertChecked("Clicked second checkbox", 1);
- assertTrue(solo.getCurrentCheckBoxes().get(1).isChecked());
+ assertTrue(solo.isCheckBoxChecked(1));
}
private static void pause() throws InterruptedException {
- Thread.sleep(500);
+ Thread.sleep(100);
}
private void assertChecked(String message, int expectedChecked) {
- int checked = 0;
- final ArrayList<CheckBox> boxes = solo.getCurrentCheckBoxes();
+ final ArrayList<CheckBox> boxes = getCurrentCheckBoxes();
assertNotNull("Could not get checkboxes", boxes);
assertTrue("There are no checkboxes", boxes.size() > 1);
- for (CheckBox checkBox : boxes) {
- if (checkBox.isChecked()) {
+ int checked = 0;
+ for (int i = 0; i < boxes.size(); i++) {
+ if (solo.isCheckBoxChecked(i)) {
checked++;
}
}