mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
feat: optional x86-64 Steam client (Valve's Linux client under FEX) beside the arm64 one (#152)
An opt-in second Steam client (Steam settings, Steam client: x86-64): Valve's x86-64 Linux client, unchanged, runs under FEX in its own home with its own game library and the same sign-in. Linux builds run directly, so titles such as Team Fortress 2 and Half-Life use their Linux versions; Windows games use DroidDeck-Proton as on arm64. The arm64 client stays the default. - droiddeck-steam-x64: FEX and the x86-64 rootfs from DroidDeck-Components (sha256-pinned), client install and sync from Valve's CDN, sign-in shared with the arm64 client, its web helper on the GPU (ANGLE GL over FEX's GL thunk, zink, Turnip), Proton wrappers for the arm64 client's tools, DroidDeck direct for Linux builds, SD-card library (x86-64/ beside the arm64 one), repair. - FEX 2610 built by build-fex.yml with thunks and three patches: an openat2 fallback without openat2 (proot), newer-clang thunkgen, MAP_32BIT exhaustion returning ENOMEM. libblsession resolves RESOLVE_IN_ROOT paths inside the root. - Session: x86-64 gating, shortcuts and compatibility tools per client, logs from the client that ran. - App: client setting with the FEX version, an x86-64 chip on the Games header, the active client's library, art, storage, downloads, repair, Offline Mode, Decky, desktop mode, optional VAC diagnostics; per-client state for art, the content log, repair and leftovers. - Strings in every locale. - Review fixes: the library cache is saved only by the newest scan; an abandoned session's Steam logs come from the client it recorded; distinct VAC console names; FEXInterpreter in CPU pinning; clearer VAC hint in pl, ru, uk, cs and bg.
This commit is contained in:
1 parent
ab799e6938
commit
db8d1c9910
125 files changed
+4953
-263
No files matched your search
@@ -147,4 +147,23 @@ class LogRedactorTest {
|
||||
val once = LogRedactor.redactForShare("resolver: 192.168.0.1")
|
||||
assertEquals(once, LogRedactor.redactForShare(once))
|
||||
}
|
||||
|
||||
@Test fun learnedAccountsComeFromBothClients() {
|
||||
val root = java.nio.file.Files.createTempDirectory("redactor").toFile()
|
||||
try {
|
||||
val arm = java.io.File(root, "root/.local/share/Steam/config/loginusers.vdf")
|
||||
arm.parentFile.mkdirs()
|
||||
arm.writeText("\"users\" { \"7656\" { \"AccountName\" \"armplayer\" \"PersonaName\" \"Arm Persona\" } }")
|
||||
LogRedactor.learnFromRuntime(root)
|
||||
assertEquals("hi <redacted:account> and <redacted:account>", LogRedactor.redact("hi armplayer and Arm Persona"))
|
||||
val x64 = java.io.File(root, "root/.droiddeck-x64/.local/share/Steam/config/loginusers.vdf")
|
||||
x64.parentFile.mkdirs()
|
||||
x64.writeText("\"users\" { \"7656\" { \"AccountName\" \"x64player\" } }")
|
||||
LogRedactor.learnFromRuntime(root)
|
||||
assertEquals("<redacted:account> <redacted:account>", LogRedactor.redact("armplayer x64player"))
|
||||
} finally {
|
||||
LogRedactor.learnAccounts()
|
||||
root.deleteRecursively()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,30 @@ class AddedGamesScanTest {
|
||||
assertEquals(listOf("Example"), AddedGames.scan(app).map { it.name })
|
||||
}
|
||||
|
||||
private fun cardWithX8664Library(): File {
|
||||
val card = tmp.newFolder("Card")
|
||||
File(card, "Example").mkdirs()
|
||||
File(card, "Example/Example.exe").writeText("game")
|
||||
File(card, "x86-64/steamapps/common/FlatOut").mkdirs()
|
||||
File(card, "x86-64/steamapps/common/FlatOut/FlatOut.exe").writeText("steam game")
|
||||
return card
|
||||
}
|
||||
|
||||
@Test fun theX8664ClientsCardLibraryIsNotAGame() {
|
||||
val card = cardWithX8664Library()
|
||||
SessionPrefs.setGameStorage(app, card.path, "Card")
|
||||
assertEquals(listOf("Example"), AddedGames.scan(app).map { it.name })
|
||||
assertTrue(AddedGames.isSteamLibraryFolder("x86-64"))
|
||||
assertFalse(AddedGames.isSteamLibraryFolder("x86-64 games"))
|
||||
}
|
||||
|
||||
@Test fun anOldGamesFolderHoldingTheX8664LibraryDoesNotMigrateItAsAGame() {
|
||||
val card = cardWithX8664Library()
|
||||
SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "")
|
||||
SessionPrefs.setAddedGamesDirs(app, listOf(card.path))
|
||||
assertEquals(listOf("Example"), AddedGames.scan(app).map { it.name })
|
||||
}
|
||||
|
||||
@Test fun aStorePackageLaunchesTheExecutableItDeclares() {
|
||||
val game = tmp.newFolder("Minecraft Dungeons")
|
||||
File(game, "Dungeons.exe").writeText("unreal bootstrap")
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.droiddeck.launcher.frontend
|
||||
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import java.io.File
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33])
|
||||
class LibraryArchTest {
|
||||
private val app get() = RuntimeEnvironment.getApplication()
|
||||
|
||||
@Test fun aScanReadsTheClientItWasGivenNotTheSelectedOne() {
|
||||
SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "")
|
||||
SessionPrefs.setSteamClientArch(app, "arm64")
|
||||
val apps = File(SessionPrefs.steamRoot(app, "x86_64"), "steamapps").apply { mkdirs() }
|
||||
File(apps, "appmanifest_440.acf").writeText("\"AppState\"\n{\n\t\"appid\"\t\t\"440\"\n\t\"name\"\t\t\"Team Fortress 2\"\n\t\"StateFlags\"\t\t\"4\"\n}\n")
|
||||
assertEquals(listOf("Team Fortress 2"), Library.launchableGames(app, added = emptyList(), arch = "x86_64").map { it.name })
|
||||
assertEquals(emptyList<String>(), Library.launchableGames(app, added = emptyList(), arch = "arm64").map { it.name })
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.droiddeck.launcher.frontend
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33])
|
||||
class LibraryCacheClientTest {
|
||||
private val app get() = RuntimeEnvironment.getApplication()
|
||||
private val games = listOf(Library.SteamGame(440, "Team Fortress 2", null, "Steam library"))
|
||||
|
||||
@Test fun aCacheFromBeforeTheClientWasRecordedIsArm64s() {
|
||||
java.io.File(app.filesDir, "library-cache.json").writeText("""[{"appId":440,"name":"Team Fortress 2","library":"Steam library","gameId":440}]""")
|
||||
val (games, x64) = LibraryCache.snapshot(app)
|
||||
assertEquals(listOf("Team Fortress 2"), games.map { it.name })
|
||||
assertFalse(x64)
|
||||
}
|
||||
|
||||
@Test fun theListAndItsClientAreOneFile() {
|
||||
LibraryCache.save(app, games, x64 = true)
|
||||
assertEquals(listOf("library-cache.json"), app.filesDir.list().orEmpty().filter { it.startsWith("library-cache") })
|
||||
assertEquals(listOf("Team Fortress 2") to true, LibraryCache.snapshot(app).let { (g, x) -> g.map { it.name } to x })
|
||||
}
|
||||
|
||||
@Test fun theListsClientIsKeptUntilAListForAnotherIsSaved() {
|
||||
LibraryCache.save(app, games, x64 = true)
|
||||
assertTrue(LibraryCache.listedX64(app))
|
||||
LibraryCache.save(app, emptyList())
|
||||
assertTrue(LibraryCache.listedX64(app))
|
||||
LibraryCache.save(app, games, x64 = false)
|
||||
assertFalse(LibraryCache.listedX64(app))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.droiddeck.launcher.frontend
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class LibraryFromSteamClientTest {
|
||||
@Test fun onlyTheClientsOwnInstallsAreDroppedOnASwitch() {
|
||||
val games = listOf(
|
||||
Library.SteamGame(440, "Team Fortress 2", null, "Steam library"),
|
||||
Library.SteamGame(1, "God of War", null, Library.ADDED, gameId = 9_000_000_001L),
|
||||
Library.SteamGame(2, "Store game", null, "Games", gameId = 9_000_000_002L, source = "gog"),
|
||||
)
|
||||
assertEquals(listOf("God of War", "Store game"), games.filterNot(Library::fromSteamClient).map { it.name })
|
||||
}
|
||||
}
|
||||
@@ -129,6 +129,23 @@ class SteamGridTest {
|
||||
assertNull(SteamGameArt.chosenFile(app, 620, AddedGameArt.Slot.BACKGROUND))
|
||||
}
|
||||
|
||||
@Test fun theOtherClientsEmptyGridGetsTheChoiceInsteadOfDroppingIt() {
|
||||
File(LinuxRuntime.rootDir(app), "root/.local/share/Steam/userdata/123/config").mkdirs()
|
||||
val picked = image("mine.png", 12)
|
||||
SteamGameArt.choose(app, game(), AddedGameArt.Slot.COVER, AddedGameArt.Option(AddedGameArt.FILE, picked.path, picked.path))
|
||||
assertFalse(SteamGrid.sync(app, listOf(target())))
|
||||
|
||||
val x64 = File(SessionPrefs.steamRoot(app, "x86_64"), "userdata/123/config").apply { mkdirs() }
|
||||
SessionPrefs.setSteamClientArch(app, "x86_64")
|
||||
assertFalse(SteamGrid.sync(app, listOf(target())))
|
||||
assertEquals(12L, SteamGameArt.chosenFile(app, 620, AddedGameArt.Slot.COVER)?.length())
|
||||
assertEquals(12L, File(x64, "grid/620p.png").length())
|
||||
|
||||
SessionPrefs.setSteamClientArch(app, "arm64")
|
||||
assertFalse(SteamGrid.sync(app, listOf(target())))
|
||||
assertEquals(12L, File(grid, "620p.png").length())
|
||||
}
|
||||
|
||||
@Test fun aChoiceMadeHereIsNotTakenBackAsASteamChange() {
|
||||
File(LinuxRuntime.rootDir(app), "root/.local/share/Steam/userdata/123/config").mkdirs()
|
||||
val picked = image("mine.png", 12)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
|
||||
class SessionClientRecordTest {
|
||||
@get:Rule val tmp = TemporaryFolder()
|
||||
|
||||
@Test fun aSessionFolderKeepsTheClientItRan() {
|
||||
val dir = tmp.newFolder("2026-10-18-01-steam")
|
||||
assertNull(SessionArtifacts.recordedClient(dir))
|
||||
SessionArtifacts.recordClient(dir, "x86_64")
|
||||
assertEquals("x86_64", SessionArtifacts.recordedClient(dir))
|
||||
java.io.File(dir, "steam-client.txt").writeText("something else\n")
|
||||
assertNull(SessionArtifacts.recordedClient(dir))
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,21 @@ class SteamDownloadMonitorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun followsTheX8664ClientsOwnLibrary() {
|
||||
val root = Files.createTempDirectory("droiddeck-steam-download-").toFile()
|
||||
try {
|
||||
val steam = File(root, "root/.droiddeck-x64/.local/share/Steam")
|
||||
val manifest = manifest(steam, "49520", downloaded = 10, total = 100, flags = 6)
|
||||
val monitor = SteamDownloadMonitor()
|
||||
|
||||
assertFalse(monitor.poll(root, now = 1_000L))
|
||||
manifest.writeText(appManifest(downloaded = 20, total = 100, flags = 6))
|
||||
assertTrue(monitor.poll(root, now = 3_000L))
|
||||
} finally {
|
||||
root.deleteRecursively()
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun findsDownloadsInAdditionalSteamLibraries() {
|
||||
val root = Files.createTempDirectory("droiddeck-steam-download-").toFile()
|
||||
try {
|
||||
@@ -67,6 +82,51 @@ class SteamDownloadMonitorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun theOtherClientsLogIsReadFromItsStart() {
|
||||
val root = Files.createTempDirectory("droiddeck-steam-download-").toFile()
|
||||
try {
|
||||
File(root, "root/.local/share/Steam/logs/content_log.txt").apply {
|
||||
check(parentFile?.mkdirs() != false)
|
||||
writeText("[2026-10-06 14:00:00] Client version: 1\n" + "[2026-10-06 14:00:01] nothing to download\n".repeat(20))
|
||||
setLastModified(10_000L)
|
||||
}
|
||||
val monitor = SteamDownloadMonitor()
|
||||
assertFalse(monitor.poll(root, now = 1_000L))
|
||||
|
||||
File(root, "root/.droiddeck-x64/.local/share/Steam/logs/content_log.txt").apply {
|
||||
check(parentFile?.mkdirs() != false)
|
||||
writeText("[2026-10-06 14:44:17] AppID 44 App update changed : Running Update,Downloading,Staging,\n" +
|
||||
"[2026-10-06 14:44:18] Current download rate: 0.000 Mbps\n".repeat(30))
|
||||
setLastModified(20_000L)
|
||||
}
|
||||
assertTrue(monitor.poll(root, now = 2_000L))
|
||||
} finally {
|
||||
root.deleteRecursively()
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun theRunningClientsLogIsFollowedWhenTheOtherOneIsNewer() {
|
||||
val root = Files.createTempDirectory("droiddeck-steam-download-").toFile()
|
||||
try {
|
||||
File(root, "root/.local/share/Steam/logs/content_log.txt").apply {
|
||||
check(parentFile?.mkdirs() != false)
|
||||
writeText("[2026-10-06 14:44:17] AppID 44 App update changed : Running Update,Downloading,Staging,\n")
|
||||
setLastModified(10_000L)
|
||||
}
|
||||
File(root, "root/.droiddeck-x64/.local/share/Steam/logs/content_log.txt").apply {
|
||||
check(parentFile?.mkdirs() != false)
|
||||
writeText("[2026-10-06 14:00:00] Client version: 1\n")
|
||||
setLastModified(20_000L)
|
||||
}
|
||||
val monitor = SteamDownloadMonitor()
|
||||
assertTrue(monitor.poll(root, now = 1_000L, client = "arm64"))
|
||||
assertTrue(monitor.poll(root, now = 2_000L, client = "arm64"))
|
||||
assertFalse(SteamDownloadMonitor().poll(root, now = 1_000L, client = "x86_64"))
|
||||
} finally {
|
||||
root.deleteRecursively()
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun receivedTrafficBridgesSteamRateLines() {
|
||||
val root = Files.createTempDirectory("droiddeck-steam-download-").toFile()
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import java.io.File
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33])
|
||||
class SteamRepairTest {
|
||||
private val app get() = RuntimeEnvironment.getApplication()
|
||||
|
||||
@Before @After fun idle() {
|
||||
SessionState.running = false
|
||||
SessionState.steamClientArch = null
|
||||
}
|
||||
|
||||
private fun marker(home: String) = File(LinuxRuntime.rootDir(app), "root/$home/package/droiddeck-unconfirmed").apply {
|
||||
parentFile?.mkdirs()
|
||||
writeText("tracked\nstart\nstart\n")
|
||||
}
|
||||
|
||||
@Test fun aShownClientClearsOnlyItsOwnUnconfirmedStarts() {
|
||||
val arm = marker(".local/share/Steam")
|
||||
val x64 = marker(".droiddeck-x64/.local/share/Steam")
|
||||
SteamRepair.clientShown(app)
|
||||
assertFalse(arm.exists())
|
||||
assertTrue(x64.exists())
|
||||
|
||||
marker(".local/share/Steam")
|
||||
SessionPrefs.setSteamClientArch(app, "x86_64")
|
||||
SteamRepair.clientShown(app)
|
||||
assertTrue(arm.exists())
|
||||
assertFalse(x64.exists())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
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 VacDiagnosticsTest {
|
||||
@Test fun tailReadsOnlyWhatThisSessionAppended() {
|
||||
val log = java.io.File.createTempFile("console", ".log")
|
||||
try {
|
||||
log.writeText("You are in insecure mode.\nConnected to 1.2.3.4\n")
|
||||
val armed = log.length()
|
||||
log.appendText("Connecting to 5.6.7.8\n")
|
||||
assertEquals(listOf("Connecting to 5.6.7.8", ""), VacDiagnostics.tail(log, armed))
|
||||
} finally {
|
||||
log.delete()
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun theSameGameInTwoLibrariesGetsTwoConsoleNames() {
|
||||
val a = java.io.File("/lib1/steamapps/common/Team Fortress 2/tf/console.log")
|
||||
val b = java.io.File("/lib2/steamapps/common/Team Fortress 2/tf/console.log")
|
||||
val c = java.io.File("/lib1/steamapps/common/Half-Life 2/hl2/console.log")
|
||||
val names = VacDiagnostics.consoleNames(listOf(a, b, c))
|
||||
assertEquals("Team Fortress 2-tf", names[0])
|
||||
assertTrue(names[1].startsWith("Team Fortress 2-tf-") && names[1] != names[0])
|
||||
assertEquals("Half-Life 2-hl2", names[2])
|
||||
assertEquals(names, VacDiagnostics.consoleNames(listOf(a, b, c)))
|
||||
}
|
||||
|
||||
@Test fun tailReadsAllOfAReplacedFile() {
|
||||
val log = java.io.File.createTempFile("console", ".log")
|
||||
try {
|
||||
log.writeText("new\n")
|
||||
assertEquals(listOf("new", ""), VacDiagnostics.tail(log, 1000L))
|
||||
} finally {
|
||||
log.delete()
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun onlyConsoleLogsThisSessionWroteAreReported() {
|
||||
val log = java.io.File.createTempFile("console", ".log")
|
||||
try {
|
||||
log.writeText("Connected to 1.2.3.4\n")
|
||||
val since = log.lastModified() - 5_000
|
||||
val armed = mapOf(log.canonicalPath to log.length())
|
||||
assertFalse(VacDiagnostics.writtenThisSession(log, since, armed))
|
||||
log.appendText("Connecting to 5.6.7.8\n")
|
||||
assertTrue(VacDiagnostics.writtenThisSession(log, since, armed))
|
||||
assertTrue(VacDiagnostics.writtenThisSession(log, since, emptyMap()))
|
||||
assertFalse(VacDiagnostics.writtenThisSession(log, log.lastModified() + 1_000, emptyMap()))
|
||||
} finally {
|
||||
log.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,6 +97,23 @@ class SteamStorageTest {
|
||||
assertEquals("GE-Proton11-9-aarch64", SteamStorage.compatToolName(vdf))
|
||||
}
|
||||
|
||||
@Test fun countsToolUseInBothClients() {
|
||||
assertEquals("GE-Proton11-9-a64", SteamStorage.x64ToolName("GE-Proton11-9-aarch64"))
|
||||
assertEquals("droiddeck-proton-a64", SteamStorage.x64ToolName("droiddeck-proton-arm64"))
|
||||
assertEquals("GE-Proton10-1", SteamStorage.x64ToolName("GE-Proton10-1"))
|
||||
val arm = SteamStorage.ToolUse(mapOf("0" to "droiddeck-proton-arm64", "10" to "GE-Proton11-9-aarch64", "20" to "GE-Proton11-9-aarch64"), setOf("10"))
|
||||
val x64 = SteamStorage.ToolUse(
|
||||
mapOf("0" to "GE-Proton11-9-a64", "30" to "GE-Proton11-9-a64", "40" to "droiddeck-direct", "50" to "GE-Proton11-9-aarch64"),
|
||||
setOf("30", "40", "50"), x64 = true,
|
||||
)
|
||||
assertEquals(1, arm.games("GE-Proton11-9-aarch64"))
|
||||
assertEquals(1, x64.games("GE-Proton11-9-aarch64"))
|
||||
assertFalse(arm.isDefault("GE-Proton11-9-aarch64"))
|
||||
assertTrue(x64.isDefault("GE-Proton11-9-aarch64"))
|
||||
assertTrue(arm.isDefault("droiddeck-proton-arm64"))
|
||||
assertFalse(x64.isDefault("droiddeck-proton-arm64"))
|
||||
}
|
||||
|
||||
@Test fun listingCountsPendingDownloadsAndUnreadableManifests() {
|
||||
val library = tmp.newFolder("lib")
|
||||
val apps = File(library, "steamapps").apply { mkdirs() }
|
||||
@@ -117,6 +134,19 @@ class SteamStorageTest {
|
||||
assertNull(SteamStorage.manifests(File(library, "missing")))
|
||||
}
|
||||
|
||||
@Test fun anEmptyX64FolderIsNoClient() {
|
||||
val root = tmp.newFolder("x64")
|
||||
File(root, ".cef-enable-remote-debugging").createNewFile()
|
||||
assertFalse(SteamStorage.x64ClientPresent(root))
|
||||
assertFalse(SteamStorage.x64ClientPresent(File(root, "missing")))
|
||||
File(root, "package").mkdirs()
|
||||
File(root, "package/droiddeck-installed").writeText("1\n")
|
||||
assertTrue(SteamStorage.x64ClientPresent(root))
|
||||
val bare = tmp.newFolder("x64-steamapps")
|
||||
File(bare, "steamapps").mkdirs()
|
||||
assertTrue(SteamStorage.x64ClientPresent(bare))
|
||||
}
|
||||
|
||||
@Test fun leftoverIdsSkipTheSharedPrefixAndShortcuts() {
|
||||
assertNull(SteamStorage.leftoverId("0"))
|
||||
assertNull(SteamStorage.leftoverId("3207321049"))
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.droiddeck.launcher.storage
|
||||
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import java.io.File
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33])
|
||||
class StorageScanTest {
|
||||
private val app get() = RuntimeEnvironment.getApplication()
|
||||
|
||||
@Test fun eachClientsLeftoversAreCheckedAgainstItsOwnGames() {
|
||||
SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "")
|
||||
val arm = SessionPrefs.steamRoot(app, "arm64")
|
||||
val x64 = SessionPrefs.steamRoot(app, "x86_64")
|
||||
File(arm, "steamapps/compatdata/10").mkdirs()
|
||||
File(arm, "steamapps/appmanifest_10.acf").writeText("\"appid\" \"10\"\n\"StateFlags\" \"4\"\n\"installdir\" \"Example\"\n")
|
||||
val removed = File(x64, "steamapps/compatdata/10").apply { mkdirs() }
|
||||
File(removed, "user.reg").writeText("x")
|
||||
|
||||
val report = StorageScan.scan(app)
|
||||
assertTrue(report.leftoversChecked)
|
||||
assertEquals(listOf(removed.path), report.leftovers.map { it.prefix?.path })
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Test
|
||||
|
||||
class FexVersionTest {
|
||||
@Test fun readsTheTagTheLauncherPins() {
|
||||
assertEquals("2610 r3", fexVersionOf("#!/bin/bash\nset -eu\nFEX_TAG=fex-2610-r3\nFEX_SHA256=abc\n"))
|
||||
}
|
||||
|
||||
@Test fun nothingWithoutAPinnedTag() {
|
||||
assertNull(fexVersionOf("FEX_TAG=\$1\n"))
|
||||
assertNull(fexVersionOf("# FEX_TAG=fex-2610-r3\n"))
|
||||
}
|
||||
|
||||
@Test fun theShippedLauncherHasOne() {
|
||||
val script = java.io.File("../tools/linuxfs/overlay/usr/local/bin/droiddeck-steam-x64").takeIf { it.isFile }
|
||||
?: java.io.File("tools/linuxfs/overlay/usr/local/bin/droiddeck-steam-x64")
|
||||
assertEquals(true, fexVersionOf(script.readText()) != null)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.test.assertCountEquals
|
||||
import androidx.compose.ui.test.onAllNodesWithTag
|
||||
import com.droiddeck.launcher.frontend.Library
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [34], qualifiers = "w1200dp-h752dp-land", application = android.app.Application::class)
|
||||
class GamesClientTagTest {
|
||||
@get:Rule val compose = createRobolectricComposeRule()
|
||||
|
||||
private val two = listOf(
|
||||
Library.SteamGame(440, "Team Fortress 2", null, "Steam library"),
|
||||
Library.SteamGame(70, "Half-Life", null, "Steam library"),
|
||||
)
|
||||
|
||||
@Test fun theArm64ClientsListHasNoTag() {
|
||||
show(two, x64 = false)
|
||||
compose.onAllNodesWithTag("games-client-x64").assertCountEquals(0)
|
||||
}
|
||||
|
||||
@Test fun theX8664ClientsListIsTagged() {
|
||||
show(two, x64 = true)
|
||||
compose.onAllNodesWithTag("games-client-x64").assertCountEquals(1)
|
||||
}
|
||||
|
||||
@Test fun anEmptyX8664LibraryIsTaggedToo() {
|
||||
show(emptyList(), x64 = true)
|
||||
compose.onAllNodesWithTag("games-client-x64").assertCountEquals(1)
|
||||
}
|
||||
|
||||
@Test fun aNarrowPaneStillShowsTheTag() {
|
||||
show(two, x64 = true, narrow = true)
|
||||
compose.onAllNodesWithTag("games-client-x64").assertCountEquals(1)
|
||||
}
|
||||
|
||||
private fun show(games: List<Library.SteamGame>, x64: Boolean, narrow: Boolean = false) {
|
||||
compose.mainClock.autoAdvance = false
|
||||
compose.setContent {
|
||||
DroidDeckTheme {
|
||||
CompositionLocalProvider(LocalFrontFocus provides FrontFocus(), LocalNarrowPane provides narrow) {
|
||||
FocusGlideHost {
|
||||
GamesPage(FrontEndState(
|
||||
installed = "r9", ready = true, available = null, busy = false, stage = "", percent = -1,
|
||||
desktopInstalled = true, offlineAccount = null, offline = false, frameGenLabel = "",
|
||||
romsDir = null, logsEnabled = false, steamGames = games, steamGamesX64 = x64, emulators = emptyList(), running = null,
|
||||
), FrontEndActions(
|
||||
onPlay = {}, onPlaySteamVr = {}, onPlayDesktopUi = {}, onSteamGame = {}, onDesktop = {}, onEmulator = {},
|
||||
onRom = {}, onResume = {}, onSteamSettings = {}, onDesktopSettings = {},
|
||||
onInstallPackage = {}, onRemovePackage = {}, onRuntime = {}, onFrameGenPick = {},
|
||||
onImportLossless = {}, onProtons = {}, onComponents = {}, onPerformance = {},
|
||||
onRoms = {}, onFiles = {}, onLogs = {}, onOffline = {},
|
||||
onWirelessAdbPair = { _, _, _, _ -> }, onWirelessAdbApply = { _, _, _, _ -> },
|
||||
onSetPhantomProcessLimit = { _, _ -> },
|
||||
), selected = "app:440", onSelect = {}, modifier = Modifier.fillMaxSize())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
compose.mainClock.advanceTimeBy(2_000)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user