Commit 8f9b242f authored by Rafaël Carré's avatar 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())
parent 3b7fe96c
...@@ -198,29 +198,35 @@ static void test_media_list_player_previous(const char** argv, int argc) ...@@ -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); libvlc_media_list_player_play_item (mlp, md, &ex);
catch (); 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); libvlc_media_list_player_previous (mlp, &ex);
catch (); catch ();
while (!libvlc_media_list_player_is_playing (mlp, &ex))
catch() ;
libvlc_media_list_player_pause (mlp, &ex); libvlc_media_list_player_pause (mlp, &ex);
catch(); catch();
msleep(100000);
libvlc_media_list_player_previous (mlp, &ex); libvlc_media_list_player_previous (mlp, &ex);
catch (); catch ();
while (!libvlc_media_list_player_is_playing (mlp, &ex))
catch() ;
libvlc_media_list_player_stop (mlp, &ex); libvlc_media_list_player_stop (mlp, &ex);
catch (); catch ();
msleep(100000);
libvlc_media_list_player_previous (mlp, &ex); libvlc_media_list_player_previous (mlp, &ex);
catch (); catch ();
while (!libvlc_media_list_player_is_playing (mlp, &ex))
catch() ;
libvlc_media_list_player_stop (mlp, &ex); libvlc_media_list_player_stop (mlp, &ex);
catch (); catch ();
...@@ -270,27 +276,33 @@ static void test_media_list_player_next(const char** argv, int argc) ...@@ -270,27 +276,33 @@ static void test_media_list_player_next(const char** argv, int argc)
libvlc_media_release (md); libvlc_media_release (md);
msleep(100000); while (!libvlc_media_list_player_is_playing (mlp, &ex))
catch() ;
libvlc_media_list_player_next (mlp, &ex); libvlc_media_list_player_next (mlp, &ex);
catch (); catch ();
while (!libvlc_media_list_player_is_playing (mlp, &ex))
catch() ;
libvlc_media_list_player_pause (mlp, &ex); libvlc_media_list_player_pause (mlp, &ex);
catch(); catch();
msleep(100000);
libvlc_media_list_player_next (mlp, &ex); libvlc_media_list_player_next (mlp, &ex);
catch (); catch ();
while (!libvlc_media_list_player_is_playing (mlp, &ex))
catch() ;
libvlc_media_list_player_stop (mlp, &ex); libvlc_media_list_player_stop (mlp, &ex);
catch (); catch ();
msleep(100000);
libvlc_media_list_player_next (mlp, &ex); libvlc_media_list_player_next (mlp, &ex);
catch (); catch ();
while (!libvlc_media_list_player_is_playing (mlp, &ex))
catch() ;
libvlc_media_list_player_stop (mlp, &ex); libvlc_media_list_player_stop (mlp, &ex);
catch (); catch ();
...@@ -332,6 +344,9 @@ static void test_media_list_player_pause_stop(const char** argv, int argc) ...@@ -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 ); libvlc_media_list_player_play_item( mlp, md, &ex );
catch (); catch ();
while (!libvlc_media_list_player_is_playing (mlp, &ex))
catch() ;
libvlc_media_list_player_pause (mlp, &ex); libvlc_media_list_player_pause (mlp, &ex);
catch(); catch();
...@@ -381,6 +396,9 @@ static void test_media_list_player_play_item_at_index(const char** argv, int arg ...@@ -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 ); libvlc_media_list_player_play_item_at_index( mlp, 0, &ex );
catch (); catch ();
while (!libvlc_media_list_player_is_playing (mlp, &ex))
catch() ;
libvlc_media_list_player_stop (mlp, &ex); libvlc_media_list_player_stop (mlp, &ex);
catch (); catch ();
...@@ -513,6 +531,9 @@ static void test_media_list_player_playback_options (const char** argv, int argc ...@@ -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); libvlc_media_list_player_play_item (mlp, md, &ex);
catch (); catch ();
while (!libvlc_media_list_player_is_playing (mlp, &ex))
catch() ;
libvlc_media_release (md); libvlc_media_release (md);
catch (); catch ();
libvlc_media_release (md2); libvlc_media_release (md2);
...@@ -524,8 +545,6 @@ static void test_media_list_player_playback_options (const char** argv, int argc ...@@ -524,8 +545,6 @@ static void test_media_list_player_playback_options (const char** argv, int argc
libvlc_media_release (md5); libvlc_media_release (md5);
catch (); catch ();
msleep(500000);
libvlc_media_list_player_stop (mlp, &ex); libvlc_media_list_player_stop (mlp, &ex);
catch (); catch ();
...@@ -537,7 +556,8 @@ static void test_media_list_player_playback_options (const char** argv, int argc ...@@ -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); libvlc_media_list_player_play_item (mlp, md, &ex);
catch (); catch ();
msleep(500000); while (!libvlc_media_list_player_is_playing (mlp, &ex))
catch() ;
libvlc_media_list_player_stop (mlp, &ex); libvlc_media_list_player_stop (mlp, &ex);
catch (); catch ();
...@@ -550,7 +570,8 @@ static void test_media_list_player_playback_options (const char** argv, int argc ...@@ -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); libvlc_media_list_player_play_item (mlp, md, &ex);
catch (); catch ();
msleep(500000); while (!libvlc_media_list_player_is_playing (mlp, &ex))
catch() ;
libvlc_media_list_player_stop (mlp, &ex); libvlc_media_list_player_stop (mlp, &ex);
catch (); catch ();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment