From a4d3d69a8e701158c19bcfaef1ffdc359e0c26cc Mon Sep 17 00:00:00 2001 From: simonpoole Date: Sat, 14 Oct 2023 14:10:16 +0200 Subject: [PATCH] Add support for uploading GPX waypointd Fixes https://github.com/MarcusWolschon/osmeditor4android/issues/2415 --- .../de/blau/android/gpx/GpxUploadTest.java | 22 +++++++++++++++++++ src/main/java/de/blau/android/gpx/Track.java | 7 ++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/androidTest/java/de/blau/android/gpx/GpxUploadTest.java b/src/androidTest/java/de/blau/android/gpx/GpxUploadTest.java index 17a16056f2..ec79963f4e 100644 --- a/src/androidTest/java/de/blau/android/gpx/GpxUploadTest.java +++ b/src/androidTest/java/de/blau/android/gpx/GpxUploadTest.java @@ -1,9 +1,11 @@ package de.blau.android.gpx; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; @@ -137,10 +139,30 @@ public void uploadGpx() { assertTrue(TestUtils.clickText(device, false, main.getString(R.string.Done), true, false)); UiObject2 menuButton = TestUtils.getLayerButton(device, GPX_FILE, LayerDialogTest.MENU_BUTTON); menuButton.click(); + assertTrue(TestUtils.clickText(device, false, main.getString(R.string.menu_information), true, false)); + assertTrue(TestUtils.findText(device, false, "112", 500, true)); + assertTrue(TestUtils.findText(device, false, "79", 500, true)); + assertTrue(TestUtils.clickText(device, false, main.getString(R.string.Done), true, false)); + assertTrue(TestUtils.clickText(device, false, main.getString(R.string.Done), true, false)); + menuButton = TestUtils.getLayerButton(device, GPX_FILE, LayerDialogTest.MENU_BUTTON); + menuButton.click(); assertTrue(TestUtils.clickText(device, false, main.getString(R.string.menu_gps_upload), true, false)); + mockServer.enqueue("userdetails"); mockServer.enqueue("200"); assertTrue(TestUtils.clickResource(device, false, "android:id/button1", true)); assertTrue(TestUtils.textGone(device, "Uploading", 5000)); + + try { + mockServer.takeRequest(); + String upload = mockServer.takeRequest().getUtf8Body(); + int gpxStart = upload.indexOf("