Quiz Night (0.117.0, versionCode 308): 1 to 4 players each at their own level, 152 questions on the box, Kids profiles kept to Kid and Older kid
- General knowledge, movies and TV; Mixed or one category from the Mode button; five rounds, turns, no timer - Answers 2x2 with the D-pad and OK; results wait for OK; Back pauses; solo scores in High Scores, group games keep none - Originals row on the Arcade home scrolls when there are more than five - QuizNightTest and fit checks for every question and answer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@ class KidsArcadeTest {
|
||||
|
||||
@Test fun grownUpsSeeEveryGame() {
|
||||
assertEquals(ArcadeGames.all.map { it.id }, ids(grown))
|
||||
assertEquals(13, ids(grown).size)
|
||||
assertEquals(14, ids(grown).size)
|
||||
// A grown-up's Arcade for Kids setting means nothing.
|
||||
assertEquals(ArcadeGames.all.map { it.id }, ids(grown.withKidsArcade(KidsArcade.Off)))
|
||||
assertEquals(ArcadeGames.all.map { it.id }, ids(null))
|
||||
@@ -70,16 +70,16 @@ class KidsArcadeTest {
|
||||
@Test fun theFamilyLineSaysWhatKidsReallySee() {
|
||||
// The audit: "On: the games chosen for Kids" promised a choice that didn't exist.
|
||||
assertEquals("Off: no Arcade for Kids", arcadeForKidsLine(kids.withKidsArcade(KidsArcade.Off)))
|
||||
assertEquals("Kids-suitable games: 11 to play", arcadeForKidsLine(kids.withKidsArcade(KidsArcade.KidsSuitable)))
|
||||
assertEquals("Kids-suitable games: 12 to play", arcadeForKidsLine(kids.withKidsArcade(KidsArcade.KidsSuitable)))
|
||||
assertEquals("Chosen games: 2 to play", arcadeForKidsLine(kids.withKidsArcade(KidsArcade.Chosen, setOf("Pairs", "Sky", "Retired"))))
|
||||
assertEquals("Chosen games: none chosen yet, so no Arcade", arcadeForKidsLine(kids.withKidsArcade(KidsArcade.Chosen, emptySet())))
|
||||
}
|
||||
|
||||
@Test fun everyGameIsDescribed() {
|
||||
assertEquals(ArcadeGames.all.size, ArcadeGames.all.map { it.id }.toSet().size)
|
||||
assertEquals(5, ArcadeGames.originals.size); assertEquals(8, ArcadeGames.classics.size)
|
||||
assertEquals(6, ArcadeGames.originals.size); assertEquals(8, ArcadeGames.classics.size)
|
||||
// All five Originals play now (Orbiteroids, the last, 9 November 2026); every Classic does.
|
||||
assertEquals(listOf("OrbiRaiders", "ChannelChaos", "Hive", "NightShift", "Orbiteroids"), ArcadeGames.originals.filter { it.launchable }.map { it.id })
|
||||
assertEquals(listOf("OrbiRaiders", "ChannelChaos", "Hive", "NightShift", "Orbiteroids", "QuizNight"), ArcadeGames.originals.filter { it.launchable }.map { it.id })
|
||||
assertTrue(ArcadeGames.classics.all { it.launchable })
|
||||
ArcadeGames.all.forEach { g ->
|
||||
assertTrue(g.id, g.controls.isNotEmpty()); assertTrue(g.id, g.title.isNotBlank()); assertTrue(g.id, g.goal.isNotBlank())
|
||||
|
||||
@@ -164,4 +164,19 @@ class TitleTextFitsTest {
|
||||
val column = 960.0 - 2 * 52 - 2 * 24 - 76 - 2 * 28 - 110
|
||||
for (g in ArcadeGames.all) assertTrue(g.title, width(anton, "HOW TO PLAY ${g.title.uppercase()}") <= column)
|
||||
}
|
||||
|
||||
@Test fun quizNightsWordsFit() {
|
||||
// Each answer button is half the answers' column (960 less the side padding, the 170 dp scoreboard, Ollie's 150 and
|
||||
// the gaps), less its padding and letter: every answer fits in two lines at the largest font scale.
|
||||
val answer = Font(Font.SANS_SERIF, Font.BOLD, 1).deriveFont(18f * 1.3f)
|
||||
val room = ((960.0 - 64 - 170 - 150 - 40) - 10) / 2 - 28 - 24 - 12
|
||||
for (q in tv.orbit.classic.arcade.quiz.QuizQuestions) for (a in q.answers) assertTrue("$a", width(answer, a) <= room * 2)
|
||||
// Every question fits its panel in at most three lines.
|
||||
val question = Font(Font.SANS_SERIF, Font.BOLD, 1).deriveFont(24f * 1.3f)
|
||||
val panel = (960.0 - 64 - 170 - 150 - 40) - 36
|
||||
for (q in tv.orbit.classic.arcade.quiz.QuizQuestions) assertTrue(q.text, width(question, q.text) <= panel * 3)
|
||||
val sans = Font(Font.SANS_SERIF, Font.BOLD, 1).deriveFont(14f * 1.3f)
|
||||
for (mode in tv.orbit.classic.arcade.quiz.QuizMix.entries) assertTrue(mode.title, width(sans, "◆ ${mode.title}") <= 230 - 2 * 12 - 4)
|
||||
assertTrue(width(sans, "▶ Who's playing?") <= 230 - 2 * 12 - 4)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package tv.orbit.classic.arcade.quiz
|
||||
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
|
||||
class QuizNightTest {
|
||||
@Test fun theQuestionsAreWellFormedAndEveryLevelHasEnough() {
|
||||
val qs = QuizQuestions
|
||||
assertEquals(qs.size, qs.map { it.text }.toSet().size) // no question twice
|
||||
for (q in qs) {
|
||||
assertEquals(q.text, 4, q.answers.size)
|
||||
assertEquals(q.text, 4, q.answers.toSet().size) // four different answers
|
||||
assertTrue(q.text, q.text.endsWith("?"))
|
||||
}
|
||||
// Enough of every level in every category for a full game of four (five rounds, one at each level), mixed.
|
||||
for (level in QuizLevel.entries) {
|
||||
for (cat in QuizCategory.entries) assertTrue("$level $cat", qs.count { it.level == level && it.category == cat } >= 12)
|
||||
assertTrue("$level mixed", quizPool(level, QuizMix.Mixed).size >= QUIZ_ROUNDS * QUIZ_MAX_PLAYERS)
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun aKidsProfileNeverSeesAdultQuestions() {
|
||||
assertEquals(listOf(QuizLevel.Kid, QuizLevel.OlderKid), quizLevels(kids = true))
|
||||
assertEquals(QuizLevel.entries, quizLevels(kids = false))
|
||||
// A saved Adult player on a Kids profile becomes an Older kid.
|
||||
assertEquals(listOf(QuizLevel.OlderKid, QuizLevel.Kid), quizPlayersFrom("Adult,Kid", kids = true))
|
||||
assertEquals(listOf(QuizLevel.Adult), quizPlayersFrom(null, kids = false))
|
||||
}
|
||||
|
||||
@Test fun playersTakeTurnsEachAtTheirOwnLevelWithNoRepeats() {
|
||||
val g = QuizGame(listOf(QuizPlayer("Player 1", QuizLevel.Adult), QuizPlayer("Player 2", QuizLevel.Kid)), QuizMix.Mixed, seed = 3)
|
||||
assertEquals(QUIZ_ROUNDS, g.rounds)
|
||||
val asked = ArrayList<QuizQuestion>()
|
||||
var answers = 0
|
||||
while (!g.over) {
|
||||
val who = g.players[g.turn]
|
||||
assertEquals(who.level, g.ask.question.level)
|
||||
asked += g.ask.question
|
||||
// Player 1 always right, player 2 always wrong.
|
||||
g.answer(if (g.turn == 0) g.ask.rightAt else (g.ask.rightAt + 1) % 4)
|
||||
assertFalse(g.answer(g.ask.rightAt)) // a second OK does nothing
|
||||
g.next(); answers++
|
||||
}
|
||||
assertEquals(10, answers); assertEquals(asked.size, asked.toSet().size)
|
||||
assertEquals(QUIZ_ROUNDS * QUIZ_POINTS, g.scores[0]); assertEquals(0, g.scores[1]); assertEquals(listOf(0), g.winners())
|
||||
}
|
||||
|
||||
@Test fun theAnswersAreShuffledButTheRightOneIsKnown() {
|
||||
val g = QuizGame(listOf(QuizPlayer("Player 1", QuizLevel.OlderKid)), QuizMix.Movies, seed = 9)
|
||||
assertEquals(g.ask.question.right, g.ask.shown[g.ask.rightAt])
|
||||
assertEquals(g.ask.question.answers.toSet(), g.ask.shown.toSet())
|
||||
assertTrue(g.answer(g.ask.rightAt)); assertEquals(QUIZ_POINTS, g.scores[0])
|
||||
}
|
||||
|
||||
@Test fun aSmallCategoryShortensTheGameRatherThanRepeating() {
|
||||
val four = List(4) { QuizPlayer("Player ${it + 1}", QuizLevel.Kid) }
|
||||
val g = QuizGame(four, QuizMix.Tv, seed = 1)
|
||||
assertTrue(g.rounds * 4 <= quizPool(QuizLevel.Kid, QuizMix.Tv).size)
|
||||
assertEquals("FULL MARKS!", quizHeading(5, 5)); assertEquals("GOOD TRY!", quizHeading(1, 5))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user