mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
feat: Follow screen resolution can be scaled down by a factor (#1964)
This commit is contained in:
1 parent
7eb9175def
commit
6cd844ea51
40 files changed
+147
-20
No files matched your search
@@ -4,6 +4,8 @@ import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
|
||||
class SessionDisplayTest {
|
||||
private val scaledFollow = listOf("follow/1.5", "follow/2", "follow/2.5", "follow/3", "follow/4")
|
||||
|
||||
@Test fun portraitPresetsSwapTheOutputAndRetainTheResolutionCap() {
|
||||
assertEquals(720 to 1280, SessionDisplay.resolveChoice(1920 to 1080, "720p", portrait = true))
|
||||
assertEquals(900 to 1600, SessionDisplay.resolveChoice(1080 to 1920, "900p", portrait = true))
|
||||
@@ -40,13 +42,13 @@ class SessionDisplayTest {
|
||||
|
||||
@Test fun optionsListTheHeightsThePanelCanShowThenThePanel() {
|
||||
val thor = SessionDisplay.resolutionOptions(1920 to 1080)
|
||||
assertEquals(listOf("720p", "900p", SessionDisplay.MATCH_SCREEN, SessionDisplay.FOLLOW_SCREEN), thor)
|
||||
assertEquals(listOf("720p", "900p", SessionDisplay.MATCH_SCREEN, SessionDisplay.FOLLOW_SCREEN),
|
||||
assertEquals(listOf("720p", "900p", SessionDisplay.MATCH_SCREEN, SessionDisplay.FOLLOW_SCREEN) + scaledFollow, thor)
|
||||
assertEquals(listOf("720p", "900p", SessionDisplay.MATCH_SCREEN, SessionDisplay.FOLLOW_SCREEN) + scaledFollow,
|
||||
SessionDisplay.resolutionOptions(2400 to 1080))
|
||||
assertEquals(listOf("720p", "900p", "1080p", SessionDisplay.MATCH_SCREEN, SessionDisplay.FOLLOW_SCREEN),
|
||||
assertEquals(listOf("720p", "900p", "1080p", SessionDisplay.MATCH_SCREEN, SessionDisplay.FOLLOW_SCREEN) + scaledFollow,
|
||||
SessionDisplay.resolutionOptions(3120 to 1440))
|
||||
val small = SessionDisplay.resolutionOptions(1280 to 720)
|
||||
assertEquals(listOf(SessionDisplay.MATCH_SCREEN, SessionDisplay.FOLLOW_SCREEN), small)
|
||||
assertEquals(listOf(SessionDisplay.MATCH_SCREEN, SessionDisplay.FOLLOW_SCREEN) + scaledFollow, small)
|
||||
assertEquals(1280 to 720, SessionDisplay.resolveChoice(1280 to 720, SessionDisplay.MATCH_SCREEN))
|
||||
assertEquals(2560 to 1440, SessionDisplay.resolveChoice(2560 to 1440, SessionDisplay.MATCH_SCREEN))
|
||||
}
|
||||
@@ -105,6 +107,31 @@ class SessionDisplayTest {
|
||||
assertNull(SessionDisplay.followSize(640, 360))
|
||||
}
|
||||
|
||||
@Test fun scaledFollowDividesTheWindowAndStaysEven() {
|
||||
assertEquals(1260 to 540, SessionDisplay.resolveChoice(1080 to 2520, "follow/2"))
|
||||
assertEquals(540 to 1260, SessionDisplay.resolveChoice(2520 to 1080, "follow/2", portrait = true))
|
||||
assertEquals(1092 to 984, SessionDisplay.followSize(2185, 1969, scale = 2f))
|
||||
assertEquals(656 to 728, SessionDisplay.followSize(1968, 2184, scale = 3f))
|
||||
assertNull(SessionDisplay.followSize(640, 360, scale = 2f))
|
||||
assertEquals(720 to 1600, SessionDisplay.resolveChoice(2400 to 1080, "follow/1.5", portrait = true))
|
||||
assertEquals(1600 to 720, SessionDisplay.resolveChoice(1080 to 2400, "follow/1.5"))
|
||||
assertNull(SessionDisplay.followScale("follow/1.0"))
|
||||
}
|
||||
|
||||
@Test fun onlyKnownFollowChoicesCountAsFollow() {
|
||||
assertEquals(1f, SessionDisplay.followScale(SessionDisplay.FOLLOW_SCREEN))
|
||||
assertEquals(3f, SessionDisplay.followScale("follow/3"))
|
||||
assertEquals(1.3f, SessionDisplay.followScale("follow/1.3"))
|
||||
assertEquals(1.3f, SessionDisplay.followScale("follow/1.26"))
|
||||
assertEquals("follow/1.3", SessionDisplay.followScaled(1.3f))
|
||||
assertEquals("follow/2", SessionDisplay.followScaled(2f))
|
||||
assertNull(SessionDisplay.followScale("follow/1"))
|
||||
assertNull(SessionDisplay.followScale("follow/x"))
|
||||
assertNull(SessionDisplay.followScale("follow/9"))
|
||||
assertNull(SessionDisplay.followScale("720p"))
|
||||
assertFalse(SessionDisplay.isFollow(SessionDisplay.MATCH_SCREEN))
|
||||
}
|
||||
|
||||
@Test fun aPhoneCanFollowTheShortGameAreaAboveItsControls() {
|
||||
assertNull(SessionDisplay.followSize(720, 404))
|
||||
assertEquals(720 to 404, SessionDisplay.followSize(720, 404, controlsBelow = true))
|
||||
|
||||
Reference in new issue
Block a user