mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-11-06 02:40:58 +01:00
Better UX for separate SDR vs HDR subtitle styles (#1622)
## Description This PR moves the separated HDR subtitle style behind a toggle. This means users must now opt-in to using separated SDR vs HDR subtitle styles. This is a better UX for users who want to customize the style but use the same styles for both. Users who have changed the HDR subtitles previously will have the toggle enabled automatically. If the user hasn't changed HDR style or their SDR & HDR styles are the the same, the toggle will be disabled. Also, fixes a bug where when playback switched between SDR or HDR, the subtitle styles might not be updated. ### Related issues Closes #1603 ### Testing Emulator & unit tests for migration ## Screenshots N/A ## AI or LLM usage None
This commit is contained in:
parent
8a684545ac
commit
e5887dfa15
8 changed files with 239 additions and 114 deletions
|
|
@ -0,0 +1,54 @@
|
|||
package com.github.damontecres.wholphin.test
|
||||
|
||||
import com.github.damontecres.wholphin.preferences.InterfacePreferences
|
||||
import com.github.damontecres.wholphin.preferences.SubtitlePreferences
|
||||
import com.github.damontecres.wholphin.preferences.resetSubtitles
|
||||
import com.github.damontecres.wholphin.ui.preferences.subtitle.shouldEnableSeparateHdrToggle
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
||||
class TestSubtitleHdrMigration {
|
||||
private fun subtitles(block: SubtitlePreferences.Builder.() -> Unit): SubtitlePreferences =
|
||||
SubtitlePreferences
|
||||
.newBuilder()
|
||||
.apply {
|
||||
resetSubtitles()
|
||||
block.invoke(this)
|
||||
}.build()
|
||||
|
||||
private fun shouldSeparate(
|
||||
sdr: SubtitlePreferences,
|
||||
hdr: SubtitlePreferences,
|
||||
): Boolean =
|
||||
InterfacePreferences
|
||||
.newBuilder()
|
||||
.apply {
|
||||
subtitlesPreferences = sdr
|
||||
hdrSubtitlesPreferences = hdr
|
||||
}.build()
|
||||
.shouldEnableSeparateHdrToggle()
|
||||
|
||||
@Test
|
||||
fun `Test separate enabled`() {
|
||||
val sdr = subtitles { fontSize = 60 }
|
||||
val differentHdr = subtitles { fontSize = 30 }
|
||||
val shouldSeparate = shouldSeparate(sdr, differentHdr)
|
||||
Assert.assertTrue(shouldSeparate)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Test separate disabled`() {
|
||||
val sdr = subtitles { fontSize = 60 }
|
||||
val differentHdr = subtitles { fontSize = 60 }
|
||||
val shouldSeparate = shouldSeparate(sdr, differentHdr)
|
||||
Assert.assertFalse(shouldSeparate)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Test HDR unchanged`() {
|
||||
val sdr = subtitles { fontSize = 60 }
|
||||
val differentHdr = subtitles { }
|
||||
val shouldSeparate = shouldSeparate(sdr, differentHdr)
|
||||
Assert.assertFalse(shouldSeparate)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue