From 361f73ffa001fb6477683eee7f4c23932a234f74 Mon Sep 17 00:00:00 2001 From: Daniel Bowman Date: Sat, 20 Oct 2018 18:38:26 +0100 Subject: Fix a crash on getRecentDownloads if playlist is empty --- .../daneren2005/dsub/service/DownloadServiceTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app/src/androidTest/java') diff --git a/app/src/androidTest/java/github/daneren2005/dsub/service/DownloadServiceTest.java b/app/src/androidTest/java/github/daneren2005/dsub/service/DownloadServiceTest.java index 44b77b84..37e91642 100644 --- a/app/src/androidTest/java/github/daneren2005/dsub/service/DownloadServiceTest.java +++ b/app/src/androidTest/java/github/daneren2005/dsub/service/DownloadServiceTest.java @@ -49,6 +49,20 @@ public class DownloadServiceTest extends assertEquals(0, position); } + public void testGetRecentDownloadsWithoutPlaylist() { + int output_length = downloadService.getRecentDownloads().size(); + assertEquals(0, output_length); + } + + public void testGetRecentDownloadsWithPlaylist() { + downloadService.getDownloads().clear(); + downloadService.download(this.createMusicSongs(2), false, false, false, + false, 0, 0); + + int output_length = downloadService.getRecentDownloads().size(); + assertEquals(1, output_length); + } + public void testGetCurrentPlayingIndexWithoutPlayList() { int currentPlayingIndex = activity.getDownloadService() .getCurrentPlayingIndex(); -- cgit v1.2.3