Add channel idents, with the next show loaded ahead (0.78.0)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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()) }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user