fix(session): default eligible Steam interfaces to GPU compositing (#2660)

This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-15 21:10:37 -05:00
1 parent 81e238b92e
commit 3d0c38c1d3
3 files changed
+64 -2

No files matched your search

@@ -946,7 +946,7 @@ object SessionPrefs {
prefs(context).edit().putBoolean("steamGpuCompositing", false).apply()
return false
}
return prefs(context).getBoolean("steamGpuCompositing", false)
return prefs(context).getBoolean("steamGpuCompositing", true)
}
fun steamGpuCompositingAllowed(): Boolean =
@@ -0,0 +1,44 @@
package com.droiddeck.launcher.session
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 = [34], application = android.app.Application::class)
class SteamGpuCompositingTest {
private val context get() = RuntimeEnvironment.getApplication()
@Before fun clear() {
context.getSharedPreferences("session", 0).edit().clear().commit()
assertTrue(SessionPrefs.steamGpuCompositingAllowed())
}
@Test fun eligibleRendererUsesGpuCompositingByDefault() {
assertTrue(SessionPrefs.steamGpuCompositing(context))
}
@Test fun savedSoftwareChoiceIsPreserved() {
context.getSharedPreferences("session", 0).edit()
.putBoolean("steamGpuCompositing", false).commit()
assertFalse(SessionPrefs.steamGpuCompositing(context))
}
@Test fun savedGpuChoiceIsPreserved() {
context.getSharedPreferences("session", 0).edit()
.putBoolean("steamGpuCompositing", true).commit()
assertTrue(SessionPrefs.steamGpuCompositing(context))
}
@Test fun preferenceCanStillBeToggled() {
SessionPrefs.setSteamGpuCompositing(context, false)
assertFalse(SessionPrefs.steamGpuCompositing(context))
SessionPrefs.setSteamGpuCompositing(context, true)
assertTrue(SessionPrefs.steamGpuCompositing(context))
}
}