aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/src/cgeo/geocaching/GpxFileListActivityTest.java87
1 files changed, 54 insertions, 33 deletions
diff --git a/tests/src/cgeo/geocaching/GpxFileListActivityTest.java b/tests/src/cgeo/geocaching/GpxFileListActivityTest.java
index a7605d6..2923bfc 100644
--- a/tests/src/cgeo/geocaching/GpxFileListActivityTest.java
+++ b/tests/src/cgeo/geocaching/GpxFileListActivityTest.java
@@ -11,39 +11,60 @@ public class GpxFileListActivityTest extends ActivityInstrumentationTestCase2<Gp
super(GpxFileListActivity.class);
}
- public void testFileNameMatches() {
- assertTrue(importGpxActivity.filenameBelongsToList("1234567.gpx"));
- assertTrue(importGpxActivity.filenameBelongsToList("1234567.GPX"));
- assertTrue(importGpxActivity.filenameBelongsToList(".gpx"));
- assertTrue(importGpxActivity.filenameBelongsToList("1234567.loc"));
- assertTrue(importGpxActivity.filenameBelongsToList("1234567.LOC"));
- assertTrue(importGpxActivity.filenameBelongsToList("1234567.zip"));
- assertTrue(importGpxActivity.filenameBelongsToList("1234567.ZIP"));
- assertTrue(importGpxActivity.filenameBelongsToList("12345678.zip"));
- assertTrue(importGpxActivity.filenameBelongsToList("1234567_query.zip"));
- assertTrue(importGpxActivity.filenameBelongsToList("12345678_query.zip"));
- assertTrue(importGpxActivity.filenameBelongsToList("12345678_my_query_1.zip"));
- assertTrue(importGpxActivity.filenameBelongsToList("12345678_my query.zip"));
- assertTrue(importGpxActivity.filenameBelongsToList("ocde12345.zip"));
- assertTrue(importGpxActivity.filenameBelongsToList("ocde12345678.zip"));
-
- assertFalse(importGpxActivity.filenameBelongsToList("1234567.gpy"));
- assertFalse(importGpxActivity.filenameBelongsToList("1234567.agpx"));
- assertFalse(importGpxActivity.filenameBelongsToList("1234567"));
- assertFalse(importGpxActivity.filenameBelongsToList(""));
- assertFalse(importGpxActivity.filenameBelongsToList("gpx"));
- assertFalse(importGpxActivity.filenameBelongsToList("test.zip"));
- assertFalse(importGpxActivity.filenameBelongsToList("zip"));
- assertFalse(importGpxActivity.filenameBelongsToList(".zip"));
- assertFalse(importGpxActivity.filenameBelongsToList("123456.zip"));
- assertFalse(importGpxActivity.filenameBelongsToList("1234567query.zip"));
- assertFalse(importGpxActivity.filenameBelongsToList("1234567_.zip"));
- assertFalse(importGpxActivity.filenameBelongsToList("ocde_12345678.zip"));
- assertFalse(importGpxActivity.filenameBelongsToList("acde12345678.zip"));
-
- assertFalse(importGpxActivity.filenameBelongsToList("1234567-wpts.gpx"));
- assertFalse(importGpxActivity.filenameBelongsToList("1234567-wpts-1.gpx"));
- assertFalse(importGpxActivity.filenameBelongsToList("1234567-wpts(1).gpx"));
+ public void testPocketQueryCreator() {
+ assertImport("pocketquery_name.zip");
+ assertImport("pocketquery_รค.1. .zip");
+ assertImport("pocketquery_name.ZIP");
+ assertImport("pocketquery_name.gpx");
}
+ public void testDifferentFileTypes() {
+ assertImport("1234567.gpx");
+ assertImport("1234567.GPX");
+ assertImport(".gpx");
+ assertImport("1234567.loc");
+ assertImport("1234567.LOC");
+ assertImport("1234567.zip");
+ assertImport("1234567.ZIP");
+ }
+
+ public void testPocketQueries() {
+ assertImport("12345678.zip");
+ assertImport("1234567_query.zip");
+ assertImport("12345678_query.zip");
+ assertImport("12345678_my_query_1.zip");
+ assertImport("12345678_my query.zip");
+
+ denyImport("1234567.gpy");
+ denyImport("1234567.agpx");
+ denyImport("1234567");
+ denyImport("");
+ denyImport("gpx");
+ denyImport("test.zip");
+ denyImport("zip");
+ denyImport(".zip");
+ denyImport("123456.zip");
+ denyImport("1234567query.zip");
+ denyImport("1234567_.zip");
+
+ denyImport("1234567-wpts.gpx");
+ denyImport("1234567-wpts-1.gpx");
+ denyImport("1234567-wpts(1).gpx");
+ }
+
+ public void testOpenCachingExports() {
+ assertImport("ocde12345.zip");
+ assertImport("ocde12345678.zip");
+
+ denyImport("ocde_12345678.zip");
+ denyImport("acde12345678.zip");
+ }
+
+ private void assertImport(String fileName) {
+ assertTrue(importGpxActivity.filenameBelongsToList(fileName));
+ }
+
+ private void denyImport(String fileName) {
+ assertFalse(importGpxActivity.filenameBelongsToList(fileName));
+ }
}