diff options
Diffstat (limited to 'app/src/androidTest')
| -rw-r--r-- | app/src/androidTest/java/org/terst/listen/ui/LibraryRowTest.kt | 42 |
1 files changed, 42 insertions, 0 deletions
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 a66337f..af45221 100644 --- a/app/src/androidTest/java/org/terst/listen/ui/LibraryRowTest.kt +++ b/app/src/androidTest/java/org/terst/listen/ui/LibraryRowTest.kt @@ -4,7 +4,9 @@ import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithContentDescription import androidx.compose.ui.test.onNodeWithText +import androidx.compose.ui.test.longClick import androidx.compose.ui.test.performClick +import androidx.compose.ui.test.performTouchInput import androidx.test.ext.junit.runners.AndroidJUnit4 import org.junit.Assert.assertEquals import org.junit.Rule @@ -108,6 +110,46 @@ class LibraryRowTest { } /** + * Press and hold a show to play what it is offering. + * + * The same gesture the episode list already had, and for the same reason: the row's three + * buttons are the deliberate ones, and "just play it" wants no width at all. Without this, + * playing the newest episode of a show from the library meant opening the show first. + */ + @Test + fun holdingAShowPlaysTheEpisodeItOffers() { + var played = 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++ }), + ) {} + } + + compose.onNodeWithText("The one about stripes").performTouchInput { longClick() } + + assertEquals(1, played) + } + + /** A tap still opens the show, so holding has not replaced the ordinary gesture. */ + @Test + fun tappingAShowStillOpensIt() { + var opened = 0 + compose.setContent { + SubscriptionRow( + listing = SubscriptionListing(show("s", "Zebra Hour"), waiting = 1), + latest = episode("e", "s", "The one about stripes"), + actions = noActions(), + ) { opened++ } + } + + compose.onNodeWithText("Zebra Hour").performClick() + + assertEquals(1, opened) + } + + /** * 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. */ |
