[vlc-devel] commit: media_list_player test: attempt at fixing test ( Rafaël Carré )

git version control git at videolan.org
Mon Jan 18 09:09:14 CET 2010


vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Mon Jan 18 09:06:49 2010 +0100| [8f9b242ff45f74b59df0aaee81431ea078579036] | committer: Rafaël Carré 

media_list_player test: attempt at fixing test

Replace arbitrary sleep delays by active waiting of state change
Add state change wait where needed (after play()/next()/previous())

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

 test/libvlc/media_list_player.c |   51 +++++++++++++++++++++++++++-----------
 1 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/test/libvlc/media_list_player.c b/test/libvlc/media_list_player.c
index 3f625f6..870875f 100644
--- a/test/libvlc/media_list_player.c
+++ b/test/libvlc/media_list_player.c
@@ -198,29 +198,35 @@ static void test_media_list_player_previous(const char** argv, int argc)
     libvlc_media_list_player_play_item (mlp, md, &ex);
     catch ();
 
-    libvlc_media_release (md);
+    while (!libvlc_media_list_player_is_playing (mlp, &ex))
+        catch() ;
 
-    msleep(100000);
+    libvlc_media_release (md);
 
     libvlc_media_list_player_previous (mlp, &ex);
     catch ();
 
+    while (!libvlc_media_list_player_is_playing (mlp, &ex))
+        catch() ;
+
     libvlc_media_list_player_pause (mlp, &ex);
     catch();
 
-    msleep(100000);
-
     libvlc_media_list_player_previous (mlp, &ex);
     catch ();
 
+    while (!libvlc_media_list_player_is_playing (mlp, &ex))
+        catch() ;
+
     libvlc_media_list_player_stop (mlp, &ex);
     catch ();
 
-    msleep(100000);
-
     libvlc_media_list_player_previous (mlp, &ex);
     catch ();
 
+    while (!libvlc_media_list_player_is_playing (mlp, &ex))
+        catch() ;
+
     libvlc_media_list_player_stop (mlp, &ex);
     catch ();
 
@@ -270,27 +276,33 @@ static void test_media_list_player_next(const char** argv, int argc)
 
     libvlc_media_release (md);
 
-    msleep(100000);
+    while (!libvlc_media_list_player_is_playing (mlp, &ex))
+        catch() ;
 
     libvlc_media_list_player_next (mlp, &ex);
     catch ();
 
+    while (!libvlc_media_list_player_is_playing (mlp, &ex))
+        catch() ;
+
     libvlc_media_list_player_pause (mlp, &ex);
     catch();
 
-    msleep(100000);
-
     libvlc_media_list_player_next (mlp, &ex);
     catch ();
 
+    while (!libvlc_media_list_player_is_playing (mlp, &ex))
+        catch() ;
+
     libvlc_media_list_player_stop (mlp, &ex);
     catch ();
 
-    msleep(100000);
-
     libvlc_media_list_player_next (mlp, &ex);
     catch ();
 
+    while (!libvlc_media_list_player_is_playing (mlp, &ex))
+        catch() ;
+
     libvlc_media_list_player_stop (mlp, &ex);
     catch ();
 
@@ -332,6 +344,9 @@ static void test_media_list_player_pause_stop(const char** argv, int argc)
     libvlc_media_list_player_play_item( mlp, md, &ex );
     catch ();
 
+    while (!libvlc_media_list_player_is_playing (mlp, &ex))
+        catch() ;
+
     libvlc_media_list_player_pause (mlp, &ex);
     catch();
 
@@ -381,6 +396,9 @@ static void test_media_list_player_play_item_at_index(const char** argv, int arg
     libvlc_media_list_player_play_item_at_index( mlp, 0, &ex );
     catch ();
 
+    while (!libvlc_media_list_player_is_playing (mlp, &ex))
+        catch() ;
+
     libvlc_media_list_player_stop (mlp, &ex);
     catch ();
 
@@ -513,6 +531,9 @@ static void test_media_list_player_playback_options (const char** argv, int argc
     libvlc_media_list_player_play_item (mlp, md, &ex);
     catch ();
 
+    while (!libvlc_media_list_player_is_playing (mlp, &ex))
+        catch() ;
+
     libvlc_media_release (md);
     catch ();
     libvlc_media_release (md2);
@@ -524,8 +545,6 @@ static void test_media_list_player_playback_options (const char** argv, int argc
     libvlc_media_release (md5);
     catch ();
 
-    msleep(500000);
-
     libvlc_media_list_player_stop (mlp, &ex);
     catch ();
 
@@ -537,7 +556,8 @@ static void test_media_list_player_playback_options (const char** argv, int argc
     libvlc_media_list_player_play_item (mlp, md, &ex);
     catch ();
 
-    msleep(500000);
+    while (!libvlc_media_list_player_is_playing (mlp, &ex))
+        catch() ;
 
     libvlc_media_list_player_stop (mlp, &ex);
     catch ();
@@ -550,7 +570,8 @@ static void test_media_list_player_playback_options (const char** argv, int argc
     libvlc_media_list_player_play_item (mlp, md, &ex);
     catch ();
 
-    msleep(500000);
+    while (!libvlc_media_list_player_is_playing (mlp, &ex))
+        catch() ;
 
     libvlc_media_list_player_stop (mlp, &ex);
     catch ();




More information about the vlc-devel mailing list