]> git.sesse.net Git - vlc/blobdiff - bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaListPlayerTest.java
jvlc: minor changes on unit tests
[vlc] / bindings / java / core / src / test / java / org / videolan / jvlc / internal / MediaListPlayerTest.java
index ab4bedb33b2c3517342edea965390f36352ab1c2..8a6b0f3330ed23f6d4bdf7f8a5db42a2f020ac5c 100644 (file)
@@ -27,10 +27,7 @@ package org.videolan.jvlc.internal;
 
 import junit.framework.Assert;
 
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
-import org.videolan.jvlc.internal.LibVlc.LibVlcInstance;
 import org.videolan.jvlc.internal.LibVlc.LibVlcMediaDescriptor;
 import org.videolan.jvlc.internal.LibVlc.LibVlcMediaInstance;
 import org.videolan.jvlc.internal.LibVlc.LibVlcMediaList;
@@ -38,30 +35,9 @@ import org.videolan.jvlc.internal.LibVlc.LibVlcMediaListPlayer;
 import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
 
 
-public class MediaListPlayerTest
+public class MediaListPlayerTest extends AbstractVLCInternalTest
 {
 
-    private LibVlc libvlc = LibVlc.SYNC_INSTANCE;
-
-    private LibVlcInstance libvlcInstance;
-
-    private String mrl = this.getClass().getResource("/raffa_voice.ogg").getPath();
-
-    @Before
-    public void testSetup() throws Exception
-    {
-        libvlc_exception_t exception = new libvlc_exception_t();
-        libvlcInstance = libvlc.libvlc_new(0, new String[]{"-I", "dummy", "--aout=dummy", "--vout=dummy" }, exception);
-        // use the following line to use your audio card.
-        // libvlcInstance = libvlc.libvlc_new(0, new String[]{}, exception);
-    }
-
-    @After
-    public void tearDown()
-    {
-        libvlc.libvlc_release(libvlcInstance);
-    }
-
     @Test
     public void mediaListPlayerNewTest()
     {
@@ -122,7 +98,7 @@ public class MediaListPlayerTest
     /**
      * this fails: see https://trac.videolan.org/vlc/ticket/1527
      */
-    // @Test
+    @Test
     public void mediaListPlayerPlay()
     {
         libvlc_exception_t exception = new libvlc_exception_t();
@@ -191,21 +167,19 @@ public class MediaListPlayerTest
             }
             Thread.sleep(150);
         }
-        // FIXME give stats the time to run... there's probably a race condition in misc/stats.c:259 that
-        // needs to be fixed
-        // Thread.sleep(400);
+        Thread.sleep(400);
         libvlc.libvlc_media_list_player_stop(mediaListPlayer, exception);
         libvlc.libvlc_media_list_release(mediaList);
         libvlc.libvlc_media_list_player_release(mediaListPlayer);
     }
 
     @Test
-    public void mediaListPlayerGetStateStopped()
+    public void mediaListPlayerGetStateEnded()
     {
         libvlc_exception_t exception = new libvlc_exception_t();
         LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
         int state = libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception);
-        Assert.assertEquals(LibVlcState.libvlc_Stopped.ordinal(), state);
+        Assert.assertEquals(LibVlcState.libvlc_Ended.ordinal(), state);
         libvlc.libvlc_media_list_player_release(mediaListPlayer);
     }
 
@@ -233,20 +207,7 @@ public class MediaListPlayerTest
             Thread.sleep(150);
         }
         libvlc.libvlc_media_list_player_pause(mediaListPlayer, exception);
-        Assert.assertEquals(exception.message, 0, exception.raised);
-        while (true)
-        {
-            int playing = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception);
-            if (exception.raised == 1)
-            {
-                throw new RuntimeException("Native exception thrown");
-            }
-            if (playing == 0)
-            {
-                break;
-            }
-            Thread.sleep(150);
-        }
+
         int state = libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception);
         Assert.assertEquals(exception.message, 0, exception.raised);
         Assert.assertEquals(
@@ -331,7 +292,7 @@ public class MediaListPlayerTest
             }
             Thread.sleep(150);
         }
-        Assert.assertEquals(LibVlcState.libvlc_Stopped.ordinal(), libvlc.libvlc_media_list_player_get_state(
+        Assert.assertEquals(LibVlcState.libvlc_Ended.ordinal(), libvlc.libvlc_media_list_player_get_state(
             mediaListPlayer,
             exception));
         libvlc.libvlc_media_list_release(mediaList);