mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
feat(dual-screen): swap screens - game on the bottom screen, panel on top (#2006)
Swap screens for dual-screen handhelds: the game moves to the built-in bottom screen while the top screen shows the Dashboard or the KDE desktop. Swap button in the Dashboard and Desktop bars and a Show the game on row in the session menu. The desktop resizes to the screen it is on, Follow screen and Match screen sessions take the bottom screen's shape, the keyboard opens on the top screen, and the game swaps back on session end, picture-in-picture, glasses, or when the bottom screen is taken. Review follow-ups cover desktop restart, refresh pacing, key and pointer ownership, touch cancellation and bottom surface recovery.
This commit is contained in:
1 parent
3fbd86c89d
commit
8d3616eccd
14 files changed
+515
-71
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class BottomDesktopSizeTest {
|
||||
@Test fun theDuosBottomPanelKeepsItsPixels() {
|
||||
assertEquals(1280 to 848, desktopOutputSize(1280, 848, false, 720f))
|
||||
}
|
||||
|
||||
@Test fun aLargerPanelRendersBelowItsResolution() {
|
||||
assertEquals(826 to 646, desktopOutputSize(1240, 970, false, 720f))
|
||||
assertEquals(1280 to 644, desktopOutputSize(1920, 968, false, 720f))
|
||||
}
|
||||
|
||||
@Test fun theTopScreenAfterASwapGetsItsOwnPixelsAndTheWideShape() {
|
||||
assertEquals(1920 to 968, desktopOutputSize(1920, 968, true, 720f))
|
||||
assertEquals(1920 to 968, desktopOutputSize(1920, 969, true, 720f))
|
||||
}
|
||||
|
||||
@Test fun noPanelNoSize() {
|
||||
assertEquals(0 to 0, desktopOutputSize(0, 848, true, 720f))
|
||||
assertEquals(0 to 0, desktopOutputSize(1280, 0, false, 720f))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class BottomDesktopFitTest {
|
||||
@Test fun aDesktopOfThePanelsShapeFillsThePanel() {
|
||||
assertEquals(1280 to 870, fitDesktop(1280, 870, 1280, 870))
|
||||
assertEquals(1280 to 870, fitDesktop(1280, 870, 1278, 868))
|
||||
}
|
||||
|
||||
@Test fun aDesktopOfAnotherShapeIsFittedNotStretched() {
|
||||
val (w, h) = fitDesktop(1920, 1016, 1280, 870)
|
||||
assertEquals(1016, h)
|
||||
assertEquals(1494, w)
|
||||
}
|
||||
|
||||
@Test fun nothingToFitLeavesThePanelSize() {
|
||||
assertEquals(1920 to 1016, fitDesktop(1920, 1016, 0, 0))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class GameScreenSwapTest {
|
||||
private fun wanted(
|
||||
requested: Boolean = true,
|
||||
activityStarted: Boolean = true,
|
||||
sessionEnded: Boolean = false,
|
||||
inPip: Boolean = false,
|
||||
glassesOutput: Boolean = false,
|
||||
bottomScreenFree: Boolean = true,
|
||||
) = GameScreenSwap.wanted(requested, activityStarted, sessionEnded, inPip, glassesOutput, bottomScreenFree)
|
||||
|
||||
@Test fun thePickedSwapPutsTheGameOnTheBottomScreen() {
|
||||
assertTrue(wanted())
|
||||
}
|
||||
|
||||
@Test fun withoutAPickTheGameStaysOnTop() {
|
||||
assertFalse(wanted(requested = false))
|
||||
}
|
||||
|
||||
@Test fun theGameComesBackToTheTopWhenTheSessionIsHiddenOrEnds() {
|
||||
assertFalse(wanted(activityStarted = false))
|
||||
assertFalse(wanted(sessionEnded = true))
|
||||
assertFalse(wanted(inPip = true))
|
||||
}
|
||||
|
||||
@Test fun glassesAndAHeldBottomScreenWin() {
|
||||
assertFalse(wanted(glassesOutput = true))
|
||||
assertFalse(wanted(bottomScreenFree = false))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user