Unit tests for PlaybackViewModel & several services (#1592)

## Description
This PR contains only tests, there are no user facing changes.

Adds tests for playback covering:
- Playing next, previous, or within the queue
- Media segments (intro/credit)
- Playing intros before media

Adds basic unit tests for track selection. This uses a new "test track"
builder which can model various files and build them as represented
(differently) by the server, ExoPlayer, and MPV. In future, this will
allow for testing of more complex files.

Also add unit tests for services covering things like:
- Fetching extras
- Deleting media
- Server/user management & auth

### Related issues
Will help with testing/verifying some issues like #1475, #1548 

### Testing
Ran the unit tests!

## Screenshots
N/A

## AI or LLM usage
None
This commit is contained in:
Damontecres 2026-06-19 11:06:35 -04:00 • committed by GitHub
parent 2afac3a1a5
commit 8e0798ee16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 2313 additions and 63 deletions

View file

@ -24,6 +24,7 @@ import androidx.media3.exoplayer.trackselection.DefaultTrackSelector
import androidx.media3.exoplayer.video.MediaCodecVideoRenderer
import androidx.media3.exoplayer.video.VideoRendererEventListener
import androidx.media3.extractor.DefaultExtractorsFactory
import androidx.media3.session.MediaSession
import com.github.damontecres.wholphin.preferences.AssPlaybackMode
import com.github.damontecres.wholphin.preferences.MediaExtensionStatus
import com.github.damontecres.wholphin.preferences.PlaybackPreferences
@ -211,6 +212,11 @@ class PlayerFactory
),
)
}
fun createMediaSession(player: Player) =
MediaSession
.Builder(context, player)
.build()
}
val Player.isReleased: Boolean