Commit 6b8e5d9b authored by Filippo Carone's avatar Filippo Carone

more media list unit tests

parent 72d14823
...@@ -36,17 +36,18 @@ import org.videolan.jvlc.internal.LibVlc.LibVlcMediaList; ...@@ -36,17 +36,18 @@ import org.videolan.jvlc.internal.LibVlc.LibVlcMediaList;
import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t; import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
public class MediaListTest public class MediaListTest
{ {
private LibVlc libvlc = LibVlc.INSTANCE; private LibVlc libvlc = LibVlc.INSTANCE;
private LibVlcInstance libvlcInstance; private LibVlcInstance libvlcInstance;
@Before @Before
public void testSetup() public void testSetup()
{ {
libvlc_exception_t exception = new libvlc_exception_t(); libvlc_exception_t exception = new libvlc_exception_t();
libvlcInstance = libvlc.libvlc_new(0, new String[] {}, exception ); libvlcInstance = libvlc.libvlc_new(0, new String[]{}, exception);
} }
@After @After
...@@ -70,8 +71,11 @@ public class MediaListTest ...@@ -70,8 +71,11 @@ public class MediaListTest
libvlc_exception_t exception = new libvlc_exception_t(); libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception); LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
String mrl = this.getClass().getResource("/raffa_voice.ogg").getPath(); String mrl = this.getClass().getResource("/raffa_voice.ogg").getPath();
LibVlcMediaDescriptor libvlc_media_descriptor = libvlc.libvlc_media_descriptor_new(libvlcInstance, mrl, exception); LibVlcMediaDescriptor libvlc_media_descriptor = libvlc.libvlc_media_descriptor_new(
libvlc.libvlc_media_list_add_media_descriptor(mediaList, libvlc_media_descriptor , exception); libvlcInstance,
mrl,
exception);
libvlc.libvlc_media_list_add_media_descriptor(mediaList, libvlc_media_descriptor, exception);
Assert.assertEquals(0, exception.raised); Assert.assertEquals(0, exception.raised);
} }
...@@ -81,15 +85,44 @@ public class MediaListTest ...@@ -81,15 +85,44 @@ public class MediaListTest
libvlc_exception_t exception = new libvlc_exception_t(); libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception); LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
String mrl = this.getClass().getResource("/raffa_voice.ogg").getPath(); String mrl = this.getClass().getResource("/raffa_voice.ogg").getPath();
LibVlcMediaDescriptor libvlc_media_descriptor = libvlc.libvlc_media_descriptor_new(libvlcInstance, mrl, exception); LibVlcMediaDescriptor libvlc_media_descriptor = libvlc.libvlc_media_descriptor_new(
libvlc.libvlc_media_list_add_media_descriptor(mediaList, libvlc_media_descriptor , exception); libvlcInstance,
mrl,
exception);
libvlc.libvlc_media_list_add_media_descriptor(mediaList, libvlc_media_descriptor, exception);
int result = libvlc.libvlc_media_list_count(mediaList, exception); int result = libvlc.libvlc_media_list_count(mediaList, exception);
Assert.assertEquals(1, result); Assert.assertEquals(1, result);
Assert.assertEquals(0, exception.raised); Assert.assertEquals(0, exception.raised);
libvlc.libvlc_media_list_add_media_descriptor(mediaList, libvlc_media_descriptor , exception); libvlc.libvlc_media_list_add_media_descriptor(mediaList, libvlc_media_descriptor, exception);
result = libvlc.libvlc_media_list_count(mediaList, exception); result = libvlc.libvlc_media_list_count(mediaList, exception);
Assert.assertEquals(2, result); Assert.assertEquals(2, result);
Assert.assertEquals(0, exception.raised); Assert.assertEquals(0, exception.raised);
} }
@Test
public void mediaListEventManagerTest()
{
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
Assert.assertNotNull(libvlc.libvlc_media_list_event_manager(mediaList, exception));
Assert.assertEquals(0, exception.raised);
}
@Test
public void mediaListIndexOfItemTest()
{
libvlc_exception_t exception = new libvlc_exception_t();
LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
String mrl = this.getClass().getResource("/raffa_voice.ogg").getPath();
LibVlcMediaDescriptor libvlc_media_descriptor = libvlc.libvlc_media_descriptor_new(
libvlcInstance,
mrl,
exception);
libvlc.libvlc_media_list_add_media_descriptor(mediaList, libvlc_media_descriptor, exception);
int index = libvlc.libvlc_media_list_index_of_item(mediaList, libvlc_media_descriptor, exception);
Assert.assertEquals(0, index);
Assert.assertEquals(0, exception.raised);
}
} }
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