4 # Code generator for python ctypes bindings for VLC
5 # Copyright (C) 2009 the VideoLAN team
8 # Authors: Olivier Aubert <olivier.aubert at liris.cnrs.fr>
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
31 class TestVLCAPI(unittest.TestCase):
33 # self.seq = range(10)
34 #self.assert_(element in self.seq)
36 # We check enum definitions against hardcoded values. In case of
37 # failure, check that the reason is not a change in the .h
39 def test_enum_event_type(self):
40 self.assertEqual(vlc.EventType.MediaStateChanged.value, 5)
42 def test_enum_meta(self):
43 self.assertEqual(vlc.Meta.Description.value, 6)
45 def test_enum_state(self):
46 self.assertEqual(vlc.State.Playing.value, 3)
48 def test_enum_media_option(self):
49 self.assertEqual(vlc.MediaOption.unique.value, 256)
51 def test_enum_playback_mode(self):
52 self.assertEqual(vlc.PlaybackMode.repeat.value, 2)
54 def test_enum_marquee_int_option(self):
55 self.assertEqual(vlc.VideoMarqueeIntOption.Size.value, 5)
57 def test_enum_output_device_type(self):
58 self.assertEqual(vlc.AudioOutputDeviceTypes._2F2R.value, 4)
60 def test_enum_output_channel(self):
61 self.assertEqual(vlc.AudioOutputChannel.Dolbys.value, 5)
63 def test_enum_position_origin(self):
64 self.assertEqual(vlc.PositionOrigin.ModuloPosition.value, 2)
66 def test_enum_position_key(self):
67 self.assertEqual(vlc.PositionKey.MediaTime.value, 2)
69 def test_enum_player_status(self):
70 self.assertEqual(vlc.PlayerStatus.StopStatus.value, 5)
72 # Basic MediaControl tests
73 def test_mediacontrol_creation(self):
77 def test_mediacontrol_initial_mrl(self):
79 self.assertEqual(mc.get_mrl(), '')
81 def test_mediacontrol_set_mrl(self):
85 self.assertEqual(mc.get_mrl(), mrl)
88 def test_instance_creation(self):
92 def test_libvlc_media(self):
96 self.assertEqual(m.get_mrl(), mrl)
98 def test_libvlc_player(self):
101 p=i.media_player_new(mrl)
102 self.assertEqual(p.get_media().get_mrl(), mrl)
104 def test_libvlc_player_state(self):
107 p=i.media_player_new(mrl)
108 self.assertEqual(p.get_state(), vlc.State.Ended)
110 if __name__ == '__main__':