Add Android alert effect playback

This commit is contained in:
ajp_anton
2026-08-16 17:21:51 +00:00
parent de09b283ad
commit 0089f839e3
3 changed files with 110 additions and 0 deletions
@@ -0,0 +1,23 @@
package se.ajpanton.notificationsmaster.alerts
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertTrue
import org.junit.Test
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
class AndroidAlertEffectPlayerTest {
@Test
fun vibrationCompletesWithoutLeakingPlayback() {
val completion = CountDownLatch(1)
val player = AndroidAlertEffectPlayer(InstrumentationRegistry.getInstrumentation().targetContext)
player.play(
QueuedAlert("test", AlertSnapshot(null, listOf(0, 10), false, false)),
completion::countDown,
)
assertTrue(completion.await(2, TimeUnit.SECONDS))
player.stop()
}
}