mirror of
https://code.videolan.org/videolan/vlc
synced 2024-09-12 13:44:56 +02:00
test: Get rid of the sleep() that crept in our test code.
This commit is contained in:
parent
35dc9b31f0
commit
6d6185f24f
@ -52,7 +52,6 @@ static void test_media_list_player_pause_stop(const char** argv, int argc)
|
||||
libvlc_media_list_player_set_media_list( mlp, ml, &ex );
|
||||
|
||||
libvlc_media_list_player_play_item( mlp, md, &ex );
|
||||
sleep(1); // play is asynchronous
|
||||
catch ();
|
||||
|
||||
libvlc_media_list_player_pause (mlp, &ex);
|
||||
|
@ -47,11 +47,16 @@ static void test_media_player_play_stop(const char** argv, int argc)
|
||||
libvlc_media_player_play (mi, &ex);
|
||||
catch ();
|
||||
|
||||
/* FIXME: Do something clever */
|
||||
sleep(1);
|
||||
/* Wait a correct state */
|
||||
libvlc_state_t state;
|
||||
do {
|
||||
state = libvlc_media_player_get_state (mi, &ex);
|
||||
catch ();
|
||||
} while( state != libvlc_Playing &&
|
||||
state != libvlc_Error &&
|
||||
state != libvlc_MediaPlayerEndReached );
|
||||
|
||||
assert( libvlc_media_player_get_state (mi, &ex) != libvlc_Error );
|
||||
catch ();
|
||||
assert( state == libvlc_Playing || state == libvlc_MediaPlayerEndReached );
|
||||
|
||||
libvlc_media_player_stop (mi, &ex);
|
||||
catch ();
|
||||
@ -87,11 +92,16 @@ static void test_media_player_pause_stop(const char** argv, int argc)
|
||||
libvlc_media_player_play (mi, &ex);
|
||||
catch ();
|
||||
|
||||
/* FIXME: Do something clever */
|
||||
sleep(1);
|
||||
/* Wait a correct state */
|
||||
libvlc_state_t state;
|
||||
do {
|
||||
state = libvlc_media_player_get_state (mi, &ex);
|
||||
catch ();
|
||||
} while( state != libvlc_Playing &&
|
||||
state != libvlc_Error &&
|
||||
state != libvlc_MediaPlayerEndReached );
|
||||
|
||||
assert( libvlc_media_player_get_state (mi, &ex) == libvlc_Playing );
|
||||
catch ();
|
||||
assert( state == libvlc_Playing || state == libvlc_MediaPlayerEndReached );
|
||||
|
||||
libvlc_media_player_pause (mi, &ex);
|
||||
assert( libvlc_media_player_get_state (mi, &ex) == libvlc_Paused );
|
||||
|
Loading…
Reference in New Issue
Block a user