[vlc-commits] test: lib: media_player: pause can now be always tested

Thomas Guillem git at videolan.org
Thu Jun 11 14:45:51 CEST 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jun  9 17:21:42 2020 +0200| [36038444a3e09003bc7bd49bdd98a129164807f5] | committer: Thomas Guillem

test: lib: media_player: pause can now be always tested

Since the mock:// duration is 5seconds.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=36038444a3e09003bc7bd49bdd98a129164807f5
---

 test/libvlc/media_player.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/test/libvlc/media_player.c b/test/libvlc/media_player.c
index 5a7cb3e216..a3b2d3e82f 100644
--- a/test/libvlc/media_player.c
+++ b/test/libvlc/media_player.c
@@ -59,20 +59,17 @@ static void pause_and_wait(libvlc_media_player_t *mp)
     int res;
     res = libvlc_event_attach(em, libvlc_MediaPlayerPaused, on_event, &sem);
     assert(!res);
-    res = libvlc_event_attach(em, libvlc_MediaPlayerEndReached, on_event, &sem);
-    assert(!res);
+
+    assert(libvlc_media_player_get_state(mp) == libvlc_Playing);
 
     libvlc_media_player_set_pause(mp, true);
 
-    /* the end may have been already reached before attaching the event */
-    if (libvlc_media_player_get_state(mp) == libvlc_Playing)
-    {
-        test_log("Waiting for pause\n");
-        vlc_sem_wait(&sem);
-    }
+    test_log("Waiting for pause\n");
+    vlc_sem_wait(&sem);
+
+    assert(libvlc_media_player_get_state(mp) == libvlc_Paused);
 
     libvlc_event_detach(em, libvlc_MediaPlayerPaused, on_event, &sem);
-    libvlc_event_detach(em, libvlc_MediaPlayerEndReached, on_event, &sem);
 }
 
 /* Test a bunch of A/V properties. This most does nothing since the current



More information about the vlc-commits mailing list