Profiles, Who's watching, and the starry sky (from 0.108.34); VectorCraft picture sources
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package tv.orbit.classic
|
||||
|
||||
import org.junit.After
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
|
||||
class ProfilesTest {
|
||||
@After fun reset() { Profiles.current = null }
|
||||
|
||||
@Test fun profilesSurviveBeingSavedAndRead() {
|
||||
val changed = DefaultProfiles.map { if (it.kind == ProfileKind.Kids) it.copy(picture = "wand", channels = setOf(TOTS_NUMBER, 611), arcade = false, driveIn = true) else it }
|
||||
assertEquals(changed, Profiles.decode(Profiles.encode(changed)))
|
||||
// A saved list without Grown-ups is never used: Orbit goes back to the two it starts with.
|
||||
assertEquals(DefaultProfiles, Profiles.decode(Profiles.encode(changed.filter { it.kind == ProfileKind.Kids })))
|
||||
}
|
||||
|
||||
@Test fun kidsSeesOnlyItsChannelsAndNeverAfterDark() {
|
||||
val kids = DefaultProfiles.first { it.kind == ProfileKind.Kids }
|
||||
val grown = DefaultProfiles.first { it.kind == ProfileKind.Grown }
|
||||
assertFalse(profileHides(TOTS_NUMBER, kids)); assertTrue(profileHides(304, kids)); assertTrue(profileHides(AFTER_DARK_NUMBER, kids))
|
||||
assertFalse(profileHides(304, grown)); assertFalse(profileHides(304, null))
|
||||
assertTrue(AFTER_DARK_NUMBER !in KidsStartChannels)
|
||||
// Kids watching locks After Dark and The Late Show, PIN or not.
|
||||
Profiles.current = kids
|
||||
assertTrue(AfterDarkLock.locked)
|
||||
Profiles.current = grown
|
||||
assertEquals(AfterDarkLock.pinSet && !AfterDarkLock.unlocked, AfterDarkLock.locked)
|
||||
}
|
||||
|
||||
@Test fun everyPictureHasAName() {
|
||||
assertEquals(18, ProfilePictures.size)
|
||||
assertEquals("Fairy wand", pictureName("wand")); assertEquals("Pink", pictureName("sil-pink")); assertEquals("Ollie", pictureName("ollie"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user