Expose Battle.net launcher in Library and restore Stores to More (#3285)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-26 23:16:11 -05:00
1 parent e0296a1176
commit e71c37b34f
4 files changed
+43 -15

No files matched your search

@@ -11,6 +11,7 @@ import androidx.compose.runtime.snapshots.Snapshot
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.assertIsNotEnabled
import androidx.compose.ui.test.assertCountEquals
import androidx.compose.ui.test.onAllNodesWithText
import androidx.compose.ui.test.onNodeWithContentDescription
@@ -195,13 +196,32 @@ class LibraryVisibilityTest {
compose.onNodeWithText("Uninstalled GOG").assertExists()
}
private fun show() {
@Test fun battleNetHasAnOpenClientActionEvenWithoutInstalledGames() {
var opened = 0
show(actions(onBattleNet = { opened++ }))
compose.onNodeWithTag("library-battlenet-open").assertDoesNotExist()
compose.onNodeWithTag("library-source-battlenet").performClick()
compose.mainClock.advanceTimeBy(1_000)
compose.onNodeWithTag("library-battlenet-open").assertIsDisplayed().performClick()
assertEquals(1, opened)
compose.onNodeWithTag("library-source-steam").performClick()
compose.mainClock.advanceTimeBy(1_000)
compose.onNodeWithTag("library-battlenet-open").assertDoesNotExist()
}
@Test fun battleNetOpenIsDisabledWhileBusy() {
LibraryView.source = Store.BATTLENET.id
show(frontState = state(busy = true))
compose.onNodeWithTag("library-battlenet-open").assertIsNotEnabled()
}
private fun show(frontActions: FrontEndActions = actions(), frontState: FrontEndState = state()) {
compose.mainClock.autoAdvance = false
compose.setContent { key(generation) {
DroidDeckTheme {
CompositionLocalProvider(LocalFrontFocus provides FrontFocus()) {
FocusGlideHost { Box(Modifier.fillMaxSize()) {
LibraryPage(state(), actions(), "games", {}, Modifier.fillMaxSize())
LibraryPage(frontState, frontActions, "games", {}, Modifier.fillMaxSize())
StepsLayer(Offset.Zero)
} }
}
@@ -216,15 +236,16 @@ class LibraryVisibilityTest {
assertEquals(show, SessionPrefs.libraryShowUninstalled(ctx))
}
private fun state(games: List<Library.SteamGame> = listOf(Library.SteamGame(440, "Installed Steam game", null, "internal"))) = FrontEndState(
installed = "r9", ready = true, available = null, busy = false, stage = "", percent = -1,
private fun state(games: List<Library.SteamGame> = listOf(Library.SteamGame(440, "Installed Steam game", null, "internal")), busy: Boolean = false) = FrontEndState(
installed = "r9", ready = true, available = null, busy = busy, stage = "", percent = -1,
desktopInstalled = true, offlineAccount = null, offline = false, frameGenLabel = "",
romsDir = null, logsEnabled = false,
steamGames = games,
emulators = emptyList(), running = null,
)
private fun actions() = FrontEndActions(
private fun actions(onBattleNet: () -> Unit = {}) = FrontEndActions(
onBattleNet = onBattleNet,
onPlay = {}, onPlayDesktopUi = {}, onSteamGame = {}, onDesktop = {}, onEmulator = {},
onRom = {}, onResume = {}, onSteamSettings = {}, onDesktopSettings = {},
onInstallPackage = {}, onRemovePackage = {}, onRuntime = {}, onFrameGenPick = {},
@@ -40,8 +40,8 @@ class NavTabsTest {
}
@Test fun aFreshInstallShowsTheDefaultBarMoreAndHiddenTabs() {
assertEquals(listOf("steam", "desktop", "games", "downloads", "setup", "updates", "stores", NavTabs.MORE), navigationKeys(state()))
assertEquals(listOf("soundtracks", "components", "storage", "sync", "decky", "boot-movies"), NavTabs.more(state()))
assertEquals(listOf("steam", "desktop", "games", "downloads", "setup", "updates", NavTabs.MORE), navigationKeys(state()))
assertEquals(listOf("stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies"), NavTabs.more(state()))
assertEquals(TabPlace.HIDDEN, NavTabs.place(state(), "android-apps"))
assertEquals(TabPlace.HIDDEN, NavTabs.place(state(), "agent"))
assertFalse(com.droiddeck.launcher.agent.AgentTab.shown)
@@ -66,13 +66,13 @@ class NavTabsTest {
@Test fun showingMusicOnceKeepsItShownAfterReload() {
place("soundtracks", TabPlace.BAR)
NavTabs.load(ctx)
assertEquals(listOf("steam", "desktop", "games", "downloads", "setup", "updates", "stores", "soundtracks", NavTabs.MORE), navigationKeys(state()))
assertEquals(listOf("steam", "desktop", "games", "downloads", "setup", "updates", "soundtracks", NavTabs.MORE), navigationKeys(state()))
}
@Test fun shelvedTabsLeaveTheBarAndAddMoreAtTheEnd() {
place("desktop", TabPlace.MORE)
val s = state()
assertEquals(listOf("desktop", "soundtracks", "components", "storage", "sync", "decky", "boot-movies"), NavTabs.more(s))
assertEquals(listOf("desktop", "stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies"), NavTabs.more(s))
assertEquals(NavTabs.MORE, navigationKeys(s).last())
assertFalse("desktop" in navigationKeys(s))
}
@@ -85,14 +85,14 @@ class NavTabsTest {
}
@Test fun resettingPutsBackTheDefaultLayout() {
place("stores", TabPlace.MORE)
place("stores", TabPlace.BAR)
place("updates", TabPlace.HIDDEN)
moveTab("downloads", -1)
assertFalse(NavTabs.isDefault())
NavTabs.reset(ctx)
NavTabs.load(ctx)
assertTrue(NavTabs.isDefault())
assertEquals(listOf("steam", "desktop", "games", "downloads", "setup", "updates", "stores", NavTabs.MORE), navigationKeys(state()))
assertEquals(listOf("steam", "desktop", "games", "downloads", "setup", "updates", NavTabs.MORE), navigationKeys(state()))
}
@Test fun anOldLayoutKeepsWhatItsSwitchesShowed() {