chore: remove source comments and unused code, translate every missing string (#1965)

* chore(i18n): translate every missing string in all locales

Adds the 87 strings the bottom-screen Dashboard and in-game stats pages
introduced to all 32 locales, plus the 51 older settings strings Japanese
and the 50 Chinese locales were still missing. Every locale now has all
3456 translatable strings with the same placeholders as English.

Also translates 36 entries that were still English where the language
does not use the English word, and makes es-419 touch_app_id use the same
%1$s placeholder as English.

* chore(patches): drop comments from the lines downstream patches add

Removes comment lines and trailing comments from lines our patches add,
with hunk headers recounted. Lines that a later patch uses as context
and the upstream backport 0123 are left as they are.

The gamescope, FEX, proot and xodus series still apply to their pinned
sources, and the patched trees differ only in those comments.
test_hud_frames now finds the HUD writer by its first declaration.

* docs: credit Greenlight, Better xCloud, viture-v2, GameNative and DiRTTelemetryErrorFix

These were credited only in source headers and NOTICE files.

* chore: remove source comments and unused functions

Removes explanatory comments from first-party Kotlin, Java, C, C++,
Rust, TypeScript, Python, shell, Gradle, CMake and workflow files.
License and attribution headers stay, and vendored third-party trees,
generated files and license files are untouched. A shellcheck directive
is kept, and udevmon's fallthrough comments became fallthrough attributes.

Syntax trees and token streams match the previous sources apart from the
comments and Python docstrings. Module docstrings that argparse prints
are kept, and device-smoke.sh prints the same --help text from a heredoc.

Also removes 37 functions and 4 fields that nothing referenced.

* chore: remove comments from the Syncthing integration and the latest main sources

* docs: credit Syncthing and the syncthing-android fork

* chore(i18n): translate the Syncthing strings in all locales

The 107 strings the Syncthing integration added are now in all 32 locales.
sync_web_path_locked names the Syncthing tab by its label.

* docs: credit @xXJSONDeruloXx for the HUD metric readers

The CPU, GPU load, thermal and battery readers come from their
PerformanceHudView pull requests #777, #877, #991, #1406 and #1573.
The FusionHUD credit line is unchanged.

* docs: credit the HUD metric readers to @xXJSONDeruloXx's work
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-01 16:27:27 -05:00
1 parent d730f0fa8b
commit c5577478ca
511 files changed
+6813 -4068

No files matched your search

@@ -17,11 +17,6 @@ import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
/**
* A download that was cut off keeps its bytes, and a second call with `resume` asks for the rest
* with a Range header instead of starting again. The server is a plain socket so the first answer
* can promise the whole file and then hang up halfway.
*/
class DownloaderResumeTest {
private val data = ByteArray(300_000) { (it % 251).toByte() }
private val cutAt = 100_000
@@ -43,11 +38,9 @@ class DownloaderResumeTest {
try {
while (!server.isClosed) {
val socket = server.accept()
// the client may hang up on a body it refuses; that must not stop the server
runCatching { handle(socket) }
}
} catch (_: Exception) {
// closed by tearDown
}
}.apply { isDaemon = true; start() }
}
@@ -72,7 +65,6 @@ class DownloaderResumeTest {
val content = if (corrupt && "/corrupt" in path) ByteArray(data.size) else data
val from = range?.removePrefix("bytes=")?.substringBefore('-')?.toIntOrNull()
if (misbehave) {
// answers a Range request with a 206 that starts at 0, and serves plain requests whole
val start = if (from == null) "200 OK" else "206 Partial Content"
val extra = if (from == null) "" else "Content-Range: bytes 0-${data.size - 1}/${data.size}\r\n"
out.write("HTTP/1.1 $start\r\n${extra}${validator}Content-Length: ${data.size}\r\nConnection: close\r\n\r\n".toByteArray())
@@ -89,7 +81,6 @@ class DownloaderResumeTest {
out.write("HTTP/1.1 200 OK\r\n${validator}Content-Length: ${data.size}\r\nConnection: close\r\n\r\n".toByteArray())
out.write(content, 0, cutAt)
out.flush()
// hang up with most of the promised body still unsent
} else {
val rest = data.size - from
out.write(("HTTP/1.1 206 Partial Content\r\nContent-Range: bytes $from-${data.size - 1}/${data.size}\r\n" +
@@ -187,7 +178,6 @@ class DownloaderResumeTest {
val target = File(dir, "runtime.tar.zst")
misbehave = true
val polls = java.util.concurrent.atomic.AtomicInteger()
// candidate selection and attempt each check once before the request; later checks follow chunks
val cancelled = java.util.function.BooleanSupplier { polls.incrementAndGet() > 2 }
assertFalse(Downloader.downloadCandidates(first, listOf(first, second), target, true, null, cancelled, null))
assertEquals("a cancel must not fall back to the next source", listOf<String?>(null), requests.toList())
@@ -93,7 +93,6 @@ class GlassesDisplayTest {
@Test fun gtMaxSmartGlassesEdidUsesTheSameOutputSelectionAsViture() {
val panel = display("SmartGlasses", productName = "SmartGlasses", productId = "980")
assertEquals(panel.displayId, Glasses.selectGlassesDisplay(listOf(panel), usbPresent = true)?.displayId)
// The display remains usable while USB control reconnects during a mode switch.
assertEquals(panel.displayId, Glasses.selectGlassesDisplay(listOf(panel), usbPresent = false)?.displayId)
}
@@ -126,7 +125,6 @@ class GlassesDisplayTest {
}
}
// Robolectric exposes display names and flags, but has no product-metadata setter.
@Implements(Display::class)
class ProductMetadataDisplay : ShadowDisplay() {
var productMetadata: DeviceProductInfo? = null
@@ -63,7 +63,6 @@ class GlassesMenuProjectionTest {
private object GlassesMenuProjection {
data class Uv(val x: Float, val y: Float)
// Row-major head-to-anchor rotation; +Y is up, -Z is forward, output UV starts at the top left.
fun intersect(frame: GlassesMenuPose.Frame, rayX: Float, rayY: Float, eye: Float,
halfWidth: Float, distance: Float, aspect: Float): Uv? {
if (frame.rotation.size != 9 || frame.position.size != 3 || frame.rotation.any { !it.isFinite() } ||
@@ -30,7 +30,6 @@ class GlassesOutputHandoffTest {
private lateinit var screen: GlassesScreen
@Before fun setup() {
// Exercise the output lifecycle without starting the native Linux runtime.
activity = Robolectric.buildActivity(SessionActivity::class.java).get()
phone = SurfaceView(activity)
ReflectionHelpers.setField(activity, "surfaceView", phone)
@@ -46,7 +45,7 @@ class GlassesOutputHandoffTest {
@Test fun selectingGlassesDoesNotHidePhoneOrClaimOutputBeforeAttachment() {
assertFalse(active())
assertEquals(View.VISIBLE, phone.visibility)
attach(phone.holder) // A late phone callback must not complete the handoff.
attach(phone.holder)
assertFalse(active())
assertEquals(View.VISIBLE, phone.visibility)
}
@@ -183,11 +183,11 @@ class GlassesRenderingTest {
picture3d = GlassesSettings.PICTURE_SCREEN)
for (state in listOf(ultra.copy(displayId = -1), GlassesState())) {
val preview = GlassesRendering.cardboard(base, settings, state, false, true)
assertTrue(preview.enabled) // Published as headset proximity, preventing standby.
assertTrue(preview.enabled)
assertTrue(preview.mono)
assertEquals(Cardboard.SOURCE_SBS, preview.source)
assertEquals(Cardboard.Viewer.NONE.id, preview.viewer)
assertTrue(preview.headTracking) // Phone preference, not dormant glasses settings.
assertTrue(preview.headTracking)
assertFalse(base.enabled)
assertSame(base, GlassesRendering.cardboard(base, settings, state, false, false))
}
@@ -251,8 +251,6 @@ class GlassesSteamVrTest {
.set(activity, LoadingState(activity).apply { visible = false })
SessionState.steamVr = true
SessionState.mode = SessionService.MODE_STEAM
// Hold the external worker so status transitions can be exercised
// without launching a Linux runtime from the host test process.
val worker = SessionActivity::class.java.getDeclaredField("steamVrWorker")
.apply { isAccessible = true }.get(null) as ThreadPoolExecutor
val blocked = CountDownLatch(1)
@@ -115,8 +115,6 @@ class RayNeoCalibrationTest {
val upright = RayNeoOrientationFilter(profile.rotationXDeg, profile.gtMaxAxes, saved)
.update(sample(floatArrayOf(-0.02f, 8.819f, 4.106f), reading.gyroDps))
assertArrayEquals(floatArrayOf(1f, 0f, 0f, 0f), upright, 0.001f)
// This was the reported failure: the same physical pose cannot calibrate
// through the Max's permutation and 35-degree mounting correction.
assertNull(finish(RayNeoCalibrationCollector(RayNeoSensorAxes(35f, true), 0), sample = reading))
}
@@ -102,7 +102,6 @@ class RayNeoLinkTest {
val cmd = bytes[1].toInt() and 0xff
commands += cmd
if (gtTraffic && cmd in listOf(0, 1)) {
// Notifications and unrelated ACKs can precede the requested response.
for (other in listOf(0x08, 6, 7, 0x50)) {
responses += ByteArray(64).apply {
this[0] = 0x99.toByte(); this[1] = 0xc8.toByte(); this[2] = 64
@@ -79,8 +79,6 @@ class RayNeoOrientationFilterTest {
val first = screen(filter.update(sample(0, level)))
val ref = HeadPose.recenter(first)
var q = FloatArray(4)
// Physical 30-degree turn over one second, through the complete shared
// VITURE conversion and recenter pipeline. GT signs match device captures.
repeat(100) { i ->
val a = Math.toRadians((i + 1) * 0.3)
val accel = when (axis) {
@@ -116,7 +116,7 @@ class RayNeoProtocolTest {
@Test fun tickWrapDoesNotIntroduceOrientationJump() {
val filter = RayNeoOrientationFilter(0f)
filter.update(sample(0xfffffff0L, 90f))
val q = filter.update(sample(84, 90f)) // 100 ticks = 10ms across uint32 rollover.
val q = filter.update(sample(84, 90f))
assertEquals(kotlin.math.sin(Math.PI * 0.005).toFloat(), q[2], 1e-4f)
}
}
@@ -71,8 +71,8 @@ class VitureSdkTest {
val s = kotlin.math.sin(Math.PI / 12).toFloat()
val c = kotlin.math.cos(Math.PI / 12).toFloat()
for ((axis, expected) in listOf(
2 to floatArrayOf(-0.5f, 0f, -0.8660254f), // Observed left turn: positive Y.
1 to floatArrayOf(0f, 0.5f, -0.8660254f), // Observed upward look: positive X.
2 to floatArrayOf(-0.5f, 0f, -0.8660254f),
1 to floatArrayOf(0f, 0.5f, -0.8660254f),
3 to floatArrayOf(-0.5f, 0.8660254f, 0f),
)) {
val q = floatArrayOf(c, 0f, 0f, 0f).apply { this[axis] = s }
@@ -84,7 +84,6 @@ class VitureSdkTest {
@Test fun ultraOpenGlAxesMatchExistingGlassesHeadTracker() {
val a = sqrt(0.5f)
// OpenGL Y yaw maps to NWU Z; OpenGL X pitch maps to negative NWU Y.
assertArrayEquals(floatArrayOf(0f, 0f, a, a),
VitureSdkPose.toGlasses(floatArrayOf(a, 0f, a, 0f), true), 0.00001f)
assertArrayEquals(floatArrayOf(0f, -a, 0f, a),
@@ -1,5 +1,4 @@
// Fixtures adapted from elasticjava/viture-v2, MIT, Copyright (c) 2026 Holger Bartnick.
// Source: ece8c30485f7d357fefa362ae74f3eabac9b3899; see docs/third-party/viture-v2/.
// Fixtures adapted from elasticjava/viture-v2, MIT, Copyright (c) 2026 Holger Bartnick. Source: ece8c30485f7d357fefa362ae74f3eabac9b3899; see docs/third-party/viture-v2/.
package com.droiddeck.launcher.glasses
import org.junit.Assert.assertArrayEquals
@@ -63,10 +63,8 @@ class XrealOrientationFilterTest {
@Test fun capturedNeutralGravityStartsUprightBeforeRecenter() {
val pose = XrealOrientationFilter().update(sample(1000000,
accel = Vec3(-0.0909f, -9.6529f, -1.0731f)))!!
// An upright start must not contain the previous approximately 180-degree
// pitch correction. Check before recenter can hide a mounting error.
assertTrue(kotlin.math.abs(pose[3]) > 0.99f)
val screen = matrix(pose)
assertTrue(screen[7] > 0.99f) // Screen up points toward shared world +Z.
assertTrue(screen[7] > 0.99f)
}
}
@@ -93,7 +93,6 @@ class XrealProtocolTest {
assertEquals(0x2822, XrealProtocol.read(requests).command)
repeat(3) { assertEquals(0x275e, XrealProtocol.read(requests).command) }
assertEquals(0, requests.available())
// Actual 1S busy response remains an error, never a successful ack.
assertFalse(XrealProtocol.acknowledged(byteArrayOf(0x22, 3, 8, 0x89.toByte(), 0x27)))
}
@@ -28,7 +28,6 @@ class GpuDetectionTest {
}
@Test fun nonAdrenoRenderersAreNeverAdrenoWhateverNumberTheyCarry() {
// Xclipse (Exynos), Mali and Immortalis names; familyOf ignores the number off Adreno.
assertEquals(Family.NOT_ADRENO, GpuInfo.familyOf(false, 0))
assertEquals(Family.NOT_ADRENO, GpuInfo.familyOf(false, GpuInfo.threeDigits("Samsung Xclipse 920")))
assertEquals(Family.NOT_ADRENO, GpuInfo.familyOf(false, GpuInfo.threeDigits("Xclipse 940")))
@@ -17,7 +17,7 @@ class SteamVrDeviceLossLogTest {
assertFalse(log.poll())
file.appendText("-4\n")
assertTrue(log.poll())
assertTrue(log.poll()) // Keep pending until the activity is foreground.
assertTrue(log.poll())
}
@Test fun onlyExplicitDeviceLossTriggersRecovery() {
@@ -8,7 +8,6 @@ import org.junit.Test
import kotlin.random.Random
class FrameStatsTest {
/** MangoHud's update_hud_info_with_frametime and fps()/frame_timing(), line by line (overlay.cpp). */
private class Mango {
val frametimeData = ArrayList<Float>(List(200) { 0f })
var lastPresentTime = 0L
@@ -18,12 +18,10 @@ class MangoReadingsTest {
@Test fun cpuLoadFollowsMangoHudsFormulaAndTruncates() {
val stat = File(tmp.root, "stat")
val m = readings()
// user nice system idle iowait irq softirq steal guest guest_nice
stat.writeText("cpu 1000 100 500 8000 400 50 50 0 200 0\ncpu0 500 50 250 4000 200 25 25 0 100 0\ncpu1 500 50 250 4000 200 25 25 0 100 0\nintr 0\n")
m.cpu(stat)
stat.writeText("cpu 1500 100 700 8600 500 60 70 10 300 0\ncpu0 900 50 400 4100 250 30 35 10 200 0\ncpu1 600 50 300 4500 250 30 35 0 100 0\nintr 0\n")
val cpu = m.cpu(stat)!!
// busy = user-guest 400 + nice 0 + system+irq+softirq 230 + steal 10 + guest 100 = 740 of 1440 (idle+iowait 700)
assertEquals((740 * 100f / 1440).toInt(), cpu.percent)
assertEquals(51, cpu.percent)
assertArrayEquals(intArrayOf(((300 + 165 + 10 + 100) * 100f / (300 + 165 + 10 + 100 + 150)).toInt(), ((100 + 65) * 100f / (100 + 65 + 550)).toInt()), cpu.perCore)
@@ -738,7 +738,7 @@ class TouchscreenGesturesTest {
@Test fun pinchReversalDoesNotConsumeOldDirectionRemainder() {
startPinch()
events.clear()
movePinch(4.5f) // Nine pixels toward zooming in, short of a step.
movePinch(4.5f)
assertTrue(events.none { it.startsWith("wheel") })
for (i in 1..10) movePinch(4.5f - i * .5f)
assertEquals(listOf("wheel 1"), events.filter { it.startsWith("wheel") })
@@ -794,16 +794,13 @@ class TouchscreenGesturesTest {
override fun moveTo(x: Float, y: Float) { cachedX = x; clientX = x }
override fun prepareRelativePan() { cachedX = 960f; clientX = 960f }
override fun moveBy(dx: Float, dy: Float, relative: Boolean) {
// Before pointer lock, the compositor delivers an absolute
// position even when we inject a relative delta. The game
// only requests lock after seeing this first pan movement.
cachedX += dx
clientX = cachedX
}
override fun button(code: Int, down: Boolean) {
if (code == 274) {
middleDown = down
if (down) clientX = 960f // The client warps to the middle when pan starts.
if (down) clientX = 960f
}
}
override fun key(code: Int, down: Boolean) {}
@@ -29,7 +29,6 @@ class BootMovieLibraryTest {
private fun movie(name: String) = File(movies, name).also { it.parentFile!!.mkdirs(); it.writeText("movie") }
/** A movie DroidDeck itself imported: kept in the library, copied into Steam's folder and noted in the list. */
private fun imported(title: String, source: String = BootMovieLibrary.SOURCE_IMPORT, repo: String? = null): String {
val staged = File(BootMovieLibrary.libraryDir(app), ".t-${System.nanoTime()}-${Thread.currentThread().id}.staged").also { it.parentFile!!.mkdirs(); it.writeText("movie") }
return BootMovieLibrary.commit(app, staged, title, source, repo)!!
@@ -258,11 +257,9 @@ class BootMovieLibraryTest {
steamPicks("b.webm")
assertTrue(BootMovie.syncFromSteam(app))
assertEquals("file:b.webm", BootMovie.choice(app))
// Picking another one here is not undone by the same Steam setting.
BootMovie.select(app, "file:a.webm")
assertFalse(BootMovie.syncFromSteam(app))
assertEquals("file:a.webm", BootMovie.choice(app))
// A new pick inside Steam is adopted again.
movie("c.webm")
steamPicks("c.webm")
assertTrue(BootMovie.syncFromSteam(app))
@@ -55,11 +55,9 @@ class ComponentsNightlyCatalogTest {
val nVkEc = item("DD-vkd3d-proton-arm64ec-3.0.1+455-nightly.wcp", "vkd3d", n)
val pairs = ComponentsManager.nightlyPairs(listOf(dxvk, ec, gpl, fex, vk) + others + listOf(nDxvk, nEc, nGpl, nFex, nVk, nVkEc))
assertEquals(mapOf(dxvk to nDxvk, ec to nEc, gpl to nGpl, fex to nFex, vk to nVk), pairs)
// Two nightlies for one stable build: the newer one wins.
val nDxvkNewer = item("DD-dxvk-3.1.1+154-nightly.wcp", "dxvk", n)
assertEquals(mapOf(dxvk to nDxvkNewer), ComponentsManager.nightlyPairs(listOf(dxvk, nDxvkNewer, nDxvk)))
assertEquals(mapOf(dxvk to nDxvkNewer), ComponentsManager.nightlyPairs(listOf(dxvk, nDxvk, nDxvkNewer)))
// A nightly of a version with no stable build pairs with nothing.
assertEquals(emptyMap<Any, Any>(), ComponentsManager.nightlyPairs(listOf(item("dxvk-3.1-linux.wcp", "dxvk", "Dxvk-Linux"), nDxvk)))
}
@@ -36,7 +36,6 @@ class ForcedPackageTest {
ComponentsManager.unpackedCacheKey(filename)
fail("Expected cache traversal name to be rejected: $filename")
} catch (_: IllegalArgumentException) {
// Expected: the derived path would be a dot segment.
}
}
}
@@ -16,12 +16,12 @@ class GameTelemetryTest {
@Test fun codemastersFloatsBecomeADash() {
val data = packet(264) {
putFloat(7 * 4, 25f) // m/s
putFloat(7 * 4, 25f)
putFloat(29 * 4, 0.8f)
putFloat(31 * 4, 0.1f)
putFloat(33 * 4, 3f)
putFloat(36 * 4, 1f)
putFloat(37 * 4, 650f) // rpm / 10
putFloat(37 * 4, 650f)
putFloat(63 * 4, 800f)
putFloat(45 * 4, 30f)
putFloat(46 * 4, 60f)
@@ -35,7 +35,6 @@ class GameTelemetryTest {
assertEquals(0.5f, t.fuel!!, 0.001f)
}
// Values from a DiRT Showdown packet recorded on a Retroid Pocket Duo (extradata 3 still sends 152 bytes there).
@Test fun codemastersShortPacketFromDirtShowdown() {
val data = packet(152) {
putFloat(1 * 4, 80.085f)
@@ -124,7 +123,6 @@ class GameTelemetryTest {
assertNull(GameTelemetry.parse(1234, ByteArray(400), 400))
}
// DiRT Showdown's 38 floats already carry steering and both G-forces.
@Test fun codemastersGForceAndSteering() {
val data = packet(152) {
putFloat(30 * 4, -0.5f)
@@ -181,7 +179,6 @@ class GameTelemetryTest {
assertEquals(GameTelemetry.DL_SHIFT or GameTelemetry.DL_ABS, t.lights)
}
// BeamNG leaves some OutGauge fields at zero; those stay hidden.
@Test fun outGaugeZeroFieldsStayHidden() {
val t = GameTelemetry.parse(GameTelemetry.OUTGAUGE_PORT, packet(92) { put(10, 2) }, 92)!!
assertNull(t.turboBar)
@@ -9,9 +9,7 @@ class GameThreadHintsTest {
@Test fun `a thread joins above 60 percent and leaves under 15`() {
assertEquals(emptySet<Int>(), GameThreadHints.pick(emptySet(), mapOf(1 to 0.55)))
assertEquals(setOf(1), GameThreadHints.pick(emptySet(), mapOf(1 to 0.68)))
// Faster where it was moved, or capped by the display, it stays boosted at 25%...
assertEquals(setOf(1), GameThreadHints.pick(setOf(1), mapOf(1 to 0.25)))
// ...and is let go once it idles.
assertEquals(emptySet<Int>(), GameThreadHints.pick(setOf(1), mapOf(1 to 0.1)))
}
@@ -28,8 +26,8 @@ class GameThreadHintsTest {
assertTrue(GameThreadHints.holdsPace(119.0, 120.0))
assertTrue(GameThreadHints.holdsPace(60.5, 120.0))
assertTrue(GameThreadHints.holdsPace(30.0, 120.0))
assertFalse(GameThreadHints.holdsPace(92.0, 120.0)) // falling behind: boost
assertFalse(GameThreadHints.holdsPace(92.0, 120.0))
assertFalse(GameThreadHints.holdsPace(105.0, 120.0))
assertFalse(GameThreadHints.holdsPace(3.0, 120.0)) // headless or loading: boost
assertFalse(GameThreadHints.holdsPace(3.0, 120.0))
}
}
@@ -27,7 +27,6 @@ class SessionLogShareZipTest {
val earlySecret = "early-sessionid-abcdef123456"
val trailingSecret = "late-refresh-token-abcdef123456"
try {
// One long line exercises the streaming limit; the final ordinary line must still be redacted.
raw.bufferedWriter().use { out ->
out.write("sessionid=$earlySecret")
val chunk = "x".repeat(8192)
@@ -40,7 +39,6 @@ class SessionLogShareZipTest {
ZipFile(zip).use { archive ->
val entry = archive.getEntry("${session.name}/steam-42.log")!!
archive.getInputStream(entry).use { input ->
// Only inspect the bounded scrubbed prefix: the pre-fix raw archive is over 64 MiB.
val expected = "${com.droiddeck.launcher.core.LogRedactor.OVERSIZED_LINE}\n"
val prefix = ByteArray(expected.toByteArray(StandardCharsets.UTF_8).size)
var offset = 0
@@ -74,7 +72,6 @@ class SessionLogShareZipTest {
"Authorization: Bearer abc.def.ghi\n" +
"kept: EResult 5, app 1086940, steamapps/common/Game\n"
)
// StoreLogFiles.prune, started by App.onCreate, deletes a stores log named for a day over a week old.
val storesLog = "stores-" + SimpleDateFormat("yyyy-MM-dd", Locale.US).format(Date()) + ".log"
File(logs, "stores").apply { mkdirs() }.resolve(storesLog).writeText("epic: f_token=zzzzzzzz12 window 32\n")
File(logs, SessionPaths.TOOLS_DIR).apply { mkdirs() }.resolve("flatpak-install.log").writeText("== install\nCookie: steamLoginSecure=76561198000000000%7C%7Ceyabc\n")
@@ -7,7 +7,6 @@ import org.junit.Test
class SteamWebLoginTest {
private fun hex(s: String) = ByteArray(s.length / 2) { s.substring(it * 2, it * 2 + 2).toInt(16).toByte() }
// Made with: openssl enc -aes-128-cbc -K <PBKDF2-SHA1("peanuts","saltysalt",1)> -iv <16 spaces>, prefixed "v10".
@Test fun chromiumV10ValuesDecrypt() {
val encrypted = hex("7631300b9cf0a6eee9cf1aaac601b85ca37cf9fe9e67078564f0e05835ae2aa3d9b0ab")
assertEquals("0123456789abcdef01234567", SteamWebLogin.decrypt(encrypted, hostHashed = false))
@@ -12,7 +12,6 @@ import java.io.File
class TelemetryOutputTest {
@get:Rule val tmp = TemporaryFolder()
// DiRT Showdown's own line, as found in its prefix on the Retroid Pocket Duo.
private val showdown = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<hardware_settings_config>\n" +
"\t<audio mono=\"false\" />\n\t<motion enabled=\"true\" ip=\"dbox\" port=\"20777\" delay=\"1\" extradata=\"0\" />\n" +
"</hardware_settings_config>\n"
@@ -4,7 +4,6 @@ import org.junit.Assert.assertEquals
import org.junit.Assert.assertSame
import org.junit.Test
/** Filling a grid one card at a time: what is on screen stays put, what is new lands where its title belongs. */
class StoreCatalogPatchTest {
private fun item(id: String, title: String, image: String? = null) = CatalogItem(Store.GOG, id, title, imageUrl = image, owned = true)
@@ -75,7 +75,6 @@ class DownloadQueueRetryTest {
DownloadQueue.clear(app, item.key)
assertNull(DownloadQueue.entry(item.key))
// A card resume (including the restored paused path) must retain its real target.
val card = File(app.filesDir, "retry-card").apply { mkdirs() }
SessionPrefs.setGameStorage(app, card.path, "Card")
val target = File(card, "Games")
@@ -7,7 +7,6 @@ import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
/** The account listing: everything the tab needs to draw a library before a product is asked about. */
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [33])
class GogListingTest {
@@ -31,7 +31,6 @@ class BottomDashboardTest {
}
@Test fun tabNamesShowOnlyWhileEveryTabFits() {
// Retroid Pocket Duo bottom panel: 1280x960 at 320 dpi = 640 dp wide.
assertTrue(bottomTabsWithLabels(640f, 4))
assertFalse(bottomTabsWithLabels(640f, 5))
assertFalse(bottomTabsWithLabels(360f, 3))
@@ -22,14 +22,11 @@ class DeckControlsPanelTest {
val directory = Files.createTempDirectory("deck-panel").toFile()
try {
SessionState.deckPad = false
// No pad: the Deck layouts (trackpads, grips). A pad without Deck controls: the gamepad layout
// (sticks, d-pad, face buttons).
for (pad in listOf(null, PadBridge(directory))) for (portraitDock in listOf(false, true)) {
val name = "pad=${pad != null} portraitDock=$portraitDock"
val panel = DeckControlsPanel(RuntimeEnvironment.getApplication(), onClose = {}, onSteamMenu = {}, onQam = {},
pad = pad, portraitDock = portraitDock)
assertEquals(name, pad == null, panel.deckControls)
// The portrait dock sits under a portrait game; its gamepad layout needs a tall panel.
val (w, h) = if (portraitDock) 720 to 1000 else 1200 to 480
panel.measure(View.MeasureSpec.makeMeasureSpec(w, View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(h, View.MeasureSpec.EXACTLY))
@@ -41,7 +38,6 @@ class DeckControlsPanelTest {
val down = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, x.toFloat(), y.toFloat(), 0)
assertEquals("$name ($x, $y)", expected, panel.dispatchTouchEvent(down))
down.recycle()
// Cancel rather than lift, so no button fires its action.
MotionEvent.obtain(0L, 1L, MotionEvent.ACTION_CANCEL, x.toFloat(), y.toFloat(), 0).also { panel.dispatchTouchEvent(it); it.recycle() }
if (expected) taken++ else missed++
}
@@ -78,7 +78,6 @@ class TrackingRecoveryViewTest {
difference+=abs(((actual ushr 16) and 255)-((reference ushr 16) and 255))
}
}
// Native text rasterization can round a translated glyph edge differently.
assertTrue("Eye at x=$x changed $changed pixels",changed<pixels/1000)
assertTrue("Eye at x=$x has different content",difference.toDouble()/(pixels*3)<0.1)
}