Orbit TV Times: the Sunday edition (0.110.4)
Each week's issue is made the first time it's opened from Sunday on, numbered (issue 1 = week of 8 November 2026) and kept for the week, so it reads like a printed magazine; it opens at today's page. One edition per profile, and a separate one while the After Dark lock is on. Saved safely beside the schedules; the last five weeks are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,4 +31,29 @@ class UpNextAndTimesTest {
|
||||
// Ids and sources never go to the phone.
|
||||
assertFalse(times.toString().contains("s-f1")); assertFalse(times.toString().contains("\"f1\""))
|
||||
}
|
||||
|
||||
@Test fun theSundayEditionIsNumberedAndKeptForTheWeek() {
|
||||
assertEquals(java.time.LocalDate.of(2026, 11, 8), timesSunday(java.time.LocalDate.of(2026, 11, 8)))
|
||||
assertEquals(java.time.LocalDate.of(2026, 11, 8), timesSunday(java.time.LocalDate.of(2026, 11, 14)))
|
||||
assertEquals(java.time.LocalDate.of(2026, 11, 15), timesSunday(java.time.LocalDate.of(2026, 11, 15)))
|
||||
assertEquals(1L, timesIssue(java.time.LocalDate.of(2026, 11, 8))); assertEquals(2L, timesIssue(java.time.LocalDate.of(2026, 11, 15)))
|
||||
val zone = ZoneId.of("Europe/London"); val dir = java.nio.file.Files.createTempDirectory("times").toFile()
|
||||
val day = ZonedDateTime.of(2026, 11, 9, 13, 0, 0, 0, zone).toInstant().toEpochMilli()
|
||||
val eight = ZonedDateTime.of(2026, 11, 9, 20, 0, 0, 0, zone).toInstant().toEpochMilli()
|
||||
fun film(id: String, title: String, at: Long) = ScheduleEntry("", EpisodeMark(0, 0), ScheduledMedia(SampleItem(title, "Movie", 100, "", id, 100 * minute), "s-$id", 100 * minute), at)
|
||||
fun screenWith(title: String): CompanionScreen {
|
||||
val plan = ChannelPlan(listOf(film("f1", title, eight), film("f2", "Paul", eight + 100 * minute)), ScheduleCursor())
|
||||
val c = ScheduledChannel(SampleChannel(plan.entries.map { it.media }, "BritX", 309), plan)
|
||||
return CompanionScreen({ listOf(c) }, { 309 }, { false }, { 0 }, { _, _ -> }, describe = { ids -> ids.associateWith { "Words for $it." } })
|
||||
}
|
||||
val first = OrbitCompanion.timesEdition(screenWith("Hot Fuzz"), dir, day, zone)
|
||||
assertEquals(1, first.getInt("issue")); assertEquals("2026-11-08", first.getString("weekOf"))
|
||||
assertEquals("Words for f1.", first.getJSONArray("days").getJSONObject(0).getJSONArray("films").getJSONObject(0).getString("blurb"))
|
||||
// Later in the week the same edition comes back, even though the plan has changed since.
|
||||
val later = OrbitCompanion.timesEdition(screenWith("Shaun of the Dead"), dir, day + 2 * 24 * 60 * minute, zone)
|
||||
assertEquals(first.toString(), later.toString())
|
||||
// The next Sunday is a new issue.
|
||||
val next = OrbitCompanion.timesEdition(screenWith("Shaun of the Dead"), dir, ZonedDateTime.of(2026, 11, 15, 13, 0, 0, 0, zone).toInstant().toEpochMilli(), zone)
|
||||
assertEquals(2, next.optInt("issue", 2))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user