[vlc-devel] commit: test: Fix media_player test. (Pierre d'Herbemont )

git version control git at videolan.org
Thu May 21 07:39:55 CEST 2009


vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Wed May 20 22:38:00 2009 -0700| [3ff6ba0b535eeffe15ae085753eee4761b9842ab] | committer: Pierre d'Herbemont 

test: Fix media_player test.

libvlc_Ended is the state we want to check.
When paused, if the media ended before, we need to allow that state.

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

 test/libvlc/media_player.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/test/libvlc/media_player.c b/test/libvlc/media_player.c
index 301dc0c..2774fda 100644
--- a/test/libvlc/media_player.c
+++ b/test/libvlc/media_player.c
@@ -54,9 +54,9 @@ static void test_media_player_play_stop(const char** argv, int argc)
         catch ();
     } while( state != libvlc_Playing &&
              state != libvlc_Error &&
-             state != libvlc_MediaPlayerEndReached );
+             state != libvlc_Ended );
 
-    assert( state == libvlc_Playing || state == libvlc_MediaPlayerEndReached );
+    assert( state == libvlc_Playing || state == libvlc_Ended );
 
     libvlc_media_player_stop (mi, &ex);
     catch ();
@@ -75,7 +75,7 @@ static void test_media_player_pause_stop(const char** argv, int argc)
     libvlc_media_player_t *mi;
     const char * file = test_default_sample;
 
-    log ("Testing play and pause of %s\n", file);
+    log ("Testing pause and stop of %s\n", file);
 
     libvlc_exception_init (&ex);
     vlc = libvlc_new (argc, argv, &ex);
@@ -92,6 +92,8 @@ static void test_media_player_pause_stop(const char** argv, int argc)
     libvlc_media_player_play (mi, &ex);
     catch ();
 
+    log ("Waiting for playing\n");
+
     /* Wait a correct state */
     libvlc_state_t state;
     do {
@@ -99,11 +101,14 @@ static void test_media_player_pause_stop(const char** argv, int argc)
         catch ();
     } while( state != libvlc_Playing &&
              state != libvlc_Error &&
-             state != libvlc_MediaPlayerEndReached );
+             state != libvlc_Ended );
 
-    assert( state == libvlc_Playing || state == libvlc_MediaPlayerEndReached );
+    assert( state == libvlc_Playing || state == libvlc_Ended );
 
     libvlc_media_player_pause (mi, &ex);
+    catch();
+
+    log ("Waiting for pause\n");
 
     /* Wait a correct state */
     do {
@@ -111,9 +116,9 @@ static void test_media_player_pause_stop(const char** argv, int argc)
         catch ();
     } while( state != libvlc_Paused &&
             state != libvlc_Error &&
-            state != libvlc_MediaPlayerEndReached );
+            state != libvlc_Ended );
 
-    assert( libvlc_media_player_get_state (mi, &ex) == libvlc_Paused );
+    assert( state == libvlc_Paused || state == libvlc_Ended );
     catch();
 
     libvlc_media_player_stop (mi, &ex);




More information about the vlc-devel mailing list