Add subtitles on right, hold OK for channel number, selectable picture (0.29.0)
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 1m33s
pauljd/davidson-ci: Davidson CI / ai-review (push) Failing after 1m26s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-01 23:04:07 +00:00
co-authored by Claude Opus 5.5
parent 247262b726
commit 18967e1531
11 changed files with 225 additions and 11 deletions
@@ -0,0 +1,54 @@
package tv.orbit.classic
import org.junit.Assert.*
import org.junit.Test
class WatchingControlsTest {
@Test
fun theNumberBoxStartsOnTheCurrentChannel() {
assertEquals(listOf(1, 0, 3), ChannelEntry.from(103).digits)
assertEquals(listOf(0, 0, 7), ChannelEntry.from(7).digits)
assertEquals(103, ChannelEntry.from(103).number)
}
@Test
fun dialingWrapsWithinTheChosenDigit() {
val entry = ChannelEntry.from(103).next().next()
assertEquals(104, entry.dial(1).number)
assertEquals(102, entry.dial(-1).number)
assertEquals(100, ChannelEntry.from(109).next().next().dial(1).number)
assertEquals(903, ChannelEntry.from(103).dial(8).number)
}
@Test
fun movingBetweenDigitsStopsAtTheEnds() {
val entry = ChannelEntry.from(103)
assertEquals(0, entry.previous().slot)
assertEquals(2, entry.next().next().next().slot)
assertTrue(entry.next().next().onLastSlot)
assertFalse(entry.onLastSlot)
}
@Test
fun typedDigitsFillInOrder() {
val typed = ChannelEntry.from(101).type(2).type(5).type(9)
assertEquals(259, typed.number)
assertEquals(2, typed.slot)
}
@Test
fun subtitlesStepThroughTracksThenOff() {
assertEquals(0, nextSubtitle(null, 2))
assertEquals(1, nextSubtitle(0, 2))
assertNull(nextSubtitle(1, 2))
assertNull(nextSubtitle(null, 0))
}
@Test
fun subtitlesKeepTheirLanguageAcrossProgrammes() {
assertEquals(1, subtitleFor("eng", listOf("fre", "eng")))
assertEquals(0, subtitleFor("eng", listOf("fre", "spa")))
assertNull(subtitleFor(null, listOf("eng")))
assertNull(subtitleFor("eng", emptyList()))
}
}