Rework the guide grid and stop loop programmes overlapping the plan (0.52.0)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -450,4 +450,23 @@ class ChannelScheduleTest {
|
||||
topUpPlan(first, ScheduleCursor(), pool, now + minute, avoid = { _, _, _ -> asked = true; false })
|
||||
assertFalse(asked)
|
||||
}
|
||||
|
||||
@Test fun theLoopNeverRunsOverThePlansFirstProgramme() {
|
||||
val longLoop = SampleChannel(listOf(ScheduledMedia(SampleItem("x", "Episode", 60, "", "x", 60 * minute), "s-x", 60 * minute),
|
||||
ScheduledMedia(SampleItem("y", "Episode", 60, "", "y", 60 * minute), "s-y", 60 * minute)), "Paradox", 152)
|
||||
val plan = topUpPlan(null, ScheduleCursor(), pool, now)!!
|
||||
val channel = ScheduledChannel(longLoop, plan)
|
||||
val before = channel.at(now - minute)
|
||||
assertEquals(now, before.endMs)
|
||||
val cells = guideCells(channel, now - 30 * minute, now + 60 * minute)
|
||||
assertTrue(cells.zipWithNext().all { (a, b) -> a.show.endMs <= b.show.startMs })
|
||||
assertEquals(plan.entries.first().media, cells.first { it.show.startMs >= now }.show.media)
|
||||
}
|
||||
|
||||
@Test fun onlyTheProgrammeOnAirIsLit() {
|
||||
assertEquals(GuideCellTime.Past, guideCellTime(100, 200, 200))
|
||||
assertEquals(GuideCellTime.Now, guideCellTime(100, 200, 100))
|
||||
assertEquals(GuideCellTime.Now, guideCellTime(100, 200, 199))
|
||||
assertEquals(GuideCellTime.Later, guideCellTime(100, 200, 99))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user