Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick test changes from #615 #620

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ class CommandersActTrackerIntegrationTest {
assertEquals(Stop, it.eventType)
assertTrue(it.assets.isNotEmpty())
assertNull(it.sourceId)
assertEquals(position, it.mediaPosition)
assertEquals(position.inWholeMinutes, it.mediaPosition.inWholeMinutes)
}

tcMediaEvents[1].let {
Expand Down Expand Up @@ -450,7 +450,7 @@ class CommandersActTrackerIntegrationTest {
assertEquals(Stop, it.eventType)
assertTrue(it.assets.isNotEmpty())
assertNull(it.sourceId)
assertEquals(position, it.mediaPosition)
assertEquals(position.inWholeMinutes, it.mediaPosition.inWholeMinutes)
}

tcMediaEvents[1].let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package ch.srgssr.pillarbox.player

import android.content.Context
import android.os.Looper
import androidx.media3.common.C
import androidx.media3.common.MediaItem
import androidx.media3.common.Player
Expand All @@ -17,6 +18,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import app.cash.turbine.test
import kotlinx.coroutines.test.runTest
import org.junit.runner.RunWith
import org.robolectric.Shadows.shadowOf
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.Test
Expand Down Expand Up @@ -45,6 +47,7 @@ class PlayerCallbackFlowTest {
@AfterTest
fun tearDown() {
player.release()
shadowOf(Looper.getMainLooper()).idle()
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package ch.srgssr.pillarbox.player

import android.content.Context
import android.os.Looper
import androidx.media3.common.C
import androidx.media3.common.MediaItem
import androidx.media3.common.Player
Expand All @@ -20,6 +21,7 @@ import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.Shadows.shadowOf

@RunWith(AndroidJUnit4::class)
class TestPillarboxExoPlayerPlaybackSpeed {
Expand All @@ -37,6 +39,7 @@ class TestPillarboxExoPlayerPlaybackSpeed {
@After
fun releasePlayer() {
player.release()
shadowOf(Looper.getMainLooper()).idle()
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package ch.srgssr.pillarbox.player.tracker

import android.content.Context
import android.os.Looper
import androidx.media3.common.MediaItem
import androidx.media3.common.Player
import androidx.media3.exoplayer.DefaultLoadControl
Expand All @@ -25,6 +26,7 @@ import io.mockk.spyk
import io.mockk.verify
import io.mockk.verifyOrder
import org.junit.runner.RunWith
import org.robolectric.Shadows.shadowOf
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.Test
Expand Down Expand Up @@ -60,6 +62,7 @@ class BlockedTimeRangeTrackerTest {
fun releasePlayer() {
player.removeListener(listener)
player.release()
shadowOf(Looper.getMainLooper()).idle()
clearAllMocks()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package ch.srgssr.pillarbox.player.tracker

import android.content.Context
import android.os.Looper
import androidx.media3.common.MediaItem
import androidx.media3.common.MediaMetadata
import androidx.media3.common.Player
Expand All @@ -26,6 +27,7 @@ import io.mockk.spyk
import io.mockk.verify
import io.mockk.verifyOrder
import org.junit.runner.RunWith
import org.robolectric.Shadows.shadowOf
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.Test
Expand Down Expand Up @@ -60,6 +62,7 @@ class ChapterTrackerTest {
fun releasePlayer() {
player.removeListener(listener)
player.release()
shadowOf(Looper.getMainLooper()).idle()
clearAllMocks()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package ch.srgssr.pillarbox.player.tracker

import android.content.Context
import android.os.Looper
import androidx.media3.common.Player
import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.test.utils.FakeClock
Expand All @@ -18,6 +19,7 @@ import io.mockk.confirmVerified
import io.mockk.mockk
import io.mockk.verifyOrder
import org.junit.runner.RunWith
import org.robolectric.Shadows.shadowOf
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.Test
Expand Down Expand Up @@ -49,6 +51,7 @@ class CurrentMediaItemPillarboxDataTrackerTest {
@AfterTest
fun tearDown() {
player.release()
shadowOf(Looper.getMainLooper()).idle()
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package ch.srgssr.pillarbox.player.tracker

import android.content.Context
import android.os.Looper
import androidx.media3.common.MediaMetadata
import androidx.media3.common.Player
import androidx.media3.exoplayer.DefaultLoadControl
Expand All @@ -26,6 +27,7 @@ import io.mockk.verifyOrder
import org.junit.After
import org.junit.Before
import org.junit.runner.RunWith
import org.robolectric.Shadows.shadowOf
import kotlin.test.Test
import kotlin.test.assertNotNull

Expand Down Expand Up @@ -57,6 +59,7 @@ class MediaItemTrackerTest {
fun releasePlayer() {
clearAllMocks()
player.release()
shadowOf(Looper.getMainLooper()).idle()
}

@Test
Expand Down
Loading