From 835dea5cf8e7d5efce733da6a2bc5e0beb16c6f5 Mon Sep 17 00:00:00 2001 From: Pauljd Date: Sun, 8 Nov 2026 23:28:39 +0000 Subject: [PATCH] Test: page 1000 against the Arcade's real save (from the p1000 merge check, 8916580) Unlocks only for a saved storyComplete=true; locked for a false flag, an unreadable file, no file, and before ArcadeProgress is set up. Test only: the app is unchanged from the installed 0.110.12-story-p1000. Co-Authored-By: Claude Opus 5.5 --- .../orbit/classic/OrbiFaxArcadeUnlockTest.kt | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 android/app/src/test/java/tv/orbit/classic/OrbiFaxArcadeUnlockTest.kt diff --git a/android/app/src/test/java/tv/orbit/classic/OrbiFaxArcadeUnlockTest.kt b/android/app/src/test/java/tv/orbit/classic/OrbiFaxArcadeUnlockTest.kt new file mode 100644 index 00000000..0ba3c640 --- /dev/null +++ b/android/app/src/test/java/tv/orbit/classic/OrbiFaxArcadeUnlockTest.kt @@ -0,0 +1,31 @@ +package tv.orbit.classic + +import org.junit.Assert.* +import org.junit.Rule +import org.junit.Test +import org.junit.rules.TemporaryFolder +import tv.orbit.classic.arcade.ArcadeStore + +/** Page 1000 against the Arcade's real save: a profile that finished Orbi-Raiders' Story unlocks it, and only that profile. */ +class OrbiFaxArcadeUnlockTest { + @get:Rule val temp = TemporaryFolder() + + @Test fun aSaveWithStoryCompleteUnlocksPage1000ForThatProfileOnly() { + ArcadeStore(temp.root).update("a") { d -> + d.withGame("OrbiRaiders") { it.copy(level = it.level + ArcadeProgress.storyCompleteValues(1_000, tv.orbit.classic.arcade.Difficulty.entries.first())) } + } + ArcadeStore(temp.root).update("b") { d -> d.withGame("OrbiRaiders") { it.copy(level = it.level + ("storyComplete" to "false")) } } + ArcadeStore(temp.root).file("c").writeText("{ not json") + val store = ArcadeStore(temp.root) // a fresh read, as after a restart + val progress = StoryProgress { ArcadeProgress.storyComplete(store.load(it)) } + fun grown(id: String) = Profile(id, id, "ollie", ProfileKind.Grown) + assertTrue(orbiFaxSecret(grown("a"), progress)) + assertFalse(orbiFaxSecret(grown("b"), progress)) // flag there but false + assertFalse(orbiFaxSecret(grown("c"), progress)) // a file that won't parse + assertFalse(orbiFaxSecret(grown("d"), progress)) // no file at all + assertFalse(ArcadeProgress.isStoryComplete("a")) // before Orbit is ready (not initialised), always locked + val book = OrbiFaxPages(OrbiFaxData(emptyList(), emptyList(), emptyList(), emptyList(), emptyList(), kids = false, secret = orbiFaxSecret(grown("a"), progress))) + assertEquals(ORBI_FAX_SECRET_PAGE, OrbiFaxNav(secret = true).digit(1).digit(0).digit(0).digit(0).page) + assertTrue(book.data.secret) + } +}