]> git.sesse.net Git - vlc/blob - bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaListPlayerTest.java
new (failing) test for ticket #1527 added
[vlc] / bindings / java / core / src / test / java / org / videolan / jvlc / internal / MediaListPlayerTest.java
1 /*****************************************************************************
2  * MediaListPlayerTest.java: VLC Java Bindings
3  *****************************************************************************
4  * Copyright (C) 1998-2008 the VideoLAN team
5  *
6  * Authors: Filippo Carone <filippo@carone.org>
7  *
8  *
9  * $Id $
10  *
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.
15  *
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.
20  *
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  *****************************************************************************/
25
26 package org.videolan.jvlc.internal;
27
28 import junit.framework.Assert;
29
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;
38
39
40 public class MediaListPlayerTest
41 {
42     
43     private LibVlc libvlc = LibVlc.SYNC_INSTANCE;
44
45     private LibVlcInstance libvlcInstance;
46     
47     private String mrl = this.getClass().getResource("/raffa_voice.ogg").getPath();
48
49
50     @Before
51     public void testSetup()
52     {
53         libvlc_exception_t exception = new libvlc_exception_t();
54         libvlcInstance = libvlc.libvlc_new(0, new String[]{}, exception);
55     }
56
57     @After
58     public void tearDown()
59     {
60         libvlc.libvlc_release(libvlcInstance);
61     }
62
63     @Test
64     public void mediaListPlayerNewTest()
65     {
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);
70     }
71     
72     @Test
73     public void mediaListPlayerSetMediaListTest()
74     {
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);
80     }
81     
82     @Test
83     public void mediaListPlayerSetMediaListTest2()
84     {
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);
92     }
93     
94     @Test
95     public void mediaListPlayerIsPlayingTest()
96     {
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);
102     }
103
104     @Test
105     public void mediaListPlayerPlayNoItemTest()
106     {
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);
111     }
112     
113 //    @Test
114     /**
115      * disabled: see https://trac.videolan.org/vlc/attachment/ticket/1527
116      */
117     public void mediaListPlayerPlay()
118     {
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);
126     }
127
128 }