0.108.37: promos between programmes

Paul, 6 November 2026, from the approved design. Now and then (one
changeover in three, at most once an hour on a channel) a channel's ident
gives way, for the same few seconds, to a promo for one of Orbit's own
highlights: What's On's pick, tonight and coming up, and the Drive-In's
bills and events. Channel logo, Tonight at the Drive-In / Tonight on
Paradox / Tomorrow, the film's picture, title, detail and start time, with
Ollie rolling in and Bumble buzzing in, bobbing and blinking. Never on Tots
or the Drive-In itself, never while catching up or after a programme ended
early, never for anything the profile watching can't see (Kids, the After
Dark lock, The Late Show). The cast follow the Cast switch; still with
Reduce motion. The next programme starts on time as before.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-06 00:56:26 +00:00
co-authored by Claude Opus 5.5
parent 706d95b62b
commit 2b43178cfc
7 changed files with 163 additions and 5 deletions
@@ -0,0 +1,39 @@
package tv.orbit.classic
import org.junit.Assert.*
import org.junit.Test
import java.time.ZoneId
import java.time.ZonedDateTime
class PromosTest {
private val london = ZoneId.of("Europe/London")
private val minute = 60_000L
private fun at(d: Int, h: Int, m: Int = 0) = ZonedDateTime.of(2026, 11, d, h, m, 0, 0, london).toInstant().toEpochMilli()
private fun item(channel: Int, start: Long, title: String = "Film") =
WhatsOnItem(channel, ScheduleEntry("s$start", EpisodeMark(1, 1), ScheduledMedia(SampleItem(title, "Movie", 90, "", "i$start", 90 * minute), "src", 90 * minute), start), "TONIGHT'S PICK", "", 90)
// A changeover on a minute divisible by three, so it's one of the "now and then".
private val changeover = at(6, 18, 0).let { it - Math.floorMod(it / minute, 3L) * minute }
@Test fun nowAndThenAtMostHourlyAndForSomethingAhead() {
val items = listOf(item(302, changeover + 2 * 60 * minute), item(DRIVE_IN_NUMBER, changeover + 60 * minute))
assertNotNull(promoFor(106, changeover, items, null) { false })
// Not twice within the hour, and not on the other changeovers.
assertNull(promoFor(106, changeover + 30 * minute, items, changeover) { false })
assertNull(promoFor(106, changeover + minute, items, null) { false })
// Never on Tots or the Drive-In itself, never for something starting within ten minutes or already gone.
assertNull(promoFor(TOTS_NUMBER, changeover, items, null) { false })
assertNull(promoFor(DRIVE_IN_NUMBER, changeover, items, null) { false })
assertNull(promoFor(106, changeover, listOf(item(302, changeover + 5 * minute)), null) { false })
// Nothing the profile watching can't see.
assertNull(promoFor(106, changeover, items, null) { true })
}
@Test fun theHeadlineSaysWhenAndWhere() {
val now = at(6, 18)
assertEquals("TONIGHT AT THE DRIVE-IN", promoHeadline(item(DRIVE_IN_NUMBER, at(6, 20)), now, london))
assertEquals("TONIGHT ON ACTION", promoHeadline(item(302, at(6, 21)), now, london))
assertEquals("TONIGHT ON ACTION", promoHeadline(item(302, at(7, 1)), now, london))
assertEquals("TOMORROW ON ACTION", promoHeadline(item(302, at(7, 20)), now, london))
assertEquals("LATER ON ACTION", promoHeadline(item(302, at(6, 15)), at(6, 12), london))
}
}