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.LibVlcMediaList;
import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-public class MediaListTest
+public class MediaListTest extends AbstractVLCInternalTest
{
- private LibVlc libvlc = LibVlc.INSTANCE;
-
- private LibVlcInstance libvlcInstance;
-
- @Before
- public void testSetup()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlcInstance = libvlc.libvlc_new(0, new String[]{}, exception);
- }
-
- @After
- public void tearDown()
- {
- libvlc.libvlc_release(libvlcInstance);
- }
-
@Test
public void mediaListNew()
{
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(
+ LibVlcMediaDescriptor libvlc_media = libvlc.libvlc_media_new(
libvlcInstance,
mrl,
exception);
- libvlc.libvlc_media_list_add_media_descriptor(mediaList, libvlc_media_descriptor, exception);
+ libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
Assert.assertEquals(0, exception.raised);
}
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(
+ LibVlcMediaDescriptor libvlc_media = libvlc.libvlc_media_new(
libvlcInstance,
mrl,
exception);
- libvlc.libvlc_media_list_add_media_descriptor(mediaList, libvlc_media_descriptor, exception);
+ libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
int result = libvlc.libvlc_media_list_count(mediaList, exception);
Assert.assertEquals(1, result);
Assert.assertEquals(0, exception.raised);
- libvlc.libvlc_media_list_add_media_descriptor(mediaList, libvlc_media_descriptor, exception);
+ libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
result = libvlc.libvlc_media_list_count(mediaList, exception);
Assert.assertEquals(2, result);
Assert.assertEquals(0, exception.raised);
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(
+ LibVlcMediaDescriptor libvlc_media = libvlc.libvlc_media_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);
+ libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
+ int index = libvlc.libvlc_media_list_index_of_item(mediaList, libvlc_media, exception);
Assert.assertEquals(0, index);
Assert.assertEquals(0, exception.raised);
}
+ @Test
+ public void mediaListRemoveIndexTest()
+ {
+ 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 = libvlc.libvlc_media_new(
+ libvlcInstance,
+ mrl,
+ exception);
+ libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
+ libvlc.libvlc_media_list_remove_index(mediaList, 0, exception);
+ Assert.assertEquals(0, exception.raised);
+ }
+
+ @Test
+ public void mediaListRemoveIndexTest2()
+ {
+ 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 = libvlc.libvlc_media_new(
+ libvlcInstance,
+ mrl,
+ exception);
+ libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
+ libvlc.libvlc_media_list_remove_index(mediaList, 0, exception);
+ Assert.assertEquals(0, exception.raised);
+
+ libvlc_media = libvlc.libvlc_media_new(
+ libvlcInstance,
+ mrl,
+ exception);
+ libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
+ libvlc.libvlc_media_list_remove_index(mediaList, 0, exception);
+ }
+
}