]> git.sesse.net Git - vlc/commitdiff
Test some things
authorClément Stenac <zorglub@videolan.org>
Sun, 29 Jan 2006 19:13:35 +0000 (19:13 +0000)
committerClément Stenac <zorglub@videolan.org>
Sun, 29 Jan 2006 19:13:35 +0000 (19:13 +0000)
test/NativeLibvlcTest.py
test/TODO
test/native_libvlc/native_libvlc_test.c
test/test.sh

index fcef0a1249b4b32374d883487aed9847e528450e..1623c70a216af5fb88bbf08ac079c5aebc98cddc 100644 (file)
@@ -4,5 +4,9 @@ import unittest
 import native_libvlc_test
 
 class NativeLibvlcTestCase( unittest.TestCase ):
-    def testMe( self ):
-       native_libvlc_test.create_destroy()
+    def testException( self ):
+        """Checks libvlc_exception"""
+       native_libvlc_test.exception_test()
+    def testStartup( self ):
+        """Checks creation/destroy of libvlc"""
+       native_libvlc_test.create_destroy()
index b493b1032c65efb3b1c17f27b5a3b6329fe71065..8704fdc5b315b796dd14b398ba784e51d11124bb 100644 (file)
--- a/test/TODO
+++ b/test/TODO
@@ -1,4 +1,6 @@
+* Write wrapper with output redirection / use of logger interface + log checker (look for error in log and fail if any)
+  - We can use this to test streams
 
-* Write wrapper around MediaControl with output redirection / use of logger interface + log checker (look for error in log and fail if any)
+* Invent something  for testing streams
 
-* 
+* Test stats
index 36df199517fe564b386fb1b3c6e7c040c0ac8fed..b9b056bb0f9c7184b60f2e5ac38767f5abfde381 100644 (file)
@@ -1,8 +1,42 @@
 #include "../pyunit.h"
+#include <vlc/libvlc.h>
+
+static PyObject *exception_test( PyObject *self, PyObject *args )
+{
+     libvlc_exception_t exception;
+
+     libvlc_exception_init( &exception );
+     ASSERT( !libvlc_exception_raised( &exception) , "Exception raised" );
+     ASSERT( !libvlc_exception_get_message( &exception) , "Exception raised" );
+
+     libvlc_exception_raise( &exception, NULL );
+     ASSERT( !libvlc_exception_get_message( &exception), "Unexpected message" );
+     ASSERT( libvlc_exception_raised( &exception), "Exception not raised" );
+
+     libvlc_exception_raise( &exception, "test" );
+     ASSERT( libvlc_exception_get_message( &exception), "No Message" );
+     ASSERT( libvlc_exception_raised( &exception), "Exception not raised" );
+
+     Py_INCREF( Py_None );
+     return Py_None;
+}
 
 static PyObject *create_destroy( PyObject *self, PyObject *args )
 {
-     /* Test stuff here */
+     libvlc_instance_t *p_instance;
+     char *argv[] = {};
+
+     libvlc_exception_t exception;
+     libvlc_exception_init( &exception );
+
+     p_instance = libvlc_new( 0, argv, &exception );
+
+     ASSERT( p_instance != NULL, "Instance creation failed" );
+
+     ASSERT( !libvlc_exception_raised( &exception ),
+             "Exception raised while creating instance" );
+
+     libvlc_destroy( p_instance );
      
      Py_INCREF( Py_None );
      return Py_None;
@@ -10,6 +44,7 @@ static PyObject *create_destroy( PyObject *self, PyObject *args )
 
 static PyMethodDef native_libvlc_test_methods[] = {
    DEF_METHOD( create_destroy, "Create and destroy" )
+   DEF_METHOD( exception_test, "Test Exception handling" )
    { NULL, NULL, 0, NULL }
 };
 
index 9981fa7423561d95c3fed3e1e64b1bbbbb3382cd..e5d566300001e8701877ee1e5837df226f3d7586 100755 (executable)
@@ -1,6 +1,5 @@
 #! /bin/sh
 
-# FIXME - Get real .so
 cd ..
 export PYTHONPATH=$PYTHONPATH:bindings/python/build/lib.linux-i686-2.3:test/build/lib.linux-i686-2.3