summaryrefslogtreecommitdiff
path: root/app/src/androidTest
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/androidTest')
-rw-r--r--app/src/androidTest/java/de/test/antennapod/handler/FeedHandlerTest.java3
-rw-r--r--app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java92
-rw-r--r--app/src/androidTest/java/de/test/antennapod/storage/DBTestUtils.java3
-rw-r--r--app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java158
-rw-r--r--app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java11
-rw-r--r--app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java40
-rw-r--r--app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java2
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java35
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/RewindAfterPauseUtilTest.java51
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/URIUtilTest.java22
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java89
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/service/download/NanoHTTPD.java1
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java5
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java1
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java7
15 files changed, 345 insertions, 175 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/handler/FeedHandlerTest.java b/app/src/androidTest/java/de/test/antennapod/handler/FeedHandlerTest.java
index 6908e2ec7..9419d2318 100644
--- a/app/src/androidTest/java/de/test/antennapod/handler/FeedHandlerTest.java
+++ b/app/src/androidTest/java/de/test/antennapod/handler/FeedHandlerTest.java
@@ -1,6 +1,7 @@
package de.test.antennapod.handler;
import android.content.Context;
+import android.support.test.InstrumentationRegistry;
import android.test.InstrumentationTestCase;
import org.xml.sax.SAXException;
@@ -36,7 +37,7 @@ public class FeedHandlerTest extends InstrumentationTestCase {
protected void setUp() throws Exception {
super.setUp();
- Context context = getInstrumentation().getContext();
+ Context context = InstrumentationRegistry.getTargetContext();
File destDir = context.getExternalFilesDir(FEEDS_DIR);
assertNotNull(destDir);
diff --git a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java
index 8be57a074..c8222b376 100644
--- a/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java
+++ b/app/src/androidTest/java/de/test/antennapod/service/playback/PlaybackServiceTaskManagerTest.java
@@ -1,6 +1,9 @@
package de.test.antennapod.service.playback;
import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.annotation.UiThreadTest;
+import android.support.test.runner.AndroidJUnit4;
import android.test.InstrumentationTestCase;
import java.util.ArrayList;
@@ -16,38 +19,47 @@ import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager;
import de.danoeh.antennapod.core.storage.PodDBAdapter;
import de.danoeh.antennapod.core.util.playback.Playable;
-import de.greenrobot.event.EventBus;
+import org.greenrobot.eventbus.EventBus;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* Test class for PlaybackServiceTaskManager
*/
-public class PlaybackServiceTaskManagerTest extends InstrumentationTestCase {
+@RunWith(AndroidJUnit4.class)
+public class PlaybackServiceTaskManagerTest {
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
+ @After
+ public void tearDown() {
PodDBAdapter.deleteDatabase();
}
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
+ @Before
+ public void setUp() {
// create new database
- PodDBAdapter.init(getInstrumentation().getTargetContext());
+ Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
+ PodDBAdapter.init(context);
PodDBAdapter.deleteDatabase();
PodDBAdapter adapter = PodDBAdapter.getInstance();
adapter.open();
adapter.close();
}
+ @Test
public void testInit() {
- PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(getInstrumentation().getTargetContext(), defaultPSTM);
+ Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
+ PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(context, defaultPSTM);
pstm.shutdown();
}
private List<FeedItem> writeTestQueue(String pref) {
- final Context c = getInstrumentation().getTargetContext();
final int NUM_ITEMS = 10;
Feed f = new Feed(0, null, "title", "link", "d", null, null, null, null, "id", null, "null", "url", false);
f.setItems(new ArrayList<>());
@@ -66,8 +78,9 @@ public class PlaybackServiceTaskManagerTest extends InstrumentationTestCase {
return f.getItems();
}
+ @Test
public void testGetQueueWriteBeforeCreation() throws InterruptedException {
- final Context c = getInstrumentation().getTargetContext();
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
List<FeedItem> queue = writeTestQueue("a");
assertNotNull(queue);
PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
@@ -80,8 +93,9 @@ public class PlaybackServiceTaskManagerTest extends InstrumentationTestCase {
pstm.shutdown();
}
+ @Test
public void testGetQueueWriteAfterCreation() throws InterruptedException {
- final Context c = getInstrumentation().getTargetContext();
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
List<FeedItem> testQueue = pstm.getQueue();
@@ -111,8 +125,9 @@ public class PlaybackServiceTaskManagerTest extends InstrumentationTestCase {
pstm.shutdown();
}
+ @Test
public void testStartPositionSaver() throws InterruptedException {
- final Context c = getInstrumentation().getTargetContext();
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
final int NUM_COUNTDOWNS = 2;
final int TIMEOUT = 3 * PlaybackServiceTaskManager.POSITION_SAVER_WAITING_INTERVAL;
final CountDownLatch countDownLatch = new CountDownLatch(NUM_COUNTDOWNS);
@@ -152,16 +167,18 @@ public class PlaybackServiceTaskManagerTest extends InstrumentationTestCase {
pstm.shutdown();
}
+ @Test
public void testIsPositionSaverActive() {
- final Context c = getInstrumentation().getTargetContext();
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
pstm.startPositionSaver();
assertTrue(pstm.isPositionSaverActive());
pstm.shutdown();
}
+ @Test
public void testCancelPositionSaver() {
- final Context c = getInstrumentation().getTargetContext();
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
pstm.startPositionSaver();
pstm.cancelPositionSaver();
@@ -169,8 +186,9 @@ public class PlaybackServiceTaskManagerTest extends InstrumentationTestCase {
pstm.shutdown();
}
+ @Test
public void testStartWidgetUpdater() throws InterruptedException {
- final Context c = getInstrumentation().getTargetContext();
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
final int NUM_COUNTDOWNS = 2;
final int TIMEOUT = 3 * PlaybackServiceTaskManager.WIDGET_UPDATER_NOTIFICATION_INTERVAL;
final CountDownLatch countDownLatch = new CountDownLatch(NUM_COUNTDOWNS);
@@ -210,16 +228,27 @@ public class PlaybackServiceTaskManagerTest extends InstrumentationTestCase {
pstm.shutdown();
}
+ @Test
+ public void testStartWidgetUpdaterAfterShutdown() {
+ // Should not throw.
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
+ PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
+ pstm.shutdown();
+ pstm.startWidgetUpdater();
+ }
+
+ @Test
public void testIsWidgetUpdaterActive() {
- final Context c = getInstrumentation().getTargetContext();
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
pstm.startWidgetUpdater();
assertTrue(pstm.isWidgetUpdaterActive());
pstm.shutdown();
}
+ @Test
public void testCancelWidgetUpdater() {
- final Context c = getInstrumentation().getTargetContext();
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
pstm.startWidgetUpdater();
pstm.cancelWidgetUpdater();
@@ -227,8 +256,9 @@ public class PlaybackServiceTaskManagerTest extends InstrumentationTestCase {
pstm.shutdown();
}
+ @Test
public void testCancelAllTasksNoTasksStarted() {
- final Context c = getInstrumentation().getTargetContext();
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
pstm.cancelAllTasks();
assertFalse(pstm.isPositionSaverActive());
@@ -237,8 +267,10 @@ public class PlaybackServiceTaskManagerTest extends InstrumentationTestCase {
pstm.shutdown();
}
+ @Test
+ @UiThreadTest
public void testCancelAllTasksAllTasksStarted() {
- final Context c = getInstrumentation().getTargetContext();
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
pstm.startWidgetUpdater();
pstm.startPositionSaver();
@@ -250,8 +282,10 @@ public class PlaybackServiceTaskManagerTest extends InstrumentationTestCase {
pstm.shutdown();
}
+ @Test
+ @UiThreadTest
public void testSetSleepTimer() throws InterruptedException {
- final Context c = getInstrumentation().getTargetContext();
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
final long TIME = 2000;
final long TIMEOUT = 2 * TIME;
final CountDownLatch countDownLatch = new CountDownLatch(1);
@@ -294,8 +328,10 @@ public class PlaybackServiceTaskManagerTest extends InstrumentationTestCase {
pstm.shutdown();
}
+ @Test
+ @UiThreadTest
public void testDisableSleepTimer() throws InterruptedException {
- final Context c = getInstrumentation().getTargetContext();
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
final long TIME = 1000;
final long TIMEOUT = 2 * TIME;
final CountDownLatch countDownLatch = new CountDownLatch(1);
@@ -336,16 +372,20 @@ public class PlaybackServiceTaskManagerTest extends InstrumentationTestCase {
pstm.shutdown();
}
+ @Test
+ @UiThreadTest
public void testIsSleepTimerActivePositive() {
- final Context c = getInstrumentation().getTargetContext();
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
pstm.setSleepTimer(10000, false, false);
assertTrue(pstm.isSleepTimerActive());
pstm.shutdown();
}
+ @Test
+ @UiThreadTest
public void testIsSleepTimerActiveNegative() {
- final Context c = getInstrumentation().getTargetContext();
+ final Context c = InstrumentationRegistry.getInstrumentation().getTargetContext();
PlaybackServiceTaskManager pstm = new PlaybackServiceTaskManager(c, defaultPSTM);
pstm.setSleepTimer(10000, false, false);
pstm.disableSleepTimer();
diff --git a/app/src/androidTest/java/de/test/antennapod/storage/DBTestUtils.java b/app/src/androidTest/java/de/test/antennapod/storage/DBTestUtils.java
index a577e5e36..f58008172 100644
--- a/app/src/androidTest/java/de/test/antennapod/storage/DBTestUtils.java
+++ b/app/src/androidTest/java/de/test/antennapod/storage/DBTestUtils.java
@@ -14,7 +14,6 @@ import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.core.feed.SimpleChapter;
import de.danoeh.antennapod.core.storage.PodDBAdapter;
import de.danoeh.antennapod.core.util.comparator.FeedItemPubdateComparator;
-import de.danoeh.antennapod.core.util.flattr.FlattrStatus;
/**
* Utility methods for DB* tests.
@@ -46,7 +45,7 @@ class DBTestUtils {
adapter.open();
for (int i = 0; i < numFeeds; i++) {
Feed f = new Feed(0, null, "feed " + i, null, "link" + i, "descr", null, null,
- null, null, "id" + i, null, null, "url" + i, false, new FlattrStatus(), false, null, null, false);
+ null, null, "id" + i, null, null, "url" + i, false, false, null, null, false);
f.setItems(new ArrayList<>());
for (int j = 0; j < numItems; j++) {
FeedItem item = new FeedItem(0, "item " + j, "id" + j, "link" + j, new Date(),
diff --git a/app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java b/app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java
index 427cc8ddd..27d76116d 100644
--- a/app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java
+++ b/app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java
@@ -1,10 +1,14 @@
package de.test.antennapod.storage;
import android.content.Context;
+import android.content.SharedPreferences;
import android.database.Cursor;
+import android.preference.PreferenceManager;
import android.test.InstrumentationTestCase;
import android.util.Log;
+import org.awaitility.Awaitility;
+
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -18,9 +22,11 @@ import java.util.concurrent.TimeoutException;
import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.core.feed.FeedMedia;
+import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter;
import de.danoeh.antennapod.core.storage.PodDBAdapter;
+import de.danoeh.antennapod.core.util.Consumer;
/**
* Test class for DBWriter
@@ -55,6 +61,12 @@ public class DBWriterTest extends InstrumentationTestCase {
PodDBAdapter adapter = PodDBAdapter.getInstance();
adapter.open();
adapter.close();
+
+ Context context = getInstrumentation().getTargetContext();
+ SharedPreferences.Editor prefEdit = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()).edit();
+ prefEdit.putBoolean(UserPreferences.PREF_DELETE_REMOVES_FROM_QUEUE, true).commit();
+
+ UserPreferences.init(context);
}
public void testSetFeedMediaPlaybackInformation()
@@ -121,6 +133,47 @@ public class DBWriterTest extends InstrumentationTestCase {
assertNull(media.getFile_url());
}
+ public void testDeleteFeedMediaOfItemRemoveFromQueue()
+ throws IOException, ExecutionException, InterruptedException, TimeoutException {
+ assertTrue(UserPreferences.shouldDeleteRemoveFromQueue());
+
+ File dest = new File(getInstrumentation().getTargetContext().getExternalFilesDir(TEST_FOLDER), "testFile");
+
+ assertTrue(dest.createNewFile());
+
+ Feed feed = new Feed("url", null, "title");
+ List<FeedItem> items = new ArrayList<>();
+ List<FeedItem> queue = new ArrayList<>();
+ feed.setItems(items);
+ FeedItem item = new FeedItem(0, "Item", "Item", "url", new Date(), FeedItem.UNPLAYED, feed);
+
+ FeedMedia media = new FeedMedia(0, item, 1, 1, 1, "mime_type", dest.getAbsolutePath(), "download_url", true, null, 0, 0);
+ item.setMedia(media);
+
+ items.add(item);
+ queue.add(item);
+
+ PodDBAdapter adapter = PodDBAdapter.getInstance();
+ adapter.open();
+ adapter.setCompleteFeed(feed);
+ adapter.setQueue(queue);
+ adapter.close();
+ assertTrue(media.getId() != 0);
+ assertTrue(item.getId() != 0);
+ queue = DBReader.getQueue();
+ assertTrue(queue.size() != 0);
+
+ DBWriter.deleteFeedMediaOfItem(getInstrumentation().getTargetContext(), media.getId());
+ Awaitility.await().until(() -> dest.exists() == false);
+ media = DBReader.getFeedMedia(media.getId());
+ assertNotNull(media);
+ assertFalse(dest.exists());
+ assertFalse(media.isDownloaded());
+ assertNull(media.getFile_url());
+ queue = DBReader.getQueue();
+ assertTrue(queue.size() == 0);
+ }
+
public void testDeleteFeed() throws ExecutionException, InterruptedException, IOException, TimeoutException {
File destFolder = getInstrumentation().getTargetContext().getExternalFilesDir(TEST_FOLDER);
assertNotNull(destFolder);
@@ -522,29 +575,16 @@ public class DBWriterTest extends InstrumentationTestCase {
public void testRemoveQueueItem() throws InterruptedException, ExecutionException, TimeoutException {
final int NUM_ITEMS = 10;
final Context context = getInstrumentation().getTargetContext();
- Feed feed = new Feed("url", null, "title");
- feed.setItems(new ArrayList<>());
- for (int i = 0; i < NUM_ITEMS; i++) {
- FeedItem item = new FeedItem(0, "title " + i, "id " + i, "link " + i, new Date(), FeedItem.PLAYED, feed);
- feed.getItems().add(item);
- }
+ Feed feed = createTestFeed(NUM_ITEMS);
- PodDBAdapter adapter = PodDBAdapter.getInstance();
- adapter.open();
- adapter.setCompleteFeed(feed);
- adapter.close();
-
- for (FeedItem item : feed.getItems()) {
- assertTrue(item.getId() != 0);
- }
for (int removeIndex = 0; removeIndex < NUM_ITEMS; removeIndex++) {
final FeedItem item = feed.getItems().get(removeIndex);
- adapter = PodDBAdapter.getInstance();
+ PodDBAdapter adapter = PodDBAdapter.getInstance();
adapter.open();
adapter.setQueue(feed.getItems());
adapter.close();
- DBWriter.removeQueueItem(context, item, false).get(TIMEOUT, TimeUnit.SECONDS);
+ DBWriter.removeQueueItem(context, false, item).get(TIMEOUT, TimeUnit.SECONDS);
adapter = PodDBAdapter.getInstance();
adapter.open();
Cursor queue = adapter.getQueueIDCursor();
@@ -564,6 +604,43 @@ public class DBWriterTest extends InstrumentationTestCase {
}
}
+ public void testRemoveQueueItemMultipleItems() throws InterruptedException, ExecutionException, TimeoutException {
+ // Setup test data
+ //
+ final int NUM_ITEMS = 5;
+ final int NUM_IN_QUEUE = NUM_ITEMS - 1; // the last one not in queue for boundary condition
+ final Context context = getInstrumentation().getTargetContext();
+ Feed feed = createTestFeed(NUM_ITEMS);
+
+ List<FeedItem> itemsToAdd = feed.getItems().subList(0, NUM_IN_QUEUE);
+ withPodDB(adapter -> adapter.setQueue(itemsToAdd) );
+
+ // Actual tests
+ //
+
+ // Use array rather than List to make codes more succinct
+ Long[] itemIds = toItemIds(feed.getItems()).toArray(new Long[0]);
+
+ DBWriter.removeQueueItem(context, false,
+ itemIds[1], itemIds[3]).get(TIMEOUT, TimeUnit.SECONDS);
+ assertQueueByItemIds("Average case - 2 items removed successfully",
+ itemIds[0], itemIds[2]);
+
+ DBWriter.removeQueueItem(context, false).get(TIMEOUT, TimeUnit.SECONDS);
+ assertQueueByItemIds("Boundary case - no items supplied. queue should see no change",
+ itemIds[0], itemIds[2]);
+
+ DBWriter.removeQueueItem(context, false,
+ itemIds[0], itemIds[4], -1L).get(TIMEOUT, TimeUnit.SECONDS);
+ assertQueueByItemIds("Boundary case - items not in queue ignored",
+ itemIds[2]);
+
+ DBWriter.removeQueueItem(context, false,
+ itemIds[2], -1L).get(TIMEOUT, TimeUnit.SECONDS);
+ assertQueueByItemIds("Boundary case - invalid itemIds ignored"); // the queue is empty
+
+ }
+
public void testMoveQueueItem() throws InterruptedException, ExecutionException, TimeoutException {
final int NUM_ITEMS = 10;
Feed feed = new Feed("url", null, "title");
@@ -661,4 +738,53 @@ public class DBWriterTest extends InstrumentationTestCase {
assertTrue(item.isPlayed());
}
}
+
+ private static Feed createTestFeed(int numItems) {
+ Feed feed = new Feed("url", null, "title");
+ feed.setItems(new ArrayList<>());
+ for (int i = 0; i < numItems; i++) {
+ FeedItem item = new FeedItem(0, "title " + i, "id " + i, "link " + i, new Date(), FeedItem.PLAYED, feed);
+ feed.getItems().add(item);
+ }
+
+ withPodDB(adapter -> adapter.setCompleteFeed(feed));
+
+ for (FeedItem item : feed.getItems()) {
+ assertTrue(item.getId() != 0);
+ }
+ return feed;
+ }
+
+ private static void withPodDB(Consumer<PodDBAdapter> action) {
+ PodDBAdapter adapter = PodDBAdapter.getInstance();
+ try {
+ adapter.open();
+ action.accept(adapter);
+ } finally {
+ adapter.close();
+ }
+ }
+
+ private static void assertQueueByItemIds(
+ String message,
+ long... itemIdsExpected
+ ) {
+ List<FeedItem> queue = DBReader.getQueue();
+ List<Long> itemIdsActualList = toItemIds(queue);
+ List<Long> itemIdsExpectedList = new ArrayList<Long>(itemIdsExpected.length);
+ for (long id : itemIdsExpected) {
+ itemIdsExpectedList.add(id);
+ }
+
+ assertEquals(message, itemIdsExpectedList, itemIdsActualList);
+ }
+
+ private static List<Long> toItemIds(List<FeedItem> items) {
+ List<Long> itemIds = new ArrayList<Long>(items.size());
+ for(FeedItem item : items) {
+ itemIds.add(item.getId());
+ }
+ return itemIds;
+ }
+
}
diff --git a/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java b/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java
index 9a60b04b8..8e0064079 100644
--- a/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java
+++ b/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java
@@ -7,6 +7,7 @@ import android.support.test.espresso.intent.Intents;
import android.support.test.filters.FlakyTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
+import android.view.Gravity;
import android.widget.ListView;
import com.robotium.solo.Solo;
import com.robotium.solo.Timeout;
@@ -17,6 +18,7 @@ import de.danoeh.antennapod.activity.PreferenceActivity;
import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.core.storage.PodDBAdapter;
+import de.danoeh.antennapod.dialog.RatingDialog;
import de.danoeh.antennapod.fragment.DownloadsFragment;
import de.danoeh.antennapod.fragment.EpisodesFragment;
import de.danoeh.antennapod.fragment.PlaybackHistoryFragment;
@@ -36,6 +38,8 @@ import static android.support.test.InstrumentationRegistry.getInstrumentation;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.longClick;
+import static android.support.test.espresso.assertion.ViewAssertions.matches;
+import static android.support.test.espresso.contrib.DrawerMatchers.isClosed;
import static android.support.test.espresso.intent.Intents.intended;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
@@ -76,6 +80,9 @@ public class MainActivityTest {
prefs = context.getSharedPreferences(MainActivity.PREF_NAME, Context.MODE_PRIVATE);
prefs.edit().putBoolean(MainActivity.PREF_IS_FIRST_LAUNCH, false).commit();
+ RatingDialog.init(context);
+ RatingDialog.saveRated();
+
solo = new Solo(getInstrumentation(), mActivityRule.getActivity());
}
@@ -89,7 +96,9 @@ public class MainActivityTest {
}
private void openNavDrawer() {
- onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
+ onView(withId(R.id.drawer_layout))
+ .check(matches(isClosed(Gravity.LEFT)))
+ .perform(DrawerActions.open());
}
@Test
diff --git a/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java b/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java
index f217ecffa..d934bf3e2 100644
--- a/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java
+++ b/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java
@@ -7,18 +7,9 @@ import android.support.test.espresso.contrib.RecyclerViewActions;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.view.View;
+
import com.robotium.solo.Solo;
import com.robotium.solo.Timeout;
-import de.danoeh.antennapod.R;
-import de.danoeh.antennapod.activity.PreferenceActivity;
-import de.danoeh.antennapod.core.preferences.UserPreferences;
-import de.danoeh.antennapod.core.storage.APCleanupAlgorithm;
-import de.danoeh.antennapod.core.storage.APNullCleanupAlgorithm;
-import de.danoeh.antennapod.core.storage.APQueueCleanupAlgorithm;
-import de.danoeh.antennapod.core.storage.EpisodeCleanupAlgorithm;
-import de.danoeh.antennapod.fragment.EpisodesFragment;
-import de.danoeh.antennapod.fragment.QueueFragment;
-import de.danoeh.antennapod.fragment.SubscriptionFragment;
import org.hamcrest.Matcher;
import org.junit.After;
@@ -30,6 +21,17 @@ import org.junit.runner.RunWith;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
+import de.danoeh.antennapod.R;
+import de.danoeh.antennapod.activity.PreferenceActivity;
+import de.danoeh.antennapod.core.preferences.UserPreferences;
+import de.danoeh.antennapod.core.storage.APCleanupAlgorithm;
+import de.danoeh.antennapod.core.storage.APNullCleanupAlgorithm;
+import de.danoeh.antennapod.core.storage.APQueueCleanupAlgorithm;
+import de.danoeh.antennapod.core.storage.EpisodeCleanupAlgorithm;
+import de.danoeh.antennapod.fragment.EpisodesFragment;
+import de.danoeh.antennapod.fragment.QueueFragment;
+import de.danoeh.antennapod.fragment.SubscriptionFragment;
+
import static android.support.test.InstrumentationRegistry.getInstrumentation;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
@@ -397,7 +399,7 @@ public class PreferencesTest {
EpisodeCleanupAlgorithm alg = UserPreferences.getEpisodeCleanupAlgorithm();
if (alg instanceof APCleanupAlgorithm) {
APCleanupAlgorithm cleanupAlg = (APCleanupAlgorithm)alg;
- return cleanupAlg.getNumberOfDaysAfterPlayback() == 0;
+ return cleanupAlg.getNumberOfHoursAfterPlayback() == 0;
}
return false;
},
@@ -416,7 +418,7 @@ public class PreferencesTest {
EpisodeCleanupAlgorithm alg = UserPreferences.getEpisodeCleanupAlgorithm();
if (alg instanceof APCleanupAlgorithm) {
APCleanupAlgorithm cleanupAlg = (APCleanupAlgorithm)alg;
- return cleanupAlg.getNumberOfDaysAfterPlayback() == 5;
+ return cleanupAlg.getNumberOfHoursAfterPlayback() == 120; // 5 days
}
return false;
},
@@ -505,6 +507,20 @@ public class PreferencesTest {
Timeout.getLargeTimeout()));
}
+ @Test
+ public void testDeleteRemovesFromQueue() {
+ clickPreference(withText(R.string.storage_pref));
+ if (!UserPreferences.shouldDeleteRemoveFromQueue()) {
+ clickPreference(withText(R.string.pref_delete_removes_from_queue_title));
+ assertTrue(solo.waitForCondition(UserPreferences::shouldDeleteRemoveFromQueue, Timeout.getLargeTimeout()));
+ }
+ final boolean deleteRemovesFromQueue = UserPreferences.shouldDeleteRemoveFromQueue();
+ solo.clickOnText(solo.getString(R.string.pref_delete_removes_from_queue_title));
+ assertTrue(solo.waitForCondition(() -> deleteRemovesFromQueue != UserPreferences.shouldDeleteRemoveFromQueue(), Timeout.getLargeTimeout()));
+ solo.clickOnText(solo.getString(R.string.pref_delete_removes_from_queue_title));
+ assertTrue(solo.waitForCondition(() -> deleteRemovesFromQueue == UserPreferences.shouldDeleteRemoveFromQueue(), Timeout.getLargeTimeout()));
+ }
+
private void clickPreference(Matcher<View> matcher) {
onView(withId(R.id.list))
.perform(RecyclerViewActions.actionOnItem(hasDescendant(matcher), click()));
diff --git a/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java b/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java
index ff5374268..263790c2f 100644
--- a/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java
+++ b/app/src/androidTest/java/de/test/antennapod/ui/UITestUtils.java
@@ -27,9 +27,9 @@ import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.core.storage.PodDBAdapter;
import de.danoeh.antennapod.core.util.playback.PlaybackController;
import de.danoeh.antennapod.fragment.ExternalPlayerFragment;
-import de.greenrobot.event.EventBus;
import de.test.antennapod.util.service.download.HTTPBin;
import de.test.antennapod.util.syndication.feedgenerator.RSS2Generator;
+import org.greenrobot.eventbus.EventBus;
/**
* Utility methods for UI tests.
diff --git a/app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java b/app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java
deleted file mode 100644
index 47fca41ba..000000000
--- a/app/src/androidTest/java/de/test/antennapod/util/ConverterTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package de.test.antennapod.util;
-
-import android.test.AndroidTestCase;
-
-import de.danoeh.antennapod.core.util.Converter;
-
-/**
- * Test class for converter
- */
-public class ConverterTest extends AndroidTestCase {
-
- public void testGetDurationStringLong() throws Exception {
- String expected = "13:05:10";
- int input = 47110000;
- assertEquals(expected, Converter.getDurationStringLong(input));
- }
-
- public void testGetDurationStringShort() throws Exception {
- String expected = "13:05";
- int input = 47110000;
- assertEquals(expected, Converter.getDurationStringShort(input));
- }
-
- public void testDurationStringLongToMs() throws Exception {
- String input = "01:20:30";
- long expected = 4830000;
- assertEquals(expected, Converter.durationStringLongToMs(input));
- }
-
- public void testDurationStringShortToMs() throws Exception {
- String input = "8:30";
- long expected = 30600000;
- assertEquals(expected, Converter.durationStringShortToMs(input));
- }
-}
diff --git a/app/src/androidTest/java/de/test/antennapod/util/RewindAfterPauseUtilTest.java b/app/src/androidTest/java/de/test/antennapod/util/RewindAfterPauseUtilTest.java
deleted file mode 100644
index d564d0492..000000000
--- a/app/src/androidTest/java/de/test/antennapod/util/RewindAfterPauseUtilTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package de.test.antennapod.util;
-
-import junit.framework.TestCase;
-
-import de.danoeh.antennapod.core.util.RewindAfterPauseUtils;
-
-/**
- * Tests for {@link RewindAfterPauseUtils}.
- */
-public class RewindAfterPauseUtilTest extends TestCase {
-
- public void testCalculatePositionWithRewindNoRewind() {
- final int ORIGINAL_POSITION = 10000;
- long lastPlayed = System.currentTimeMillis();
- int position = RewindAfterPauseUtils.calculatePositionWithRewind(ORIGINAL_POSITION, lastPlayed);
-
- assertEquals(ORIGINAL_POSITION, position);
- }
-
- public void testCalculatePositionWithRewindSmallRewind() {
- final int ORIGINAL_POSITION = 10000;
- long lastPlayed = System.currentTimeMillis() - RewindAfterPauseUtils.ELAPSED_TIME_FOR_SHORT_REWIND - 1000;
- int position = RewindAfterPauseUtils.calculatePositionWithRewind(ORIGINAL_POSITION, lastPlayed);
-
- assertEquals(ORIGINAL_POSITION - RewindAfterPauseUtils.SHORT_REWIND, position);
- }
-
- public void testCalculatePositionWithRewindMediumRewind() {
- final int ORIGINAL_POSITION = 10000;
- long lastPlayed = System.currentTimeMillis() - RewindAfterPauseUtils.ELAPSED_TIME_FOR_MEDIUM_REWIND - 1000;
- int position = RewindAfterPauseUtils.calculatePositionWithRewind(ORIGINAL_POSITION, lastPlayed);
-
- assertEquals(ORIGINAL_POSITION - RewindAfterPauseUtils.MEDIUM_REWIND, position);
- }
-
- public void testCalculatePositionWithRewindLongRewind() {
- final int ORIGINAL_POSITION = 30000;
- long lastPlayed = System.currentTimeMillis() - RewindAfterPauseUtils.ELAPSED_TIME_FOR_LONG_REWIND - 1000;
- int position = RewindAfterPauseUtils.calculatePositionWithRewind(ORIGINAL_POSITION, lastPlayed);
-
- assertEquals(ORIGINAL_POSITION - RewindAfterPauseUtils.LONG_REWIND, position);
- }
-
- public void testCalculatePositionWithRewindNegativeNumber() {
- final int ORIGINAL_POSITION = 100;
- long lastPlayed = System.currentTimeMillis() - RewindAfterPauseUtils.ELAPSED_TIME_FOR_LONG_REWIND - 1000;
- int position = RewindAfterPauseUtils.calculatePositionWithRewind(ORIGINAL_POSITION, lastPlayed);
-
- assertEquals(0, position);
- }
-}
diff --git a/app/src/androidTest/java/de/test/antennapod/util/URIUtilTest.java b/app/src/androidTest/java/de/test/antennapod/util/URIUtilTest.java
deleted file mode 100644
index 2cca6b4dc..000000000
--- a/app/src/androidTest/java/de/test/antennapod/util/URIUtilTest.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package de.test.antennapod.util;
-
-import android.test.AndroidTestCase;
-
-import de.danoeh.antennapod.core.util.URIUtil;
-
-/**
- * Test class for URIUtil
- */
-public class URIUtilTest extends AndroidTestCase {
-
- public void testGetURIFromRequestUrlShouldNotEncode() {
- final String testUrl = "http://example.com/this%20is%20encoded";
- assertEquals(testUrl, URIUtil.getURIFromRequestUrl(testUrl).toString());
- }
-
- public void testGetURIFromRequestUrlShouldEncode() {
- final String testUrl = "http://example.com/this is not encoded";
- final String expected = "http://example.com/this%20is%20not%20encoded";
- assertEquals(expected, URIUtil.getURIFromRequestUrl(testUrl).toString());
- }
-}
diff --git a/app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java b/app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java
index 7e535e12c..4bef14cd9 100644
--- a/app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java
+++ b/app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java
@@ -30,12 +30,12 @@ public class TimelineTest extends InstrumentationTestCase {
context = getInstrumentation().getTargetContext();
}
- private Playable newTestPlayable(List<Chapter> chapters, String shownotes) {
+ private Playable newTestPlayable(List<Chapter> chapters, String shownotes, int duration) {
FeedItem item = new FeedItem(0, "Item", "item-id", "http://example.com/item", new Date(), FeedItem.PLAYED, null);
item.setChapters(chapters);
item.setContentEncoded(shownotes);
FeedMedia media = new FeedMedia(item, "http://example.com/episode", 100, "audio/mp3");
- media.setDuration(Integer.MAX_VALUE);
+ media.setDuration(duration);
item.setMedia(media);
return media;
}
@@ -44,7 +44,17 @@ public class TimelineTest extends InstrumentationTestCase {
final String timeStr = "10:11:12";
final long time = 3600 * 1000 * 10 + 60 * 1000 * 11 + 12 * 1000;
- Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>");
+ Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>", Integer.MAX_VALUE);
+ Timeline t = new Timeline(context, p);
+ String res = t.processShownotes(true);
+ checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
+ }
+
+ public void testProcessShownotesAddTimecodeHHMMSSMoreThen24HoursNoChapters() throws Exception {
+ final String timeStr = "25:00:00";
+ final long time = 25 * 60 * 60 * 1000;
+
+ Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>", Integer.MAX_VALUE);
Timeline t = new Timeline(context, p);
String res = t.processShownotes(true);
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
@@ -54,17 +64,67 @@ public class TimelineTest extends InstrumentationTestCase {
final String timeStr = "10:11";
final long time = 3600 * 1000 * 10 + 60 * 1000 * 11;
- Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>");
+ Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>", Integer.MAX_VALUE);
+ Timeline t = new Timeline(context, p);
+ String res = t.processShownotes(true);
+ checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
+ }
+
+ public void testProcessShownotesAddTimecodeMMSSNoChapters() throws Exception {
+ final String timeStr = "10:11";
+ final long time = 10 * 60 * 1000 + 11 * 1000;
+
+ Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>", 11 * 60 * 1000);
Timeline t = new Timeline(context, p);
String res = t.processShownotes(true);
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
}
+ public void testProcessShownotesAddTimecodeHMMSSNoChapters() throws Exception {
+ final String timeStr = "2:11:12";
+ final long time = 2 * 60 * 60 * 1000 + 11 * 60 * 1000 + 12 * 1000;
+
+ Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>", Integer.MAX_VALUE);
+ Timeline t = new Timeline(context, p);
+ String res = t.processShownotes(true);
+ checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
+ }
+
+ public void testProcessShownotesAddTimecodeMSSNoChapters() throws Exception {
+ final String timeStr = "1:12";
+ final long time = 60 * 1000 + 12 * 1000;
+
+ Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>", 2 * 60 * 1000);
+ Timeline t = new Timeline(context, p);
+ String res = t.processShownotes(true);
+ checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
+ }
+
+ public void testProcessShownotesAddTimecodeMultipleFormatsNoChapters() throws Exception {
+ final String[] timeStrings = new String[]{ "10:12", "1:10:12" };
+
+ Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStrings[0] + " here. Hey look another one " + timeStrings[1] + " here!</p>", 2 * 60 * 60 * 1000);
+ Timeline t = new Timeline(context, p);
+ String res = t.processShownotes(true);
+ checkLinkCorrect(res, new long[]{ 10 * 60 * 1000 + 12 * 1000, 60 * 60 * 1000 + 10 * 60 * 1000 + 12 * 1000 }, timeStrings);
+ }
+
+ public void testProcessShownotesAddTimecodeMultipleShortFormatNoChapters() throws Exception {
+
+ // One of these timecodes fits as HH:MM and one does not so both should be parsed as MM:SS.
+ final String[] timeStrings = new String[]{ "10:12", "2:12" };
+
+ Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStrings[0] + " here. Hey look another one " + timeStrings[1] + " here!</p>", 3 * 60 * 60 * 1000);
+ Timeline t = new Timeline(context, p);
+ String res = t.processShownotes(true);
+ checkLinkCorrect(res, new long[]{ 10 * 60 * 1000 + 12 * 1000, 2 * 60 * 1000 + 12 * 1000 }, timeStrings);
+ }
+
public void testProcessShownotesAddTimecodeParentheses() throws Exception {
final String timeStr = "10:11";
final long time = 3600 * 1000 * 10 + 60 * 1000 * 11;
- Playable p = newTestPlayable(null, "<p> Some test text with a timecode (" + timeStr + ") here.</p>");
+ Playable p = newTestPlayable(null, "<p> Some test text with a timecode (" + timeStr + ") here.</p>", Integer.MAX_VALUE);
Timeline t = new Timeline(context, p);
String res = t.processShownotes(true);
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
@@ -74,7 +134,7 @@ public class TimelineTest extends InstrumentationTestCase {
final String timeStr = "10:11";
final long time = 3600 * 1000 * 10 + 60 * 1000 * 11;
- Playable p = newTestPlayable(null, "<p> Some test text with a timecode [" + timeStr + "] here.</p>");
+ Playable p = newTestPlayable(null, "<p> Some test text with a timecode [" + timeStr + "] here.</p>", Integer.MAX_VALUE);
Timeline t = new Timeline(context, p);
String res = t.processShownotes(true);
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
@@ -84,12 +144,27 @@ public class TimelineTest extends InstrumentationTestCase {
final String timeStr = "10:11";
final long time = 3600 * 1000 * 10 + 60 * 1000 * 11;
- Playable p = newTestPlayable(null, "<p> Some test text with a timecode <" + timeStr + "> here.</p>");
+ Playable p = newTestPlayable(null, "<p> Some test text with a timecode <" + timeStr + "> here.</p>", Integer.MAX_VALUE);
Timeline t = new Timeline(context, p);
String res = t.processShownotes(true);
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
}
+ public void testProcessShownotesAndInvalidTimecode() throws Exception {
+ final String[] timeStrs = new String[] {"2:1", "0:0", "000", "00", "00:000"};
+
+ StringBuilder shownotes = new StringBuilder("<p> Some test text with timecodes ");
+ for (String timeStr : timeStrs) {
+ shownotes.append(timeStr).append(" ");
+ }
+ shownotes.append("here.</p>");
+
+ Playable p = newTestPlayable(null, shownotes.toString(), Integer.MAX_VALUE);
+ Timeline t = new Timeline(context, p);
+ String res = t.processShownotes(true);
+ checkLinkCorrect(res, new long[0], new String[0]);
+ }
+
private void checkLinkCorrect(String res, long[] timecodes, String[] timecodeStr) {
assertNotNull(res);
Document d = Jsoup.parse(res);
diff --git a/app/src/androidTest/java/de/test/antennapod/util/service/download/NanoHTTPD.java b/app/src/androidTest/java/de/test/antennapod/util/service/download/NanoHTTPD.java
index 61ff65809..8d9cedbd1 100644
--- a/app/src/androidTest/java/de/test/antennapod/util/service/download/NanoHTTPD.java
+++ b/app/src/androidTest/java/de/test/antennapod/util/service/download/NanoHTTPD.java
@@ -776,6 +776,7 @@ public abstract class NanoHTTPD {
}
public static final class ResponseException extends Exception {
+ private static final long serialVersionUID = 1L;
private final Response.Status status;
diff --git a/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java
index afe15f1b2..8d2408b45 100644
--- a/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java
+++ b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/AtomGenerator.java
@@ -56,6 +56,11 @@ public class AtomGenerator implements FeedGenerator{
xml.text(feed.getDescription());
xml.endTag(null, "subtitle");
}
+ if (feed.getImageUrl() != null) {
+ xml.startTag(null, "logo");
+ xml.text(feed.getImageUrl());
+ xml.endTag(null, "logo");
+ }
if (feed.getPaymentLink() != null) {
GeneratorUtil.addPaymentLink(xml, feed.getPaymentLink(), false);
diff --git a/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java
index 89542d222..9aedbb493 100644
--- a/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java
+++ b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java
@@ -14,7 +14,6 @@ class GeneratorUtil {
String ns = (withNamespace) ? "http://www.w3.org/2005/Atom" : null;
xml.startTag(ns, "link");
xml.attribute(null, "rel", "payment");
- xml.attribute(null, "title", "Flattr this!");
xml.attribute(null, "href", paymentLink);
xml.attribute(null, "type", "text/html");
xml.endTag(ns, "link");
diff --git a/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java
index f2d53799d..5f8b4d18c 100644
--- a/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java
+++ b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/RSS2Generator.java
@@ -54,6 +54,13 @@ public class RSS2Generator implements FeedGenerator{
xml.text(feed.getLanguage());
xml.endTag(null, "language");
}
+ if (feed.getImageUrl() != null) {
+ xml.startTag(null, "image");
+ xml.startTag(null, "url");
+ xml.text(feed.getImageUrl());
+ xml.endTag(null, "url");
+ xml.endTag(null, "image");
+ }
if (feed.getPaymentLink() != null) {
GeneratorUtil.addPaymentLink(xml, feed.getPaymentLink(), true);