From 49eed2c6065f2e37d4b2620767261c94d5aa49cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Muller?= Date: Tue, 20 Feb 2024 14:41:50 +0100 Subject: [PATCH] Fix `PlayerTimeSlider` not being draggable (#447) --- pillarbox-analytics/build.gradle.kts | 6 ++++++ pillarbox-core-business/build.gradle.kts | 6 ++++++ pillarbox-player/build.gradle.kts | 6 ++++++ .../pillarbox/player/tracker/MediaItemTrackerTest.kt | 9 ++++++--- pillarbox-ui/build.gradle.kts | 6 ++++++ .../java/ch/srgssr/pillarbox/ui/ProgressTrackerState.kt | 2 ++ 6 files changed, 32 insertions(+), 3 deletions(-) diff --git a/pillarbox-analytics/build.gradle.kts b/pillarbox-analytics/build.gradle.kts index 23fa8b7aa..0d1c8fd2a 100644 --- a/pillarbox-analytics/build.gradle.kts +++ b/pillarbox-analytics/build.gradle.kts @@ -1,3 +1,5 @@ +import org.gradle.api.tasks.testing.logging.TestExceptionFormat + /* * Copyright (c) SRG SSR. All rights reserved. * License information is available from the LICENSE file. @@ -58,6 +60,10 @@ android { } } +tasks.withType().configureEach { + testLogging.exceptionFormat = TestExceptionFormat.FULL +} + dependencies { implementation(libs.comscore) implementation(libs.tagcommander.core) diff --git a/pillarbox-core-business/build.gradle.kts b/pillarbox-core-business/build.gradle.kts index 0b087f3c1..c2e30aff7 100644 --- a/pillarbox-core-business/build.gradle.kts +++ b/pillarbox-core-business/build.gradle.kts @@ -1,3 +1,5 @@ +import org.gradle.api.tasks.testing.logging.TestExceptionFormat + /* * Copyright (c) SRG SSR. All rights reserved. * License information is available from the LICENSE file. @@ -53,6 +55,10 @@ android { } } +tasks.withType().configureEach { + testLogging.exceptionFormat = TestExceptionFormat.FULL +} + dependencies { api(project(":pillarbox-analytics")) api(project(":pillarbox-player")) diff --git a/pillarbox-player/build.gradle.kts b/pillarbox-player/build.gradle.kts index e02dd1f54..9c9b7ca26 100644 --- a/pillarbox-player/build.gradle.kts +++ b/pillarbox-player/build.gradle.kts @@ -1,3 +1,5 @@ +import org.gradle.api.tasks.testing.logging.TestExceptionFormat + /* * Copyright (c) SRG SSR. All rights reserved. * License information is available from the LICENSE file. @@ -65,6 +67,10 @@ android { } } +tasks.withType().configureEach { + testLogging.exceptionFormat = TestExceptionFormat.FULL +} + dependencies { implementation(libs.androidx.annotation) implementation(libs.androidx.core) diff --git a/pillarbox-player/src/test/java/ch/srgssr/pillarbox/player/tracker/MediaItemTrackerTest.kt b/pillarbox-player/src/test/java/ch/srgssr/pillarbox/player/tracker/MediaItemTrackerTest.kt index a7f31180a..7d1bf3d78 100644 --- a/pillarbox-player/src/test/java/ch/srgssr/pillarbox/player/tracker/MediaItemTrackerTest.kt +++ b/pillarbox-player/src/test/java/ch/srgssr/pillarbox/player/tracker/MediaItemTrackerTest.kt @@ -566,15 +566,18 @@ class MediaItemTrackerTest { ) prepare() play() + seekTo(FakeMediaItemSource.NEAR_END_POSITION_MS) } TestPlayerRunHelper.runUntilPlaybackState(player, Player.STATE_READY) TestPlayerRunHelper.runUntilTimelineChanged(player) + fakeClock.advanceTime(FakeMediaItemSource.NEAR_END_POSITION_MS) + verifyOrder { - fakeMediaItemTracker.start(any(), FakeMediaItemTracker.Data(firstMediaId)) - fakeMediaItemTracker.stop(any(), MediaItemTracker.StopReason.EoF, any()) - fakeMediaItemTracker.start(any(), FakeMediaItemTracker.Data(secondMediaId)) + fakeMediaItemTracker.start(player, FakeMediaItemTracker.Data(firstMediaId)) + fakeMediaItemTracker.stop(player, MediaItemTracker.StopReason.EoF, any()) + fakeMediaItemTracker.start(player, FakeMediaItemTracker.Data(secondMediaId)) } confirmVerified(fakeMediaItemTracker) } diff --git a/pillarbox-ui/build.gradle.kts b/pillarbox-ui/build.gradle.kts index 50c7607a9..ef0b34450 100644 --- a/pillarbox-ui/build.gradle.kts +++ b/pillarbox-ui/build.gradle.kts @@ -1,3 +1,5 @@ +import org.gradle.api.tasks.testing.logging.TestExceptionFormat + /* * Copyright (c) SRG SSR. All rights reserved. * License information is available from the LICENSE file. @@ -50,6 +52,10 @@ android { } } +tasks.withType().configureEach { + testLogging.exceptionFormat = TestExceptionFormat.FULL +} + dependencies { api(project(":pillarbox-player")) diff --git a/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/ProgressTrackerState.kt b/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/ProgressTrackerState.kt index a4373b44a..d8da00b37 100644 --- a/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/ProgressTrackerState.kt +++ b/pillarbox-ui/src/main/java/ch/srgssr/pillarbox/ui/ProgressTrackerState.kt @@ -4,6 +4,7 @@ */ package ch.srgssr.pillarbox.ui +import androidx.compose.runtime.Stable import androidx.media3.common.Player import kotlinx.coroutines.flow.StateFlow import kotlin.time.Duration @@ -11,6 +12,7 @@ import kotlin.time.Duration /** * Interface used to subscribe to and update the [Player] progression. */ +@Stable interface ProgressTrackerState { /** * Emits the current progress, which can be either the value being manually set, or the actual [Player] progress.