1 /*****************************************************************************
2 * MediaListPlayerTest.java: VLC Java Bindings
3 *****************************************************************************
4 * Copyright (C) 1998-2008 the VideoLAN team
6 * Authors: Filippo Carone <filippo@carone.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
24 *****************************************************************************/
26 package org.videolan.jvlc.internal;
28 import junit.framework.Assert;
30 import org.junit.After;
31 import org.junit.Before;
32 import org.junit.Test;
33 import org.videolan.jvlc.internal.LibVlc.LibVlcInstance;
34 import org.videolan.jvlc.internal.LibVlc.LibVlcMediaDescriptor;
35 import org.videolan.jvlc.internal.LibVlc.LibVlcMediaList;
36 import org.videolan.jvlc.internal.LibVlc.LibVlcMediaListPlayer;
37 import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
40 public class MediaListPlayerTest
43 private LibVlc libvlc = LibVlc.SYNC_INSTANCE;
45 private LibVlcInstance libvlcInstance;
47 private String mrl = this.getClass().getResource("/raffa_voice.ogg").getPath();
51 public void testSetup()
53 libvlc_exception_t exception = new libvlc_exception_t();
54 libvlcInstance = libvlc.libvlc_new(0, new String[]{}, exception);
58 public void tearDown()
60 libvlc.libvlc_release(libvlcInstance);
64 public void mediaListPlayerNewTest()
66 libvlc_exception_t exception = new libvlc_exception_t();
67 LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
68 Assert.assertNotNull(mediaListPlayer);
69 Assert.assertEquals(0, exception.raised);
73 public void mediaListPlayerSetMediaListTest()
75 libvlc_exception_t exception = new libvlc_exception_t();
76 LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
77 LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
78 libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
79 Assert.assertEquals(0, exception.raised);
83 public void mediaListPlayerSetMediaListTest2()
85 libvlc_exception_t exception = new libvlc_exception_t();
86 LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
87 LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
88 LibVlcMediaDescriptor mediaDescriptor = libvlc.libvlc_media_descriptor_new(libvlcInstance, mrl, exception);
89 libvlc.libvlc_media_list_add_media_descriptor(mediaList, mediaDescriptor, exception);
90 libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
91 Assert.assertEquals(0, exception.raised);
95 public void mediaListPlayerIsPlayingTest()
97 libvlc_exception_t exception = new libvlc_exception_t();
98 LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
99 int result = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception);
100 Assert.assertEquals(0, result);
101 Assert.assertEquals(0, exception.raised);
105 public void mediaListPlayerPlayNoItemTest()
107 libvlc_exception_t exception = new libvlc_exception_t();
108 LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
109 libvlc.libvlc_media_list_player_play(mediaListPlayer, exception);
110 Assert.assertEquals(1, exception.raised);
115 * disabled: see https://trac.videolan.org/vlc/attachment/ticket/1527
117 public void mediaListPlayerPlay()
119 libvlc_exception_t exception = new libvlc_exception_t();
120 LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
121 LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
122 LibVlcMediaDescriptor mediaDescriptor = libvlc.libvlc_media_descriptor_new(libvlcInstance, mrl, exception);
123 libvlc.libvlc_media_list_add_media_descriptor(mediaList, mediaDescriptor, exception);
124 libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
125 libvlc.libvlc_media_list_player_play(mediaListPlayer, exception);