2 #include <vlc/libvlc.h>
4 static PyObject *exception_test( PyObject *self, PyObject *args )
6 libvlc_exception_t exception;
8 libvlc_exception_init( &exception );
9 ASSERT( !libvlc_exception_raised( &exception) , "Exception raised" );
10 ASSERT( !libvlc_exception_get_message( &exception) , "Exception raised" );
12 libvlc_exception_raise( &exception, NULL );
13 ASSERT( !libvlc_exception_get_message( &exception), "Unexpected message" );
14 ASSERT( libvlc_exception_raised( &exception), "Exception not raised" );
16 libvlc_exception_raise( &exception, "test" );
17 ASSERT( libvlc_exception_get_message( &exception), "No Message" );
18 ASSERT( libvlc_exception_raised( &exception), "Exception not raised" );
24 static PyObject *create_destroy( PyObject *self, PyObject *args )
26 libvlc_instance_t *p_instance;
29 libvlc_exception_t exception;
30 libvlc_exception_init( &exception );
32 p_instance = libvlc_new( 0, argv, &exception );
34 ASSERT( p_instance != NULL, "Instance creation failed" );
36 ASSERT( !libvlc_exception_raised( &exception ),
37 "Exception raised while creating instance" );
39 libvlc_destroy( p_instance );
45 static PyMethodDef native_libvlc_test_methods[] = {
46 DEF_METHOD( create_destroy, "Create and destroy" )
47 DEF_METHOD( exception_test, "Test Exception handling" )
48 { NULL, NULL, 0, NULL }
51 DECLARE_MODULE( native_libvlc_test )