This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-13 21:27:42 -04:00
1 parent 5fd47421f9
commit aecd2ebe1d
852 files changed
+4844 -46144

No files matched your search

@@ -61,7 +61,6 @@ class BatteryComponentTest {
val discovered = supplies.listFiles()!!.filter { it.name.contains("BAT") }
assertEquals(listOf("BAT1"), discovered.map { it.name })
fun read(name: String) = File(discovered.single(), name).readText().trim().toLong()
// One 4 Ah battery at 4 V drawing 2 A: 8 W and two hours, regardless of vendor current sign.
assertEquals(8_000_000L, read("power_now"))
assertEquals(16_000_000L, read("energy_now"))
assertEquals(7200L, read("time_to_empty_now"))
@@ -60,7 +60,6 @@ class GameEnvironmentStoreTest {
"d3d9.samplerAnisotropy = 16; d3d11.samplerAnisotropy = 16; d3d9.samplerLodBias = -0.58; d3d11.samplerLodBias = -0.58",
json.getString(GameEnvironmentStore.DXVK_CONFIG),
)
// The user's own entry is untouched; the launcher appends the options at launch.
assertEquals("dxvk.tearFree = True", json.getJSONObject("shared").getString("DXVK_CONFIG"))
assertEquals(GameEnvironment.Config(shared = mapOf("DXVK_CONFIG" to "dxvk.tearFree = True")), GameEnvironmentStore.read(context))
SessionPrefs.setTextureAnisotropy(context, 0)
@@ -102,7 +102,6 @@ class ProtonExtrasTest {
assertTrue(ProtonExtras.compareVersions("DroidDeck-Proton 11-7", "DroidDeck-Proton 11-7.1") < 0)
assertTrue(ProtonExtras.compareVersions("cachyos-11.0-20260703-slr", "cachyos-11.0-20261005-slr") < 0)
assertTrue(ProtonExtras.compareVersions("cachyos-10.0-sunset-slr", "cachyos-11.0-20260601-slr") < 0)
// The architecture in a folder name is not part of its version.
assertEquals(listOf(11L, 7L), ProtonExtras.versionKey("GE-Proton11-7-aarch64"))
assertEquals(listOf(11L, 0L, 20261005L), ProtonExtras.versionKey("proton-cachyos-11.0-20261005-slr-arm64"))
assertEquals(listOf(11L, 7L, 5L), ProtonExtras.versionKey("DroidDeck-Proton 11-7.5"))
@@ -114,9 +113,8 @@ class ProtonExtrasTest {
val tools = temp.newFolder("compatibilitytools.d")
for (name in listOf("GE-Proton11-10", "GE-Proton11-9", "DroidDeck-Proton 11-7.10", "DroidDeck-Proton 11-7.5",
"droiddeck-proton-arm64", "droiddeck-proton-11-arm64", "proton-cachyos-11.0-20261005-slr-arm64")) installTool(tools, name)
File(tools, "DroidDeck-Proton 11-6").mkdirs() // no manifest: half unpacked, not installed
File(tools, "DroidDeck-Proton 11-6").mkdirs()
assertEquals(listOf("GE-Proton11-9", "GE-Proton11-10"), ProtonExtras.installedIn(tools, tool("ge")))
// Ours, not DroidDeck's own droiddeck-proton-* tools: the prefix is matched with its case.
assertEquals(listOf("DroidDeck-Proton 11-7.5", "DroidDeck-Proton 11-7.10"), ProtonExtras.installedIn(tools, tool("droiddeck")))
assertEquals(listOf("proton-cachyos-11.0-20261005-slr-arm64"), ProtonExtras.installedIn(tools, tool("cachyos")))
assertEquals(emptyList<String>(), ProtonExtras.installedIn(File(tools, "missing"), tool("ge")))
@@ -149,13 +147,11 @@ class ProtonExtrasTest {
.put("cachyos", JSONObject().put("tag", "cachyos-11.0-20261005-slr").put("at", now - 60_000))
.put("droiddeck", JSONObject().put("tag", "DroidDeck-Proton-11-7.6").put("at", now - ProtonExtras.CHECK_EVERY_MS + 60_000))
File(context.filesDir, "proton-latest.json").writeText(latest.toString())
// Every source was looked up within the last six hours: nothing goes to GitHub.
assertFalse(ProtonExtras.checkLatest(context, now = now))
assertEquals("DroidDeck-Proton-11-7.6", ProtonExtras.update(context, tool("droiddeck")))
assertNull(ProtonExtras.update(context, tool("ge")))
assertNull(ProtonExtras.update(context, tool("cachyos")))
assertEquals(listOf("DroidDeck-Proton 11-7.5"), ProtonExtras.installedTags(context, tool("droiddeck")))
// The tag recorded at install stands for the folder.
File(context.filesDir, "proton-extras.json").writeText(JSONObject().put("DroidDeck-Proton 11-7.5", "DroidDeck-Proton-11-7.6").toString())
assertEquals(listOf("DroidDeck-Proton-11-7.6"), ProtonExtras.installedTags(context, tool("droiddeck")))
assertNull(ProtonExtras.update(context, tool("droiddeck")))
@@ -168,7 +164,6 @@ class ProtonExtrasTest {
for (name in listOf("DroidDeck-Proton 11-7.5", "DroidDeck-Proton 11-7.6", "DroidDeck-Proton 11-7.10", "GE-Proton11-7")) installTool(tools, name)
ProtonExtras.remove(context, tool("droiddeck"), "DroidDeck-Proton 11-7.6")
assertEquals(listOf("DroidDeck-Proton 11-7.5", "DroidDeck-Proton 11-7.10"), ProtonExtras.installedAll(context, tool("droiddeck")))
// A folder of another source is never removed through this one.
ProtonExtras.remove(context, tool("droiddeck"), "GE-Proton11-7")
assertTrue(File(tools, "GE-Proton11-7").isDirectory)
assertEquals(listOf("DroidDeck-Proton 11-7.5", "DroidDeck-Proton 11-7.10"), ProtonExtras.installedAll(context, tool("droiddeck")))
@@ -36,7 +36,6 @@ class QuestExperimentalTest {
@Test fun quest2SelectsA6xxInsteadOfQuest3DriverAndPreservesLaterChoices() {
ShadowBuild.setModel("Quest 2")
// A prior Quest 3 flag must not suppress Quest 2's own migration.
context.getSharedPreferences("session", Context.MODE_PRIVATE).edit()
.putBoolean("questDefaultsV1", true).commit()
QuestExperimental.initialize(context)
@@ -164,7 +164,6 @@ class RumbleComponentTest {
}
private fun effect(strong: Int = 65535, weak: Int = 65535, slot: Int = 0) {
// Inject a decoded force-feedback packet; transport is outside these tests.
val int = Int::class.javaPrimitiveType
RumbleComponent::class.java.getDeclaredMethod("buzz", int, int, int, int)
.apply { isAccessible = true }.invoke(rumble, strong, weak, 5000, slot)
@@ -12,16 +12,12 @@ class SessionDisplayTest {
}
@Test fun heightPresetsKeepThePanelShapeWithASixteenByNineFloor() {
// 20:9 phone: edge to edge, no bars for the client's interface.
assertEquals(1600 to 720, SessionDisplay.resolveChoice(2400 to 1080, SessionDisplay.DEFAULT_RESOLUTION))
assertEquals(1608 to 720, SessionDisplay.resolveChoice(2412 to 1080, "720p"))
// 1440p phone: bounded by the preset height, not the panel.
assertEquals(1560 to 720, SessionDisplay.resolveChoice(3120 to 1440, "720p"))
assertEquals(2340 to 1080, SessionDisplay.resolveChoice(3120 to 1440, "1080p"))
// Foldable inner panel and 4:3 handhelds: never narrower than 16:9.
assertEquals(1280 to 720, SessionDisplay.resolveChoice(2208 to 1840, "720p"))
assertEquals(1280 to 720, SessionDisplay.resolveChoice(1440 to 1080, "720p"))
// Never taller than the panel.
assertEquals(1280 to 720, SessionDisplay.resolveChoice(1280 to 720, "1080p"))
}
@@ -39,10 +35,8 @@ class SessionDisplayTest {
}
@Test fun unfoldedControlsKeepTheGameSixteenByNineAcrossTheWidth() {
// Fold inner screen held as a tablet, and upright: 16:9 either way, the controls the rest.
assertEquals(1376, SessionDisplay.unfoldedGameHeight(2448, 1848))
assertEquals(1038, SessionDisplay.unfoldedGameHeight(1848, 2448))
// A window near 16:9 itself still leaves the controls a fifth of it.
assertEquals(864, SessionDisplay.unfoldedGameHeight(1920, 1080))
}
@@ -27,7 +27,6 @@ class SessionLogShareTest {
z.entries().toList().associate { it.name.substringAfter('/') to z.getInputStream(it).bufferedReader().readText() }
}
/** A record as the session's ending writes it, listing [files] as they stand now. */
private fun record(folder: File, vararg files: String, rules: Int = LogRedactor.RULES_VERSION) {
File(folder, SessionArtifacts.SCRUBBED_TREE_MARKER).writeText(
"rules $rules\n" + files.joinToString("") { val f = File(folder, it); "${f.length()}\t${f.lastModified()}\t$it\n" })
@@ -35,8 +34,6 @@ class SessionLogShareTest {
@Test fun aRecordedUnchangedFileIsScrubbedAgainOnTheWayIntoTheZip() {
val folder = tmp.newFolder("2026-10-06-01-steam")
// A file the ending recorded as scrubbed still gets the share's final pass: the record
// may predate a rule, and a zip is the one way a log leaves the device.
File(folder, "session.log").writeText("$secret\n")
record(folder, "session.log")
assertFalse(zip(folder).getValue("session.log").contains(leaked))
@@ -50,7 +47,6 @@ class SessionLogShareTest {
File(folder, "steam/deep/nested.txt").writeText("$secret\n")
File(folder, ".hidden.txt").writeText("$secret\n")
record(folder, "app.log", "session.log")
// Appended to after the ending (the app's log capture), and touched with an older time.
File(folder, "app.log").appendText("$secret\n")
File(folder, "session.log").apply { writeText("$secret\n".padEnd(3, ' ')); setLastModified(1_000L) }
File(folder, "events.jsonl").writeText("$secret\n")
@@ -109,7 +105,6 @@ class SessionLogShareTest {
@Test fun aFileThatCouldNotBeScrubbedLeavesTheFolderUnrecorded() {
val folder = tmp.newFolder("2026-10-06-06-steam")
File(folder, "session.log").writeText("$secret\n")
// A folder the scrubbed copy cannot be written into: the scrub fails, the original stays.
folder.setWritable(false)
try {
SessionArtifacts.scrubAndMark(folder)
@@ -12,7 +12,6 @@ import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
/** A shared zip is scrubbed on the way in, whatever the files on disk still hold. */
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [33])
class SessionLogShareZipTest {
@@ -21,7 +20,6 @@ class SessionLogShareZipTest {
@Test fun everyTextFileInTheZipIsScrubbedAndTheStoresAndToolsLogsComeAlong() {
val logs = LinuxRuntime.logDir(app)
val session = File(logs, "2026-10-08-01-steam").apply { mkdirs() }
// Written raw, as a file from before a rule existed would be.
File(session, "session.log").writeText(
"fetch https://gog-cdn-fastly.gog.com/token=nva=1791500000~dirs=/x~token=0a1b2c3d4e5f/content-system/v2/store/1/ab/cd/f\n" +
"fetch https://epicgames-download1.akamaized.net/Builds/Org/a/ChunksV4/12/ABCD.chunk?__token__=exp=1~hmac=deadbeefcafe\n" +
@@ -40,7 +38,6 @@ class SessionLogShareZipTest {
for (secret in listOf("0a1b2c3d4e5f", "deadbeefcafe", "abcdef123456", "someone@example.com", "AUTHCODE123", "abc.def.ghi", "zzzzzzzz12", "eyabc")) {
assertFalse("$secret survived", all.contains(secret))
}
// What makes a log worth reading stays.
assertTrue(all.contains("kept: EResult 5, app 1086940, steamapps/common/Game"))
assertTrue(all.contains("https://gog-cdn-fastly.gog.com/"))
@@ -53,9 +50,6 @@ class SessionLogShareZipTest {
assertEquals(line, com.droiddeck.launcher.core.LogRedactor.redactForShare(line))
}
// Folders an earlier build scrubbed and marked under older rules, their copied Steam UI log
// still naming the account: one app start (the move out of Download/, then the pass over
// older folders) leaves every one scrubbed on disk under the current rules.
private fun olderFolder(parent: File, name: String, marker: String = ".scrubbed-2"): File {
val dir = File(parent, name).apply { mkdirs() }
File(dir, marker).writeText("scrubbed earlier\n")
@@ -91,12 +85,10 @@ class SessionLogShareZipTest {
val legacy = LinuxRuntime.legacyLogDir().apply { mkdirs() }
val names = (1..9).map { "2026-10-0${it}-01-steam" }
names.forEachIndexed { i, name ->
// Old markers of every kind an earlier build left, one even claiming the current rules.
olderFolder(legacy, name, marker = listOf(".scrubbed-2", ".scrubbed-1", ".scrubbed-r${com.droiddeck.launcher.core.LogRedactor.RULES_VERSION}")[i % 3])
}
File(legacy, "Saves").apply { mkdirs() }.resolve("keep.txt").writeText("save\n")
// What MainActivity runs at start.
LogMigration.run(app)
SessionArtifacts.scrubOlder(app)
@@ -79,13 +79,11 @@ class SteamDownloadMonitorTest {
var now = 1_000L
assertTrue(monitor.poll(root, now, received))
// Five minutes of a download Steam no longer logs, at 4 MB/s.
while (now < 300_000L) {
now += 2_000L
received += 8_000_000L
assertTrue(monitor.poll(root, now, received))
}
// Traffic stops: the session may suspend once the grace runs out.
assertTrue(monitor.poll(root, now + 90_000L, received))
assertFalse(monitor.poll(root, now + 92_001L, received))
@@ -42,7 +42,6 @@ class SteamLanguageTest {
assertEquals("latam", steam("es-MX"))
assertEquals("latam", steam("es-419"))
assertEquals("spanish", steam("es-ES"))
// The app's Spanish has no region; the system's says where the player is.
assertEquals("latam", steam("es", region = "AR"))
assertEquals("spanish", steam("es", region = "ES"))
}
@@ -23,7 +23,6 @@ class WinComponentsSupportTest {
@Test fun windowsInstallerPackagesInstallHere() {
assertEquals(Support.READY, support(component("xna40", step("install_msi", "url" to "$base/xna40.msi"))))
// The catalog names some .msi packages install_exe.
assertEquals(Support.READY, support(component("XLiveRedist",
step("install_exe", "url" to "$base/XLiveRedist.msi", "file_name" to "XLiveRedist1.2.0238.msi"))))
assertEquals(Support.READY, support(component("msxml3", step("delete_dlls", "dest" to "win32"),
@@ -33,12 +32,10 @@ class WinComponentsSupportTest {
}
@Test fun installerWrappersInstallHere() {
// A WiX bundle, a self-extracting cabinet or 7-Zip archive: the packages inside are laid out.
assertEquals(Support.READY, support(component("vcredist2022",
step("install_exe", "url" to "$base/vcredist2022__VC_redist.x86.exe", "file_name" to "VC_redist.x86.exe"),
step("install_exe", "url" to "$base/vcredist2022__VC_redist.x64.exe", "file_name" to "VC_redist.x64.exe"),
step("override_dll", "dll" to "vcruntime140", "type" to "native,builtin"))))
// .NET Framework: "uninstall Wine Mono", the Windows version, the installer, a registry key.
assertEquals(Support.READY, support(component("dotnet40",
step("uninstall", "file_name" to "Wine Mono"), step("set_windows", "version" to "win7"),
step("install_exe", "url" to "https://download.microsoft.com/x/dotNetFx40_Full_x86_x64.exe", "file_name" to "dotNetFx40_Full_x86_x64.exe"),
@@ -48,7 +45,6 @@ class WinComponentsSupportTest {
}
@Test fun nestedCatalogKeysAreRead() {
// A few .NET entries keep url and file_name under "environment".
val nested = WinComponents.Step("install_exe", JSONObject().put("environment", JSONObject()
.put("WINEDLLOVERRIDES", "fusion=b").put("file_name", "ndp48-x86-x64-allos-enu.exe")
.put("url", "https://download.visualstudio.microsoft.com/x/ndp48-x86-x64-allos-enu.exe")))
@@ -67,14 +63,11 @@ class WinComponentsSupportTest {
@Test fun recordedInstallersInstallHere() {
val snapshot = "https://github.com/Droid-Deck/DroidDeck-Components/releases/download/component-snapshots-v1/K-Lite.snapshot.json"
// A setup program with a recording of its result installs from the recording.
val klite = WinComponents.Component("K-Lite", "", "", "ready", emptyList(),
listOf(step("install_exe", "url" to "$base/K-Lite.exe", "file_name" to "K-Lite_1960.exe")), snapshot)
assertEquals(Support.READY, WinComponents.support(klite, mapOf(klite.name to klite)))
// Only a recording on the release counts.
val elsewhere = WinComponents.Component("K-Lite", "", "", "ready", emptyList(), klite.steps, "http://example.com/K-Lite.snapshot.json")
assertEquals(Support.NEEDS_INSTALLER, WinComponents.support(elsewhere, mapOf(elsewhere.name to elsewhere)))
// Its prerequisites still have to be installable.
val sp1 = WinComponents.Component("dotnet20sp1", "", "", "ready", listOf("dotnet20"), emptyList(), snapshot.replace("K-Lite", "dotnet20sp1"))
val base20 = WinComponents.Component("dotnet20", "", "", "ready", emptyList(),
listOf(step("install_exe", "url" to "$base/dotnet20__dotnetfx.exe", "file_name" to "dotnetfx.exe")))
@@ -82,7 +75,6 @@ class WinComponentsSupportTest {
}
@Test fun setupProgramsStillWait() {
// NSIS / InnoSetup installers hold no package to lay out.
assertEquals(Support.NEEDS_INSTALLER, support(component("K-Lite",
step("install_exe", "url" to "$base/K-Lite.exe", "file_name" to "K-Lite_1960.exe"))))
assertEquals(Support.NEEDS_INSTALLER, support(component("plain", step("install_msi", "url" to "http://example.com/a.msi"))))