mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
feat(dual-screen): Downloads and Notifications pages on the bottom screen
Downloads: Steam downloads and updates (read from Steam's appmanifests, including SD-card libraries), shader-cache downloads from the content log, and DroidDeck store downloads, with progress and speed. Notifications: other apps' notifications, after the user allows notification access once. Kept in memory only, never saved or logged; ongoing, summary and empty ones are skipped.
This commit is contained in:
1 parent
e76592ba4e
commit
3be85906e9
14 files changed
+547
-35
No files matched your search
@@ -0,0 +1,38 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class BottomNotificationsTest {
|
||||
private val own = "com.droiddeck.launcher"
|
||||
|
||||
@Test fun messagesFromOtherAppsAreKept() {
|
||||
assertTrue(BottomNotifications.keep(own, "com.discord", ongoing = false, groupSummary = false, title = "Kurt", text = "ready?"))
|
||||
}
|
||||
|
||||
@Test fun ownOngoingSummaryAndEmptyNotificationsAreSkipped() {
|
||||
assertFalse(BottomNotifications.keep(own, own, ongoing = false, groupSummary = false, title = "Session", text = "running"))
|
||||
assertFalse(BottomNotifications.keep(own, "com.spotify", ongoing = true, groupSummary = false, title = "Song", text = "Artist"))
|
||||
assertFalse(BottomNotifications.keep(own, "com.discord", ongoing = false, groupSummary = true, title = "2 messages", text = ""))
|
||||
assertFalse(BottomNotifications.keep(own, "com.discord", ongoing = false, groupSummary = false, title = " ", text = ""))
|
||||
}
|
||||
|
||||
@Test fun anUpdatedNotificationMovesToTheTopOnce() {
|
||||
val list = mutableListOf(
|
||||
BottomNotification("a", "App", "one", "", 1L),
|
||||
BottomNotification("b", "App", "two", "", 2L),
|
||||
)
|
||||
BottomNotifications.add(list, BottomNotification("b", "App", "two again", "", 3L))
|
||||
assertEquals(listOf("b", "a"), list.map { it.key })
|
||||
assertEquals("two again", list.first().title)
|
||||
}
|
||||
|
||||
@Test fun theListKeepsTheNewestThirty() {
|
||||
val list = mutableListOf<BottomNotification>()
|
||||
repeat(35) { BottomNotifications.add(list, BottomNotification("k$it", "App", "t$it", "", it.toLong())) }
|
||||
assertEquals(30, list.size)
|
||||
assertEquals("k34", list.first().key)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class SteamDownloadsTest {
|
||||
private fun manifest(flags: Long, done: Long, total: Long) = """
|
||||
"AppState"
|
||||
{
|
||||
"appid" "220"
|
||||
"name" "Half-Life 2"
|
||||
"StateFlags" "$flags"
|
||||
"BytesToDownload" "$total"
|
||||
"BytesDownloaded" "$done"
|
||||
}
|
||||
""".trimIndent()
|
||||
|
||||
@Test fun anInstalledGameIsNotADownload() {
|
||||
assertNull(SteamDownloads.fromManifest("220", "Half-Life 2", manifest(4, 100, 100)))
|
||||
}
|
||||
|
||||
@Test fun aRunningUpdateShowsItsBytes() {
|
||||
val d = SteamDownloads.fromManifest("220", "Half-Life 2", manifest(1026, 40, 100))!!
|
||||
assertEquals(40L, d.done)
|
||||
assertEquals(100L, d.total)
|
||||
}
|
||||
|
||||
@Test fun aPausedUpdateSaysSo() {
|
||||
assertTrue(SteamDownloads.fromManifest("220", "Half-Life 2", manifest(514, 40, 100))!!.paused)
|
||||
}
|
||||
|
||||
@Test fun anUpdateNotSizedYetIsStillListed() {
|
||||
assertEquals(0L, SteamDownloads.fromManifest("220", "Half-Life 2", manifest(6, 0, 0))!!.total)
|
||||
}
|
||||
|
||||
@Test fun onlyShaderUpdatesStillRunningCount() {
|
||||
val log = sequenceOf(
|
||||
"[2026-10-30 06:33:02] AppID 220 Shader update changed : Running Update,Downloading,",
|
||||
"[2026-10-30 06:33:02] AppID 440 Shader update changed : Running Update,",
|
||||
"[2026-10-30 06:33:03] AppID 440 Shader update changed : None",
|
||||
"[2026-10-30 06:33:03] AppID 570 App update changed : Running Update,",
|
||||
)
|
||||
assertEquals(listOf("220"), SteamDownloads.runningShaderUpdates(log))
|
||||
}
|
||||
|
||||
@Test fun aClientRestartForgetsOlderShaderUpdates() {
|
||||
val log = sequenceOf(
|
||||
"[2026-10-30 06:33:02] AppID 220 Shader update changed : Running Update,",
|
||||
"[2026-10-30 07:00:00] Client version: 1761000000",
|
||||
)
|
||||
assertEquals(emptyList<String>(), SteamDownloads.runningShaderUpdates(log))
|
||||
}
|
||||
}
|
||||
@@ -24,3 +24,15 @@ class BottomDashboardTest {
|
||||
assertFalse(bottomTabsWithLabels(360f, 3))
|
||||
}
|
||||
}
|
||||
|
||||
class BottomDownloadsRateTest {
|
||||
@Test fun rateIsBytesPerSecondBetweenReads() {
|
||||
assertEquals(1_000_000L, downloadRate(0L, 0L, 2_000_000L, 2_000L))
|
||||
}
|
||||
|
||||
@Test fun noMovementOrARestartIsZero() {
|
||||
assertEquals(0L, downloadRate(500L, 0L, 500L, 2_000L))
|
||||
assertEquals(0L, downloadRate(500L, 0L, 100L, 2_000L))
|
||||
assertEquals(0L, downloadRate(-1L, 0L, 100L, 2_000L))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user