library: drop the download progress indicator

This commit is contained in:
austinried
2026-10-21 06:04:23 +00:00
parent 6f1e1612e1
commit e487d2e0b1
7 changed files with 1 additions and 141 deletions
@@ -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,
)
}