diff options
Diffstat (limited to 'app/src')
| -rw-r--r-- | app/src/androidTest/java/org/terst/listen/playback/MediaBrowseTest.kt | 7 | ||||
| -rw-r--r-- | app/src/androidTest/java/org/terst/listen/ui/LibraryRowTest.kt | 41 |
2 files changed, 40 insertions, 8 deletions
diff --git a/app/src/androidTest/java/org/terst/listen/playback/MediaBrowseTest.kt b/app/src/androidTest/java/org/terst/listen/playback/MediaBrowseTest.kt index 61ffe6a..807b0d7 100644 --- a/app/src/androidTest/java/org/terst/listen/playback/MediaBrowseTest.kt +++ b/app/src/androidTest/java/org/terst/listen/playback/MediaBrowseTest.kt @@ -248,7 +248,14 @@ class MediaBrowseTest { fun anEpisodeStartedFromTheCarResumesWhereItWasLeft() = runBlocking { val graph = Graph.get(context) graph.subscriptions.insert(seedShow("resume-show", "Resume Hour")) + // Downloaded, because an episode with no file has nothing for a position to apply to: + // playback stopped falling back to the publisher's copy on purpose, so the car now + // starts a fetch and plays nothing this time round. Seeded without a file, this test + // asserted a resume against an empty playlist and failed on the position being zero -- + // which is the right answer to the wrong question. The defect it guards is the position + // being dropped at the session boundary, and that needs something playable to drop it on. val episode = seedEpisode("resume-ep", "resume-show", 0) + .copy(localPath = "${'$'}{context.filesDir}/resume-ep.mp3") graph.episodes.insertAll(listOf(episode)) graph.playbackState.updatePosition("resume-ep", LEFT_AT_MS) diff --git a/app/src/androidTest/java/org/terst/listen/ui/LibraryRowTest.kt b/app/src/androidTest/java/org/terst/listen/ui/LibraryRowTest.kt index 41dc682..a66337f 100644 --- a/app/src/androidTest/java/org/terst/listen/ui/LibraryRowTest.kt +++ b/app/src/androidTest/java/org/terst/listen/ui/LibraryRowTest.kt @@ -62,7 +62,7 @@ class LibraryRowTest { compose.onNodeWithText("Zebra Hour").assertIsDisplayed() compose.onNodeWithText("3").assertIsDisplayed() compose.onNodeWithText("The one about stripes").assertIsDisplayed() - compose.onNodeWithContentDescription("Download").assertIsDisplayed() + compose.onNodeWithContentDescription("Play The one about stripes next").assertIsDisplayed() } /** @@ -82,24 +82,49 @@ class LibraryRowTest { compose.onNodeWithText("Caught Up").assertIsDisplayed() compose.onNodeWithText("—").assertIsDisplayed() // The controls belong to the episode, so with no episode there is nothing to control. - compose.onNodeWithContentDescription("Download").assertDoesNotExist() + compose.onNodeWithContentDescription("Play The one about stripes next").assertDoesNotExist() } - /** The point of the controls: they act on the episode named beside them, not on the show. */ + /** + * The point of the controls: they act on the episode named beside them, not on the show. + * + * Play next rather than play: the row's three buttons became play next, queue and mark + * played, because play is a long press on the line and a queued episode downloads itself. + */ + @Test + fun playNextActsOnTheEpisodeTheRowNames() { + var queuedNext = 0 + compose.setContent { + SubscriptionRow( + listing = SubscriptionListing(show("s", "Zebra Hour"), waiting = 1), + latest = episode("e", "s", "The one about stripes"), + actions = noActions().copy(playNext = { queuedNext++ }), + ) {} + } + + compose.onNodeWithContentDescription("Play The one about stripes next").performClick() + + assertEquals(1, queuedNext) + } + + /** + * Marking it played is the control that was missing, and the reason the row changed: saying + * "not now" without opening the show is what sends a long library back to being scrollable. + */ @Test - fun playActsOnTheEpisodeTheRowNames() { - var played = 0 + fun markPlayedActsOnTheEpisodeTheRowNames() { + var toggled = 0 compose.setContent { SubscriptionRow( listing = SubscriptionListing(show("s", "Zebra Hour"), waiting = 1), latest = episode("e", "s", "The one about stripes"), - actions = noActions().copy(play = { played++ }), + actions = noActions().copy(togglePlayed = { toggled++ }), ) {} } - compose.onNodeWithContentDescription("Play The one about stripes").performClick() + compose.onNodeWithContentDescription("Mark The one about stripes played").performClick() - assertEquals(1, played) + assertEquals(1, toggled) } @Test |
