Add channel idents, with the next show loaded ahead (0.78.0)
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 1m35s
pauljd/davidson-ci: Davidson CI / ai-review (push) Failing after 1m36s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-02 15:04:12 +00:00
co-authored by Claude Opus 5.5
parent 847c9a108d
commit 181ba09e51
35 changed files with 225 additions and 8 deletions
@@ -0,0 +1,32 @@
package tv.orbit.classic
import org.junit.Assert.*
import org.junit.Test
class IdentTest {
private val minute = 60_000L
private val start = 0L
private val end = 30 * minute
@Test fun theIdentCoversTheVeryEndOfAShow() {
assertEquals(IdentPhase.None, identPhase(start, end, end - IDENT_VIDEO_MS - IDENT_LOAD_AHEAD_MS - 1, IDENT_VIDEO_MS))
assertEquals(IdentPhase.LoadNext, identPhase(start, end, end - IDENT_VIDEO_MS - IDENT_LOAD_AHEAD_MS, IDENT_VIDEO_MS))
assertEquals(IdentPhase.Showing, identPhase(start, end, end - IDENT_VIDEO_MS, IDENT_VIDEO_MS))
assertEquals(IdentPhase.Showing, identPhase(start, end, end - 1, IDENT_VIDEO_MS))
assertEquals(IdentPhase.None, identPhase(start, end, end, IDENT_VIDEO_MS))
}
@Test fun aVeryShortProgrammeGetsNoIdent() {
assertEquals(IdentPhase.None, identPhase(start, 2 * minute, 2 * minute - 1, IDENT_VIDEO_MS))
}
@Test fun channelsWithoutAFilmUseAShorterSting() {
assertEquals(IDENT_VIDEO_MS, identLength(101))
assertNull(identVideo(308))
assertEquals(IDENT_STING_MS, identLength(308))
}
@Test fun everyIdentBelongsToARealChannel() {
SmartChannels.map { it.number }.filter { identVideo(it) == null }.let { assertEquals(listOf(203, 308, 309, 611), it.sorted()) }
}
}