[vlc-commits] test/media: test subitems parsing failure

Thomas Guillem git at videolan.org
Sun Apr 17 07:22:33 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Apr 14 12:48:04 2016 +0200| [70cd3eda382002f31f7c4385111154fbd09e3921] | committer: Thomas Guillem

test/media: test subitems parsing failure

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

 test/libvlc/media.c |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/test/libvlc/media.c b/test/libvlc/media.c
index b72a9c2..33fe1d9 100644
--- a/test/libvlc/media.c
+++ b/test/libvlc/media.c
@@ -131,7 +131,8 @@ static void subitem_added(const libvlc_event_t *event, void *user_data)
 #undef FILE_SEPARATOR
 }
 
-static void test_media_subitems_media(libvlc_media_t *media, bool play)
+static void test_media_subitems_media(libvlc_media_t *media, bool play,
+                                      bool b_items_expected)
 {
     libvlc_media_add_option(media, ":ignore-filetypes= ");
 
@@ -166,6 +167,9 @@ static void test_media_subitems_media(libvlc_media_t *media, bool play)
 
     vlc_sem_destroy (&sem);
 
+    if (!b_items_expected)
+        return;
+
     for (unsigned i = 0; i < TEST_SUBITEMS_COUNT; ++i)
     {
         log ("test if %s was added\n", test_media_subitems_list[i].file);
@@ -184,7 +188,7 @@ static void test_media_subitems(int argc, const char** argv)
     log ("Testing media_subitems: path: '%s'\n", subitems_path);
     media = libvlc_media_new_path (vlc, subitems_path);
     assert (media != NULL);
-    test_media_subitems_media (media, false);
+    test_media_subitems_media (media, false, true);
     libvlc_media_release (media);
 
     #define NB_LOCATIONS 2
@@ -198,7 +202,7 @@ static void test_media_subitems(int argc, const char** argv)
         log ("Testing media_subitems: location: '%s'\n", location);
         media = libvlc_media_new_location (vlc, location);
         assert (media != NULL);
-        test_media_subitems_media (media, false);
+        test_media_subitems_media (media, false, true);
         free (location);
         libvlc_media_release (media);
     }
@@ -211,13 +215,19 @@ static void test_media_subitems(int argc, const char** argv)
     assert (fd >= 0);
     media = libvlc_media_new_fd (vlc, fd);
     assert (media != NULL);
-    test_media_subitems_media (media, true);
+    test_media_subitems_media (media, true, true);
     libvlc_media_release (media);
     close (fd);
 #else
 #warning not testing subitems list via a fd location
 #endif
 
+    log ("Testing media_subitems failure\n");
+    media = libvlc_media_new_location (vlc, "wrongfile://test");
+    assert (media != NULL);
+    test_media_subitems_media (media, false, false);
+    libvlc_media_release (media);
+
     libvlc_release (vlc);
 }
 



More information about the vlc-commits mailing list