mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 22:05:59 +00:00
fix: refresh repaired components and render Ubisoft Connect (#2090)
* fix: refresh repaired components and render Ubisoft Connect * fix: address component repair and Wine registry review * fix: repair manually enabled components and check registry writes * fix: serialize component repairs and use Proton runinprefix * fix: report queued component repair failures * fix: preserve newer component repair waits * Make component queue transitions atomic * Isolate component apply failures by game * Preserve pending repair when catalog is stale * Restore persisted component repair revisions * Update pending requirements atomically * Respect disabled pending components per game * Keep queue key state atomic while worker waits * Pass selected game to component repairs * Preserve pending repair when component is absent * Preserve pending revision on catalog failure * Test legacy pending repair revision recovery * Isolate fake worker Steam app info lookup * Merge queued Steam app info lookups * Persist launch component revisions before repair * Gate launch on component repair discovery * Expand and refresh launch repair discovery * Include new automatic picks in launch requirements * Log repair persistence failures and align repair keys * Use runtime key for Battle.net component repairs * Retain failed component reapplications for retry * Harden pending repairs and launch preparation * Isolate wait-cool sleep mocking * Allow launches without catalog when no repair is pending * Queue launch repairs even if persistence fails * Block launch when repair state cannot persist * Allow launch when no component repair is needed * Persist selected repairs when catalog is offline * Drain offline component repair in test
This commit is contained in:
1 parent
ab92033b90
commit
516e3862fa
14 files changed
+756
-83
No files matched your search
@@ -0,0 +1,73 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import org.json.JSONObject
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
import java.io.File
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33])
|
||||
class WinComponentRevisionTest {
|
||||
@get:Rule val temp = TemporaryFolder()
|
||||
|
||||
private fun installed(revision: Int? = null): File = temp.newFolder().also { directory ->
|
||||
val meta = JSONObject().put("version", "10.0.40219")
|
||||
revision?.let { meta.put("revision", it) }
|
||||
File(directory, "component.json").writeText(meta.toString())
|
||||
}
|
||||
|
||||
@Test fun legacyComponentsStayInstalledUntilTheCatalogRequestsARepair() {
|
||||
val directory = installed()
|
||||
assertEquals("10.0.40219", WinComponents.installedVersion(directory, 0))
|
||||
assertNull(WinComponents.installedVersion(directory, 1))
|
||||
}
|
||||
|
||||
@Test fun repairedComponentsStayInstalledAndAreNotDowngradedByAnOlderCatalog() {
|
||||
val directory = installed(2)
|
||||
assertEquals("10.0.40219", WinComponents.installedVersion(directory, 2))
|
||||
assertEquals("10.0.40219", WinComponents.installedVersion(directory, 1))
|
||||
assertNull(WinComponents.installedVersion(directory, 3))
|
||||
}
|
||||
|
||||
@Test fun outdatedComponentsRemainDownloadedForOfflineControls() {
|
||||
val directory = installed()
|
||||
assertNull(WinComponents.installedVersion(directory, 1))
|
||||
assertEquals(listOf(directory.name), WinComponents.downloadedIds(directory.parentFile))
|
||||
}
|
||||
|
||||
@Test fun enablingDownloadedComponentsRequiresTheCatalogRevision() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
val id = "vcredist2010_dll"
|
||||
val directory = File(LinuxRuntime.rootDir(context), "opt/droiddeck/wincomponents/$id").apply { mkdirs() }
|
||||
val metadata = File(directory, "component.json")
|
||||
metadata.writeText("""{"version":"10.0.40219"}""")
|
||||
val catalog = File(context.filesDir, "wincomponents-catalog.json")
|
||||
catalog.writeText("""{"components":[{"name":"$id","revision":1}]}""")
|
||||
try {
|
||||
assertEquals(listOf(id), WinComponents.downloadedIds(context))
|
||||
assertNull(WinComponents.installed(context, id))
|
||||
metadata.writeText("""{"version":"10.0.40219","revision":1}""")
|
||||
assertEquals("10.0.40219", WinComponents.installed(context, id))
|
||||
catalog.delete()
|
||||
assertEquals("10.0.40219", WinComponents.installed(context, id))
|
||||
} finally {
|
||||
directory.deleteRecursively()
|
||||
catalog.delete()
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun missingOrInvalidInstallMetadataNeedsInstallation() {
|
||||
val directory = temp.newFolder()
|
||||
assertNull(WinComponents.installedVersion(directory, 0))
|
||||
File(directory, "component.json").writeText("{")
|
||||
assertNull(WinComponents.installedVersion(directory, 1))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user