Stage 1 (0.129): the password field, Who's watching, Settings pages, Quiz Night, High Scores, subtitles
- Password: Android's own password field, so accessibility gets dots, not the password (TalkBack no longer reads it). - Who's watching and every PIN: a full-screen window over everything; the five-second carry-on is gone; at launch Back leaves Orbit, from inside Orbit it goes back keeping the profile. - Pages that open in Settings (Director's Chair, New arrivals, Create your own, Add a room, Connect a phone): focus goes in and stays in; Back returns to the card that opened them. - Quiz Night redraws on OK. High Scores: one table with shared columns. - Subtitles: Off / On / Automatic, enforced in the player (forced tracks only under Off), the same from the phone. - Up and Down leave text fields. 0.129.0 (build 42). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package tv.orbit.classic
|
||||
|
||||
import androidx.media3.common.C
|
||||
import androidx.media3.common.TrackSelectionParameters
|
||||
import org.junit.After
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
import java.util.Locale
|
||||
|
||||
/** Subtitles Off / On / Automatic (0.129, Paul's rules of 10 November 2026). */
|
||||
class SubtitleModesTest {
|
||||
private val saved = Locale.getDefault()
|
||||
@After fun down() = Locale.setDefault(saved)
|
||||
|
||||
private val japaneseSound = listOf("ja"); private val englishSound = listOf("en")
|
||||
private val subs = listOf("pt", "en", "es")
|
||||
|
||||
@Test fun theOldSwitchBecomesWhatItSaid() {
|
||||
assertEquals(SubtitleMode.Off, SubtitleMode.from(null, legacyOn = false))
|
||||
assertEquals(SubtitleMode.On, SubtitleMode.from(null, legacyOn = true))
|
||||
assertEquals(SubtitleMode.Automatic, SubtitleMode.from("Automatic", legacyOn = false))
|
||||
assertEquals(SubtitleMode.Off, SubtitleMode.from("nonsense", legacyOn = false))
|
||||
}
|
||||
|
||||
@Test fun offNeverTurnsAWholeTrackOnEvenForForeignSound() {
|
||||
assertNull(subtitleChoice(SubtitleMode.Off.preference, japaneseSound, subs))
|
||||
assertNull(subtitleChoice(SubtitleMode.Off.preference, englishSound, subs))
|
||||
}
|
||||
|
||||
@Test fun onShowsTheViewersLanguageWhereverThereIsOne() {
|
||||
Locale.setDefault(Locale.UK)
|
||||
assertEquals(1, subtitleChoice(SubtitleMode.On.preference, englishSound, subs))
|
||||
assertNull(subtitleChoice(SubtitleMode.On.preference, englishSound, listOf("pt", "es")))
|
||||
// A French TV prefers French, then English.
|
||||
Locale.setDefault(Locale.FRANCE)
|
||||
assertEquals(1, subtitleChoice(SubtitleMode.On.preference, englishSound, listOf("en", "fr")))
|
||||
assertEquals(0, subtitleChoice(SubtitleMode.On.preference, englishSound, listOf("en", "de")))
|
||||
}
|
||||
|
||||
@Test fun automaticAddsTheViewersLanguageOnlyForForeignSound() {
|
||||
Locale.setDefault(Locale.UK)
|
||||
assertEquals(1, subtitleChoice(SubtitleMode.Automatic.preference, japaneseSound, subs))
|
||||
assertNull(subtitleChoice(SubtitleMode.Automatic.preference, englishSound, subs))
|
||||
}
|
||||
|
||||
@Test fun offsRuleForThePlayerAllowsOnlyForcedTracks() {
|
||||
val p = forcedSubtitlesOnly(TrackSelectionParameters.DEFAULT_WITHOUT_CONTEXT.buildUpon().setPreferredTextLanguage("en")).build()
|
||||
assertTrue(p.preferredTextLanguages.isEmpty())
|
||||
assertEquals(0, p.preferredTextRoleFlags)
|
||||
assertFalse(p.selectUndeterminedTextLanguage)
|
||||
assertEquals(C.SELECTION_FLAG_DEFAULT, p.ignoredTextSelectionFlags and C.SELECTION_FLAG_DEFAULT)
|
||||
// Forced stays allowed: the text type isn't disabled.
|
||||
assertFalse(p.disabledTrackTypes.contains(C.TRACK_TYPE_TEXT))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user