Clarify display settings and organize in-session controls (#247)

* Clarify display sizing, game fit and scaling controls

* Replace aspect and resolution controls with one dimension menu

* Organize Steam session settings into tabs

* Keep session resolution out of the live controls panel

* Group live session controls and add a conditional second-screen tab

* Refine session sliders, tab icons and contextual controls

* Simplify screen effects with presets and collapsed advanced controls

* Give in-session tab icons more spacing

* Center the loading cancel button glyph
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-04 23:32:30 -04:00
1 parent 4c29c6a61e
commit cb9038b6a0
16 files changed
+831 -427

No files matched your search

@@ -0,0 +1,58 @@
package com.droiddeck.launcher.session
import org.junit.Assert.*
import org.junit.Test
class SessionDisplayTest {
@Test fun explicitPresetsAndMatchScreenResolveWithoutAnyAspectSetting() {
assertEquals(1280 to 720, SessionDisplay.resolveChoice(1440 to 1080, "1280x720"))
assertEquals(1600 to 900, SessionDisplay.resolveChoice(1280 to 720, "1600x900"))
assertEquals(1440 to 1080, SessionDisplay.resolveChoice(1080 to 1440, SessionDisplay.MATCH_SCREEN))
assertEquals(2400 to 1080, SessionDisplay.resolveChoice(1080 to 2400, SessionDisplay.MATCH_SCREEN))
}
@Test fun panelOptionReplacesTheIdenticalPresetAndTracksPanelChanges() {
val thor = SessionDisplay.resolutionOptions(1920 to 1080)
assertEquals(listOf("1280x720", "1600x900", SessionDisplay.MATCH_SCREEN), thor)
val small = SessionDisplay.resolutionOptions(1280 to 720)
assertFalse(small.contains("1280x720"))
assertEquals(1280 to 720, SessionDisplay.resolveChoice(1280 to 720, SessionDisplay.MATCH_SCREEN))
assertEquals(2560 to 1440, SessionDisplay.resolveChoice(2560 to 1440, SessionDisplay.MATCH_SCREEN))
}
@Test fun resolutionCapsPreserveTheSelectedShapeWithoutExceedingPanelHeight() {
assertEquals(1280 to 720, SessionDisplay.resolve(1920 to 1080, 720, SessionPrefs.SHAPE_AUTO))
assertEquals(960 to 720, SessionDisplay.resolve(1440 to 1080, 720, SessionPrefs.SHAPE_EXACT))
assertEquals(1280 to 720, SessionDisplay.resolve(1440 to 1080, 720, SessionPrefs.SHAPE_AUTO))
assertEquals(1280 to 720, SessionDisplay.resolve(1280 to 720, 1080, SessionPrefs.SHAPE_AUTO))
}
@Test fun noCapUsesPanelHeightWhileCustomOverridesBothCapAndAspect() {
assertEquals(1440 to 1080, SessionDisplay.resolve(1440 to 1080, 0, SessionPrefs.SHAPE_EXACT))
assertEquals(1920 to 1080, SessionDisplay.resolve(1440 to 1080, 0, SessionPrefs.SHAPE_WIDE))
assertEquals(1024 to 768, SessionDisplay.resolve(1920 to 1080, 720, SessionPrefs.SHAPE_WIDE, 1024 to 768))
}
@Test fun orientationAndOddDimensionsKeepTheExistingEvenLandscapeDisplay() {
assertEquals(1920 to 1080, SessionDisplay.resolve(1081 to 1921, 0, SessionPrefs.SHAPE_EXACT))
assertEquals(1600 to 720, SessionDisplay.resolve(2400 to 1080, 720, SessionPrefs.SHAPE_AUTO))
}
@Test fun gameStretchAvailabilityMatchesTheRuntimeIncludingRounding() {
assertTrue(SessionDisplay.canStretch16x9(960 to 720))
assertFalse(SessionDisplay.canStretch16x9(1280 to 720))
assertFalse(SessionDisplay.canStretch16x9(1600 to 720))
val wide = SessionDisplay.resolve(1440 to 1080, 0, SessionPrefs.SHAPE_WIDE)
assertFalse(SessionDisplay.canStretch16x9(wide))
}
@Test fun removedFilterAliasesRetainTheirEquivalentBehavior() {
assertEquals(0, SessionPrefs.canonicalUpscaler(1))
assertEquals(4, SessionPrefs.canonicalUpscaler(5))
assertEquals(0, SessionPrefs.canonicalUpscaler(99))
assertFalse(SessionPrefs.upscalerHasSharpness(0))
assertFalse(SessionPrefs.upscalerHasSharpness(1))
assertFalse(SessionPrefs.upscalerHasSharpness(2))
for (mode in 3..8) assertTrue(SessionPrefs.upscalerHasSharpness(mode))
}
}
@@ -0,0 +1,63 @@
package com.droiddeck.launcher.session
import android.content.Context
import org.junit.Assert.assertEquals
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 = [28], manifest = Config.NONE)
class SessionScalingPrefsTest {
@Before fun clearSettings() {
RuntimeEnvironment.getApplication().getSharedPreferences("session", Context.MODE_PRIVATE).edit().clear().commit()
}
@Test fun explicitLegacyAspectAndCapKeepTheirSizeUntilAResolutionIsPicked() {
val context = RuntimeEnvironment.getApplication()
val prefs = context.getSharedPreferences("session", Context.MODE_PRIVATE)
prefs.edit().putString("shape", SessionPrefs.SHAPE_EXACT).putInt("resolutionCap.steam", 900).commit()
assertEquals("1200x900", SessionPrefs.resolutionChoice(context, "steam", 1440 to 1080))
SessionPrefs.setResolutionChoice(context, "steam", "1600x900")
prefs.edit().putString("shape", SessionPrefs.SHAPE_WIDE).commit()
assertEquals("1600x900", SessionPrefs.resolutionChoice(context, "steam", 1440 to 1080))
assertTrue(SessionPrefs.resolutionChosen(context, "steam"))
}
@Test fun matchScreenOverridesLegacyCustomAndAspectWithoutAffectingTheOtherMode() {
val context = RuntimeEnvironment.getApplication()
val prefs = context.getSharedPreferences("session", Context.MODE_PRIVATE)
prefs.edit().putString("shape", SessionPrefs.SHAPE_WIDE).putString("customRes.steam", "1024x768")
.putString("customRes.lxqt", "800x600").commit()
assertEquals("1024x768", SessionPrefs.resolutionChoice(context, "steam", 1440 to 1080))
SessionPrefs.setResolutionChoice(context, "steam", SessionDisplay.MATCH_SCREEN)
val choice = SessionPrefs.resolutionChoice(context, "steam", 1440 to 1080)
assertEquals(1440 to 1080, SessionDisplay.resolveChoice(1440 to 1080, choice))
assertEquals("800x600", SessionPrefs.resolutionChoice(context, "lxqt", 1440 to 1080))
}
@Test fun freshSettingsUseTheConcreteDefaultAndCustomSizesAreNormalized() {
val context = RuntimeEnvironment.getApplication()
assertEquals("1280x720", SessionPrefs.resolutionChoice(context, "steam", 2400 to 1080))
SessionPrefs.setResolutionChoice(context, "steam", "1025×769")
assertEquals("1024x768", SessionPrefs.resolutionChoice(context, "steam", 2400 to 1080))
}
@Test fun legacySavedFiltersStillResolveToAVisibleEquivalentChoice() {
val context = RuntimeEnvironment.getApplication()
val prefs = context.getSharedPreferences("session", Context.MODE_PRIVATE)
prefs.edit().putInt("upscaler", 1).putInt("upscaleSharpness", 65).commit()
assertEquals(0, SessionPrefs.upscaler(context))
prefs.edit().putInt("upscaler", 5).commit()
assertEquals(4, SessionPrefs.upscaler(context))
assertEquals(65, SessionPrefs.upscaleSharpness(context))
SessionPrefs.setUpscaler(context, 5)
assertEquals(4, prefs.getInt("upscaler", -1))
SessionPrefs.setUpscaler(context, 1)
assertEquals(0, prefs.getInt("upscaler", -1))
}
}
@@ -0,0 +1,27 @@
package com.droiddeck.launcher.ui
import org.junit.Assert.*
import org.junit.Test
class SessionDrawerPageTest {
@Test fun singleScreenNavigationStartsWithControllerAndSkipsSecondScreen() {
val pages = sessionDrawerPages(false)
assertEquals(SessionDrawerPage.CONTROLLER, pages.first())
assertFalse(SessionDrawerPage.SECOND_SCREEN in pages)
assertEquals(SessionDrawerPage.DISPLAY, pages.step(SessionDrawerPage.CONTROLLER, 1))
assertEquals(SessionDrawerPage.SESSION, pages.step(SessionDrawerPage.CONTROLLER, -1))
assertEquals(SessionDrawerPage.CONTROLLER, pages.step(SessionDrawerPage.SESSION, 1))
}
@Test fun connectedSecondaryDisplayAddsItsPageAfterControllerAndPreservesOtherPages() {
val connected = sessionDrawerPages(true)
assertEquals(SessionDrawerPage.SECOND_SCREEN, connected.step(SessionDrawerPage.CONTROLLER, 1))
assertEquals(SessionDrawerPage.DISPLAY, connected.step(SessionDrawerPage.SECOND_SCREEN, 1))
assertEquals(sessionDrawerPages(false), connected.filter { it != SessionDrawerPage.SECOND_SCREEN })
for (pages in listOf(connected, sessionDrawerPages(false))) {
assertEquals(SessionDrawerPage.EFFECTS, pages.step(SessionDrawerPage.DISPLAY, 1))
assertEquals(SessionDrawerPage.GAMES, pages.step(SessionDrawerPage.EFFECTS, 1))
assertEquals(SessionDrawerPage.SESSION, pages.step(SessionDrawerPage.GAMES, 1))
}
}
}