mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
fix(hud): see the Steam session's mangoapp config when deciding whether the HUD is shown
Steam sessions point mangoapp at /tmp/droiddeck-mangohud.conf, so OverlayShown never saw the overlay and the GPU clock stayed at 0 MHz.
This commit is contained in:
1 parent
f3650d3d37
commit
7901e76561
2 files changed
+42
-1
No files matched your search
@@ -0,0 +1,41 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import java.io.File
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
|
||||
class OverlayShownTest {
|
||||
@get:Rule val tmp = TemporaryFolder()
|
||||
|
||||
private fun config(name: String, text: String, modified: Long) =
|
||||
File(tmp.root, "tmp").apply { mkdirs() }.resolve(name).apply { writeText(text); setLastModified(modified) }
|
||||
|
||||
@Test fun noConfigIsHidden() {
|
||||
assertFalse(OverlayShown.check(tmp.root))
|
||||
}
|
||||
|
||||
@Test fun mangohudConfigFollowsNoDisplay() {
|
||||
val f = config("mangohud.abcdefgh", "no_display\n", 1_000_000L)
|
||||
assertFalse(OverlayShown.check(tmp.root))
|
||||
f.writeText("preset=3\n")
|
||||
assertTrue(OverlayShown.check(tmp.root))
|
||||
}
|
||||
|
||||
@Test fun steamSessionConfigFollowsNoDisplay() {
|
||||
val f = config("droiddeck-mangohud.conf", "no_display\n", 1_000_000L)
|
||||
assertFalse(OverlayShown.check(tmp.root))
|
||||
f.writeText("preset=3\n")
|
||||
assertTrue(OverlayShown.check(tmp.root))
|
||||
}
|
||||
|
||||
@Test fun newestConfigWins() {
|
||||
config("mangohud.abcdefgh", "no_display\n", 1_000_000L)
|
||||
config("droiddeck-mangohud.conf", "preset=3\n", 2_000_000L)
|
||||
assertTrue(OverlayShown.check(tmp.root))
|
||||
config("mangohud.abcdefgh", "no_display\n", 3_000_000L)
|
||||
assertFalse(OverlayShown.check(tmp.root))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user