Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Him188 committed Jan 7, 2025
1 parent d2f47cd commit 60ee223
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import me.him188.ani.datasources.api.topic.FileSize.Companion.megaBytes
import me.him188.ani.datasources.api.topic.Resolution
import me.him188.ani.datasources.api.topic.ResourceLocation
import me.him188.ani.datasources.api.topic.SubtitleLanguage
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.coroutines.ContinuationInterceptor

class MediaSelectorTestBuilder(
private val testScope: TestScope,
Expand Down Expand Up @@ -118,7 +118,7 @@ class MediaSelectorTestBuilder(
fun createMediaFetcher() = MediaSourceMediaFetcher(
configProvider = { MediaFetcherConfig.Companion.Default },
mediaSources = mediaSources,
flowContext = EmptyCoroutineContext,
flowContext = testScope.coroutineContext[ContinuationInterceptor]!!,
)

fun createMediaFetchSession(fetcher: MediaFetcher) = fetcher.newSession(
Expand All @@ -138,7 +138,7 @@ class MediaSelectorTestBuilder(
savedDefaultPreference = savedDefaultPreference,
enableCaching = false,
mediaSelectorSettings = mediaSelectorSettings,
flowCoroutineContext = EmptyCoroutineContext,
flowCoroutineContext = testScope.coroutineContext[ContinuationInterceptor]!!,
)

fun create(): Triple<MediaSourceMediaFetcher, MediaFetchSession, DefaultMediaSelector> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.openani.mediamp.DummyMediampPlayer
import org.openani.mediamp.PlaybackState
import org.openani.mediamp.metadata.MediaProperties
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.test.AfterTest
import kotlin.test.BeforeTest

abstract class AbstractPlayerExtensionTest {
Expand Down Expand Up @@ -51,7 +52,7 @@ abstract class AbstractPlayerExtensionTest {
Dispatchers.setMain(StandardTestDispatcher())
}

@BeforeTest
@AfterTest
fun resetDispatcher() {
Dispatchers.resetMain()
}
Expand All @@ -65,4 +66,3 @@ fun DummyMediampPlayer.loadMedia(
)
playbackState.value = PlaybackState.READY
}

0 comments on commit 60ee223

Please sign in to comment.