]> git.sesse.net Git - vlc/commitdiff
Change some test stuff
authorClément Stenac <zorglub@videolan.org>
Sun, 12 Feb 2006 17:14:07 +0000 (17:14 +0000)
committerClément Stenac <zorglub@videolan.org>
Sun, 12 Feb 2006 17:14:07 +0000 (17:14 +0000)
test/NativeLibvlcTest.py
test/PyMediaControlBaseTest.py
test/PyMediaControlPlaylistTest.py
test/PyMediaControlVariablesTest.py
test/native/native_libvlc_test.c [moved from test/native_libvlc/native_libvlc_test.c with 76% similarity]
test/setup.py
test/test.sh

index 2c7c0aa38622b795b694749ff7bb61f46156662f..0eae7a84d248ca88d1350e165c03e45bf3bf1906 100644 (file)
@@ -5,11 +5,11 @@ import native_libvlc_test
 
 class NativeLibvlcTestCase( unittest.TestCase ):
     def testException( self ):
-        """Checks libvlc_exception"""
+        """[LibVLC] Checks libvlc_exception"""
        native_libvlc_test.exception_test()
     def testStartup( self ):
-        """Checks creation/destroy of libvlc"""
+        """[LibVLC] Checks creation/destroy of libvlc"""
        native_libvlc_test.create_destroy()
     def testPlaylist( self ):
-        """Checks basic playlist interaction"""
+        """[LibVLC] Checks basic playlist interaction"""
        native_libvlc_test.playlist_test()
index 9e36ce82408f47a07d5c765052238a977fd5262d..23c6f30ee1035bfb236c6548ffd344c1fc832828 100644 (file)
@@ -3,10 +3,6 @@ import unittest
 
 class BaseTestCase( unittest.TestCase ):
     def testStartup(self):
-        """Checks that VLC starts"""
+        """[PyMC] Check that VLC starts"""
        mc = vlc.MediaControl( ['--quiet'])
         mc.exit()
-
-#    def testHelp(self):
-#        """Check help string"""
-#        mc=vlc.MediaControl( [ '--help'] )
index 396d9b82eb19dc16a5675fc6c5cd70f6847337d6..1a53a6a89a8d2f626b5966734fe64f1abff435f3 100644 (file)
@@ -4,7 +4,7 @@ import unittest
 # FIXME: How to avoid creating / killing vlc for each test method ?
 
 class VariablesTestCase( unittest.TestCase ):
-    """Test misc variables interaction"""
+    """[PyMC] Test misc variables interaction"""
     def setUp( self ):
         self.mc = vlc.MediaControl( [ '--quiet'] )
 
@@ -12,7 +12,7 @@ class VariablesTestCase( unittest.TestCase ):
         self.mc.exit()
            
     def testSimple( self ):
-        """Test simple add/remove"""
+        """[PyMC] Check simple add"""
         assert len( self.mc.playlist_get_list() ) == 0
         self.mc.playlist_add_item( "test" )
         assert len( self.mc.playlist_get_list() ) == 1
index 84d7747c965c06a5c7dfd9689ff06283806ee812..9d08a601f1e477c36534c39376c2f0d3f8fd5947 100644 (file)
@@ -4,7 +4,7 @@ import unittest
 # FIXME: How to avoid creating / killing vlc for each test method ?
 
 class VariablesTestCase( unittest.TestCase ):
-    """Test misc variables interaction"""
+    """[PyMC] Test misc variables interaction"""
     def setUp( self ):
         self.mc = vlc.MediaControl( [ '--quiet'] )
         # FIXME ! - Get this through children test
@@ -18,20 +18,20 @@ class VariablesTestCase( unittest.TestCase ):
             
     # The Python binding can't create variables, so just get default ones
     def testInt( self ):
-        """Get/Set integer variable"""
+        """[PyMC] Get/Set integer variable"""
         assert self.libvlc.get( "width" ) == 0
         self.libvlc.set( "width", 42 ) 
         assert self.libvlc.get( 'width' ) == 42
 
     # FIXME: Python binding should listen to return value and raise exception 
     def testInvalidInt( self ):
-        """Get/Set invalid integer"""
+        """[PyMC] Get/Set invalid integer"""
         self.libvlc.set( "width" , 5 )
         self.libvlc.set( "width", "foo" )
         assert self.libvlc.get( "width" ) == -1
     
     def testString( self ):
