]> git.sesse.net Git - vlc/blob - test/PyMediaControlVariablesTest.py
9d08a601f1e477c36534c39376c2f0d3f8fd5947
[vlc] / test / PyMediaControlVariablesTest.py
1 import vlc
2 import unittest
3
4 # FIXME: How to avoid creating / killing vlc for each test method ?
5
6 class VariablesTestCase( unittest.TestCase ):
7     """[PyMC] Test misc variables interaction"""
8     def setUp( self ):
9         self.mc = vlc.MediaControl( [ '--quiet'] )
10         # FIXME ! - Get this through children test
11         self.libvlc = vlc.Object(1)
12         self.playlist = vlc.Object(268)
13
14     def tearDown( self ):
15         self.playlist.release() 
16         self.libvlc.release() 
17         self.mc.exit()
18             
19     # The Python binding can't create variables, so just get default ones
20     def testInt( self ):
21         """[PyMC] Get/Set integer variable"""
22         assert self.libvlc.get( "width" ) == 0
23         self.libvlc.set( "width", 42 ) 
24         assert self.libvlc.get( 'width' ) == 42
25
26     # FIXME: Python binding should listen to return value and raise exception 
27     def testInvalidInt( self ):
28         """[PyMC] Get/Set invalid integer"""
29         self.libvlc.set( "width" , 5 )
30         self.libvlc.set( "width", "foo" )
31         assert self.libvlc.get( "width" ) == -1
32     
33     def testString( self ):
34         """[PyMC] Get/Set string variable"""
35         assert self.libvlc.get( "open" ) == ''
36         self.libvlc.set( "open", "foo" ) 
37         assert self.libvlc.get( "open" ) == "foo"
38