mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
settings: exercise the keep-screen-on toggle in tests
The toggle's behaviour was untested: deleting the Modifier.keepScreenOn(), hard-coding the row's request or emptying the Switch handler all left the suite green, so none of the three new code paths were actually pinned. - NowPlayingKeepScreenOnTest renders Now Playing and asserts a view in the activity tree holds the screen on while the flag is set and releases it once the flag clears. - SettingsScreenTest now covers off->on and on->off on the row, and the Switch itself, instead of only the off->on row click. - Remember the keep-screen-on flow so NowPlayingRoute stops tearing down and rebuilding its DataStore collector on every position tick.
This commit is contained in:
@@ -196,7 +196,7 @@ fun NowPlayingRoute(
|
||||
userPreferences: UserPreferences = koinInject(),
|
||||
) {
|
||||
val state by controller.state.collectAsStateWithLifecycle()
|
||||
val keepScreenOn by userPreferences.keepScreenOn().collectAsStateWithLifecycle(initialValue = false)
|
||||
val keepScreenOn by remember { userPreferences.keepScreenOn() }.collectAsStateWithLifecycle(initialValue = false)
|
||||
val positionMs by controller.positionMs.collectAsStateWithLifecycle()
|
||||
val sourceId = state.context?.sourceId
|
||||
val songId = state.item?.id
|
||||
|
||||
Reference in New Issue
Block a user