-        """Get/Set string variable"""
+        """[PyMC] Get/Set string variable"""
         assert self.libvlc.get( "open" ) == ''
         self.libvlc.set( "open", "foo" ) 
         assert self.libvlc.get( "open" ) == "foo"
similarity index 76%
rename from test/native_libvlc/native_libvlc_test.c
rename to test/native/native_libvlc_test.c
index 6064e926bd00a38c310fdd614200105923e9caac..5ddab81fe07449875d859fcb02ac3c114b586779 100644 (file)
@@ -46,24 +46,37 @@ static PyObject *playlist_test( PyObject *self, PyObject *args )
 {
     libvlc_instance_t *p_instance;
     char *argv[] = { "vlc", "--quiet" };
-    int i_id;
+    int i_id, i_playing, i_items;
 
     libvlc_exception_t exception;
     libvlc_exception_init( &exception );
 
     p_instance = libvlc_new( 2, argv, &exception );
 
+    /* Initial status */
     libvlc_playlist_play( p_instance, 0, 0, argv, &exception );
-
     ASSERT( libvlc_exception_raised( &exception ), 
             "Playlist empty and exception not raised" );
+    i_playing  = libvlc_playlist_isplaying( p_instance, &exception  );
+    ASSERT_EXCEPTION;
+    ASSERT( i_playing == 0, "Playlist shouldn't be running" );
+    i_items = libvlc_playlist_items_count( p_instance, &exception );
+    ASSERT_EXCEPTION;
+    ASSERT( i_items == 0, "Playlist should be empty" );
 
+    /* Add 1 item */
     libvlc_exception_clear( &exception );
     i_id = libvlc_playlist_add( p_instance, "test" , NULL , &exception );
-
     ASSERT_EXCEPTION;
-
     ASSERT( i_id > 0 , "Returned identifier is <= 0" );
+    i_items = libvlc_playlist_items_count( p_instance, &exception );
+    ASSERT_EXCEPTION;
+    ASSERT( i_items == 1, "Playlist should have 1 item" );
+    i_playing  = libvlc_playlist_isplaying( p_instance, &exception  );
+    ASSERT_EXCEPTION;
+    ASSERT( i_playing == 0, "Playlist shouldn't be running" );
+
+    /* */ 
     
     Py_INCREF( Py_None );
     return Py_None;
index a43ac97e9eaa7c84c5764a89c24e39eaf4b046a0..0f23226fe53ac8929406b7c231be4e68e9a609a1 100644 (file)
@@ -39,11 +39,21 @@ def get_ldflags():
 
 # To compile in a local vlc tree
 native_libvlc_test = Extension( 'native_libvlc_test',
-                sources = ['native_libvlc/native_libvlc_test.c'],
+                sources = ['native/libvlc.c'],
                 include_dirs = ['../include', '../', '/usr/win32/include' ],
                 extra_objects = [ '../lib/libvlc_pic.a' ],
                 extra_compile_args = get_cflags(),
                            extra_link_args = [ '-L../..' ]  + get_ldflags(),
                 )
 
+native_stats_test = Extension( 'native_stats_test',
+                sources = ['native/stats.c'],
+                include_dirs = ['../include', '../', '/usr/win32/include' ],
+                extra_objects = [ '../lib/libvlc_pic.a' ],
+                extra_compile_args = get_cflags(),
+                           extra_link_args = [ '-L../..' ]  + get_ldflags(),
+                )
+
+
 setup( name = 'native_libvlc_test' ,version = '1242', ext_modules = [ native_libvlc_test ] )
+setup( name = 'native_stats_test' ,version = '1242', ext_modules = [ native_stats_test ] )
index e5d566300001e8701877ee1e5837df226f3d7586..bc11147a36b712d5c88f60994e59ad66452bc074 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 
 cd ..
-export PYTHONPATH=$PYTHONPATH:bindings/python/build/lib.linux-i686-2.3:test/build/lib.linux-i686-2.3
+export PYTHONPATH=$PYTHONPATH:bindings/mediacontrol-python/build/lib.linux-i686-2.3:test/build/lib.linux-i686-2.3
 
 python test/test.py -v