mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
feat: DroidDeck's linux-nightly components, with a Stable/Nightly switch (#1284)
The component catalog also reads the linux-nightly release of Droid-Deck/DroidDeck-Components (hourly builds of DXVK, VKD3D-Proton and FEX for glibc Protons). That release holds all three components, so each file goes to its list by name: DD-dxvk-, DD-vkd3d-proton-, DD-FEXCore-. A nightly that matches a stable build (same flavor and version, e.g. DD-dxvk-3.1.1+153-nightly and dxvk-3.1.1-linux) has no row of its own; if two nightlies match, the newer one is used. On the components page the stable row gets a Stable | Nightly switch before Get, styled like the Get button, one focus stop that flips with A or a tap and reports its state as a switch. In the in-session drawer's download menus the row gets Stable and Nightly tabs beside it (the existing TabStrip, now with optional bumpers/compact), each its own focus stop. Get or A on the row downloads whichever channel is selected. A nightly without a stable counterpart keeps its own row, listed below the stable ones. Downloads are allowed from that repository's releases too. A failed nightly download says the file may have been replaced and asks for a refresh. Strings in all locales.
This commit is contained in:
1 parent
593014fe8c
commit
aaa2e40def
39 files changed
+415
-96
No files matched your search
@@ -4,11 +4,20 @@ import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.input.InputMode
|
||||
import androidx.compose.ui.input.InputModeManager
|
||||
import androidx.compose.ui.input.key.Key
|
||||
import androidx.compose.ui.platform.LocalInputModeManager
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.test.assertIsFocused
|
||||
import androidx.compose.ui.test.ExperimentalTestApi
|
||||
import androidx.compose.ui.test.assertIsNotEnabled
|
||||
import androidx.compose.ui.test.onNodeWithTag
|
||||
import androidx.compose.ui.test.onNodeWithText
|
||||
import androidx.compose.ui.test.performClick
|
||||
import androidx.compose.ui.test.performKeyInput
|
||||
import androidx.compose.ui.test.pressKey
|
||||
import androidx.compose.ui.test.requestFocus
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.session.ComponentsManager
|
||||
import org.junit.Assert.assertEquals
|
||||
@@ -19,10 +28,12 @@ import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@OptIn(ExperimentalTestApi::class, androidx.compose.ui.ExperimentalComposeUiApi::class)
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [28])
|
||||
class ComponentDownloadsDrawerTest {
|
||||
@get:Rule val compose = createRobolectricComposeRule()
|
||||
private lateinit var inputMode: InputModeManager
|
||||
|
||||
private val dxvk = item("dxvk-2.4.1-linux.wcp", "dxvk")
|
||||
private val stored = item("dxvk-2.3-linux.wcp", "dxvk")
|
||||
@@ -42,6 +53,40 @@ class ComponentDownloadsDrawerTest {
|
||||
compose.onNodeWithText("45%").assertExists()
|
||||
}
|
||||
|
||||
@Test fun pairedNightlyRidesOnTheStableRowBehindTheSwitch() {
|
||||
val stable = ComponentsManager.CatalogItem("dxvk-3.1.1-linux.wcp", "dxvk", "Dxvk-Linux", "https://github.com/example/s", 100, "sha256:test")
|
||||
val nightly = ComponentsManager.CatalogItem("DD-dxvk-3.1.1+153-nightly.wcp", "dxvk", ComponentsManager.DD_NIGHTLY, "https://github.com/example/n", 100, "sha256:test")
|
||||
val requested = mutableListOf<ComponentsManager.CatalogItem>()
|
||||
show(catalog = listOf(stable, nightly), onDownload = requested::add)
|
||||
compose.onNodeWithTag("cmp-download-dxvk").performClick()
|
||||
compose.onNodeWithText("dxvk-3.1.1-linux").assertExists()
|
||||
compose.onNodeWithText("DD-dxvk-3.1.1+153-nightly").assertDoesNotExist()
|
||||
compose.onNodeWithText(RuntimeEnvironment.getApplication().getString(R.string.comp_channel_nightly)).performClick()
|
||||
compose.onNodeWithText("dxvk-3.1.1-linux").assertDoesNotExist()
|
||||
compose.onNodeWithText("DD-dxvk-3.1.1+153-nightly").performClick()
|
||||
assertEquals(listOf(nightly), requested)
|
||||
}
|
||||
|
||||
@Test fun controllerPicksNightlyOnItsTabThenDownloadsItFromTheRow() {
|
||||
val stable = ComponentsManager.CatalogItem("dxvk-3.1.1-linux.wcp", "dxvk", "Dxvk-Linux", "https://github.com/example/s", 100, "sha256:test")
|
||||
val nightly = ComponentsManager.CatalogItem("DD-dxvk-3.1.1+153-nightly.wcp", "dxvk", ComponentsManager.DD_NIGHTLY, "https://github.com/example/n", 100, "sha256:test")
|
||||
val requested = mutableListOf<ComponentsManager.CatalogItem>()
|
||||
show(catalog = listOf(stable, nightly), onDownload = requested::add)
|
||||
compose.onNodeWithTag("cmp-download-dxvk").performClick()
|
||||
compose.runOnIdle { inputMode.requestInputMode(InputMode.Keyboard) }
|
||||
compose.onNodeWithText("dxvk-3.1.1-linux").requestFocus().assertIsFocused()
|
||||
compose.onNodeWithText("dxvk-3.1.1-linux").performKeyInput { pressKey(Key.DirectionRight) }
|
||||
val nightlyTab = RuntimeEnvironment.getApplication().getString(R.string.comp_channel_nightly)
|
||||
compose.onNodeWithText(RuntimeEnvironment.getApplication().getString(R.string.comp_channel_stable)).assertIsFocused()
|
||||
.performKeyInput { pressKey(Key.DirectionRight) }
|
||||
compose.onNodeWithText(nightlyTab).assertIsFocused().performKeyInput { pressKey(Key.ButtonA) }
|
||||
compose.onNodeWithText("DD-dxvk-3.1.1+153-nightly").assertExists()
|
||||
assertEquals(emptyList<ComponentsManager.CatalogItem>(), requested)
|
||||
compose.onNodeWithText(nightlyTab).performKeyInput { pressKey(Key.DirectionLeft); pressKey(Key.DirectionLeft) }
|
||||
compose.onNodeWithText("DD-dxvk-3.1.1+153-nightly").assertIsFocused().performKeyInput { pressKey(Key.ButtonA) }
|
||||
assertEquals(listOf(nightly), requested)
|
||||
}
|
||||
|
||||
@Test fun emptyCatalogOffersRefreshAndDisablesVersionChoicesWhileChecking() {
|
||||
var refreshes = 0
|
||||
show(catalog = emptyList(), checking = false, onRefresh = { refreshes++ })
|
||||
@@ -64,6 +109,7 @@ class ComponentDownloadsDrawerTest {
|
||||
onDownload: (ComponentsManager.CatalogItem) -> Unit = {},
|
||||
) {
|
||||
compose.setContent {
|
||||
inputMode = LocalInputModeManager.current
|
||||
DroidDeckTheme {
|
||||
Column(Modifier.verticalScroll(rememberScrollState())) {
|
||||
ComponentDownloadsDrawerGroup(
|
||||
|
||||
Reference in new issue
Block a user