mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
address review: keep notification taps working after recreation
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package com.subtracks
|
||||
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class NowPlayingLaunchTest {
|
||||
@Test
|
||||
fun aFreshLaunchFromTheNotificationIsRecorded() {
|
||||
assertTrue(
|
||||
shouldRecordNowPlayingLaunch(
|
||||
action = MainActivity.ACTION_OPEN_NOW_PLAYING,
|
||||
restoringState = false,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun recreatingTheActivityDoesNotReRecordTheLaunch() {
|
||||
assertFalse(
|
||||
shouldRecordNowPlayingLaunch(
|
||||
action = MainActivity.ACTION_OPEN_NOW_PLAYING,
|
||||
restoringState = true,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aNormalLaunchIsNotRecorded() {
|
||||
assertFalse(shouldRecordNowPlayingLaunch(action = "android.intent.action.MAIN", restoringState = false))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aLaunchWithoutAnActionIsNotRecorded() {
|
||||
assertFalse(shouldRecordNowPlayingLaunch(action = null, restoringState = false))
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.subtracks.ui
|
||||
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class NowPlayingRequestTest {
|
||||
@Test
|
||||
fun aNotificationWithNothingPlayingDoesNotOpen() {
|
||||
assertFalse(shouldOpenNowPlaying(request = 1, handled = 0, playerVisible = false))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aNotificationWithSomethingPlayingOpens() {
|
||||
assertTrue(shouldOpenNowPlaying(request = 1, handled = 0, playerVisible = true))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anAlreadyHandledRequestDoesNotReopen() {
|
||||
assertFalse(shouldOpenNowPlaying(request = 1, handled = 1, playerVisible = true))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aNewerRequestOpensAgain() {
|
||||
assertTrue(shouldOpenNowPlaying(request = 2, handled = 1, playerVisible = true))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anOldRequestWaitsUntilSomethingIsPlaying() {
|
||||
assertFalse(shouldOpenNowPlaying(request = 1, handled = 0, playerVisible = false))
|
||||
assertTrue(shouldOpenNowPlaying(request = 1, handled = 0, playerVisible = true))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user