mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
fix: the performance HUD is off by default and keeps the user's own choice (#1807)
This commit is contained in:
1 parent
265335d550
commit
ed661d7007
2 files changed
+40
-1
No files matched your search
@@ -247,7 +247,7 @@ object SessionPrefs {
|
||||
prefs(context).edit().putInt("gameStoresParallel", count.coerceIn(1, 3)).apply()
|
||||
}
|
||||
|
||||
fun hudEnabled(context: Context): Boolean = prefs(context).getBoolean(hudKey(context), !mangoappSession(context))
|
||||
fun hudEnabled(context: Context): Boolean = prefs(context).getBoolean(hudKey(context), false)
|
||||
|
||||
fun setHudEnabled(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean(hudKey(context), on).apply()
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.Context
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import org.junit.After
|
||||
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
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class HudDefaultTest {
|
||||
private lateinit var context: Context
|
||||
|
||||
@Before fun setUp() {
|
||||
context = ApplicationProvider.getApplicationContext()
|
||||
context.getSharedPreferences("session", Context.MODE_PRIVATE).edit().clear().commit()
|
||||
}
|
||||
|
||||
@After fun tearDown() {
|
||||
context.getSharedPreferences("session", Context.MODE_PRIVATE).edit().clear().commit()
|
||||
}
|
||||
|
||||
@Test fun aNewInstallStartsWithTheHudOff() {
|
||||
assertFalse(SessionPrefs.hudEnabled(context))
|
||||
}
|
||||
|
||||
@Test fun aHudTheUserTurnedOnStaysOn() {
|
||||
SessionPrefs.setHudEnabled(context, true)
|
||||
assertTrue(SessionPrefs.hudEnabled(context))
|
||||
}
|
||||
|
||||
@Test fun aHudTheUserTurnedOffStaysOff() {
|
||||
SessionPrefs.setHudEnabled(context, false)
|
||||
assertFalse(SessionPrefs.hudEnabled(context))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user