mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-15 00:42:54 +01:00
library: drop the download progress indicator
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
package com.subtracks.ui.components
|
||||
|
||||
import com.subtracks.data.model.DownloadProgress
|
||||
import com.subtracks.data.model.ListDownloadStatus
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
@@ -38,14 +35,4 @@ class DownloadIndicatorTest {
|
||||
fun aFullyDownloadedListIsNotDownloading() {
|
||||
assertFalse(ListDownloadStatus(total = 4, downloaded = 4).isDownloading())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun totalDownloadProgressCombinesEveryInFlightTransfer() {
|
||||
assertEquals(0.4f, DownloadProgress(bytes = 40, total = 100).fraction)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun queuedDownloadsWithoutASizeShowAnIndeterminateRing() {
|
||||
assertNull(DownloadProgress(bytes = 0, total = 0).fraction)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package com.subtracks.ui.library
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.subtracks.data.model.DownloadProgress
|
||||
import com.subtracks.data.model.DownloadStatus
|
||||
import com.subtracks.data.model.SongDownload
|
||||
import com.subtracks.data.prefs.AlbumSort
|
||||
import com.subtracks.data.prefs.ArtistSort
|
||||
import com.subtracks.data.prefs.ListQuery
|
||||
import com.subtracks.data.prefs.PlaylistSort
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@@ -28,39 +24,4 @@ class LibraryViewModelTest {
|
||||
assertEquals(ArtistSort.Name, ListQuery("LegacyArtistOrder").artistSort())
|
||||
assertEquals(PlaylistSort.Name, ListQuery("LegacyPlaylistOrder").playlistSort())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun downloadProgressOnlyCountsTheActiveSource() {
|
||||
val rows = listOf(download(1, bytes = 40, total = 100), download(2, bytes = 10, total = 20))
|
||||
|
||||
assertEquals(DownloadProgress(bytes = 40, total = 100), downloadProgress(rows, sourceId = 1))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anotherSourcesDownloadsDoNotShowAProgressRing() {
|
||||
assertNull(downloadProgress(listOf(download(2, bytes = 10, total = 20)), sourceId = 1))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aTransferWithoutAKnownSizeIsIndeterminate() {
|
||||
val rows =
|
||||
listOf(
|
||||
download(1, bytes = 100, total = 100),
|
||||
download(1, bytes = 20, total = 0).copy(songId = "s2"),
|
||||
)
|
||||
|
||||
assertEquals(DownloadProgress(bytes = 0, total = 0), downloadProgress(rows, sourceId = 1))
|
||||
}
|
||||
|
||||
private fun download(
|
||||
sourceId: Long,
|
||||
bytes: Long,
|
||||
total: Long,
|
||||
) = SongDownload(
|
||||
sourceId = sourceId,
|
||||
songId = "s1",
|
||||
status = DownloadStatus.Running,
|
||||
bytes = bytes,
|
||||
total = total,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user