]> git.sesse.net Git - vlc/blobdiff - src/control/testapi.c
fix testapi test: libvlc_instance_(play|pause|stop) are asynchronous, so wait for...
[vlc] / src / control / testapi.c
index e4388ec98b5ef58b1e17101f33da8608242d685d..8149f5b1c6159b19919e61fc99e868264df51e26 100644 (file)
@@ -50,9 +50,13 @@ static void catch (void)
     libvlc_exception_clear (&ex);
 }
 
+/* Test we have */
 static void test_core (const char ** argv, int argc);
 static void test_media_list (const char ** argv, int argc);
+static void test_events (const char ** argv, int argc);
+static void test_media_player_play_stop(const char** argv, int argc);
 
+/* Tests implementations */
 static void test_core (const char ** argv, int argc)
 {
     libvlc_instance_t *vlc;
@@ -113,45 +117,6 @@ static void test_media_list (const char ** argv, int argc)
     catch ();
 }
 
-static void test_file_playback (const char ** argv, int argc, const char * file)
-{
-    libvlc_instance_t *vlc;
-    libvlc_media_descriptor_t *md;
-    libvlc_media_instance_t *mi;
-
-    log ("Testing playback of %s\n", file);
-
-    libvlc_exception_init (&ex);
-    vlc = libvlc_new (argc, argv, &ex);
-    catch ();
-
-    md = libvlc_media_descriptor_new (vlc, file, &ex);
-    catch ();
-
-    mi = libvlc_media_instance_new_from_media_descriptor (md, &ex);
-    catch ();
-    
-    libvlc_media_descriptor_release (md);
-
-    libvlc_media_instance_play (mi, &ex);
-    catch ();
-
-    /* FIXME: Do something clever */
-    sleep(1);
-
-    assert( libvlc_media_instance_get_state (mi, &ex) != libvlc_Error );
-    catch ();
-
-    libvlc_media_instance_stop (mi, &ex);
-    catch ();
-
-    libvlc_media_instance_release (mi);
-    catch ();
-
-    libvlc_release (vlc);
-    catch ();
-}
-
 /* This one is an internal API. We use it here to run tests that
  * don't depends on playback, and only test the event framework */
 extern void libvlc_event_send( libvlc_event_manager_t *, libvlc_event_t *);
@@ -264,9 +229,9 @@ static void test_media_player_play_stop(const char** argv, int argc)
     libvlc_instance_t *vlc;
     libvlc_media_descriptor_t *md;
     libvlc_media_instance_t *mi;
-    const char** file = "../bindings/java/core/src/test/resources/raffa_voice.ogg";
+    const char * file = "file://../bindings/java/core/src/test/resources/raffa_voice.ogg";
 
-    log ("Testing playback of %s\n", file);
+    log ("Testing play and pause of %s\n", file);
 
     libvlc_exception_init (&ex);
     vlc = libvlc_new (argc, argv, &ex);
@@ -291,13 +256,13 @@ static void test_media_player_play_stop(const char** argv, int argc)
 
     libvlc_media_instance_stop (mi, &ex);
     catch ();
+    sleep(1);
 
     libvlc_media_instance_release (mi);
     catch ();
 
     libvlc_release (vlc);
     catch ();
-    
 }
 
 int main (int argc, char *argv[])
@@ -318,11 +283,11 @@ int main (int argc, char *argv[])
 
     test_core (args, nlibvlc_args);
 
-    test_media_player_play_stop(args, nlibvlc_args);
-
     test_events (args, nlibvlc_args);
 
     test_media_list (args, nlibvlc_args);
 
+    test_media_player_play_stop(args, nlibvlc_args);
+
     return 0;
 }