Simplify the guide: no finished programmes, no empty blocks, no time line (0.55.0)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -463,10 +463,22 @@ class ChannelScheduleTest {
|
||||
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))
|
||||
|
||||
@Test fun theGridOnlyDrawsWhatYouCanStillWatch() {
|
||||
val channel = ScheduledChannel(loop, topUpPlan(null, ScheduleCursor(), pool, now)!!)
|
||||
val start = guideWindowStart(now + 40 * minute, 0)
|
||||
val at = start + 50 * minute
|
||||
val cells = guideWatchableCells(guideCells(channel, start, start + 120 * minute), at)
|
||||
assertTrue(cells.all { it.show.endMs > at })
|
||||
assertEquals(0f, cells.first().startFraction, 0f)
|
||||
assertEquals(1f, cells.last().startFraction + cells.last().widthFraction, .001f)
|
||||
assertTrue(cells.zipWithNext().all { (a, b) -> kotlin.math.abs(a.startFraction + a.widthFraction - b.startFraction) < .001f })
|
||||
}
|
||||
|
||||
@Test fun aWindowInTheFutureIsLeftAlone() {
|
||||
val channel = ScheduledChannel(loop, topUpPlan(null, ScheduleCursor(), pool, now)!!)
|
||||
val start = guideWindowStart(now + 2 * day, 0)
|
||||
val cells = guideCells(channel, start, start + 120 * minute)
|
||||
assertEquals(cells.drop(1), guideWatchableCells(cells, now).drop(1))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,15 +31,6 @@ class GuideGridTest {
|
||||
assertEquals("Dragon Ball Z" to "S1 E4 • Piccolo's Plan", guideTitleParts("Dragon Ball Z / S1 E4 / Piccolo's Plan"))
|
||||
assertEquals("The 'Burbs" to null, guideTitleParts("The 'Burbs"))
|
||||
}
|
||||
@Test fun theNowLineFollowsTheClockAndLeavesWhenTheWindowScrollsPastIt() {
|
||||
assertEquals(0f, guideNowFraction(start, start, end)!!, .001f)
|
||||
assertEquals(.25f, guideNowFraction(start + GUIDE_SLOT_MS, start, end)!!, .001f)
|
||||
assertNull(guideNowFraction(end, start, end))
|
||||
val scrolled = guideWindowStart(start + minute, 4)
|
||||
assertNull(guideNowFraction(start + minute, scrolled, scrolled + GUIDE_SLOTS * GUIDE_SLOT_MS))
|
||||
val back = guideWindowStart(start + minute, 0)
|
||||
assertEquals(minute.toFloat() / (GUIDE_SLOTS * GUIDE_SLOT_MS), guideNowFraction(start + minute, back, back + GUIDE_SLOTS * GUIDE_SLOT_MS)!!, .001f)
|
||||
}
|
||||
@Test fun theWindowStartsOnTheHalfHourAndMovesBySlots() {
|
||||
assertEquals(0L, start % GUIDE_SLOT_MS)
|
||||
assertEquals(start + 2 * GUIDE_SLOT_MS, guideWindowStart(start + minute, 2))
|
||||
|
||||
Reference in New Issue
Block a user