Commit 18e24161 authored by Rémi Duraffort's avatar Rémi Duraffort

test: add some more tests for vlc variables.

parent bbeb36cb
...@@ -290,9 +290,40 @@ static void test_choices( libvlc_int_t *p_libvlc ) ...@@ -290,9 +290,40 @@ static void test_choices( libvlc_int_t *p_libvlc )
!strcmp( val2.p_list->p_values[0].psz_string, "one" ) ); !strcmp( val2.p_list->p_values[0].psz_string, "one" ) );
var_FreeList( &val, &val2 ); var_FreeList( &val, &val2 );
var_Change( p_libvlc, "bla", VLC_VAR_CLEARCHOICES, NULL, NULL );
assert( var_CountChoices( p_libvlc, "bla" ) == 0 );
var_Destroy( p_libvlc, "bla" ); var_Destroy( p_libvlc, "bla" );
} }
static void test_change( libvlc_int_t *p_libvlc )
{
/* Add min, max and step
Yes we can have min > max but we don't really care */
vlc_value_t val;
int i_min, i_max, i_step;
var_Create( p_libvlc, "bla", VLC_VAR_INTEGER );
val.i_int = i_min = rand();
var_Change( p_libvlc, "bla", VLC_VAR_SETMIN, &val, NULL );
val.i_int = i_max = rand();
var_Change( p_libvlc, "bla", VLC_VAR_SETMAX, &val, NULL );
val.i_int = i_step = rand();
var_Change( p_libvlc, "bla", VLC_VAR_SETSTEP, &val, NULL );
/* Do something */
var_SetInteger( p_libvlc, "bla", rand() );
val.i_int = var_GetInteger( p_libvlc, "bla" ); /* dummy read */
/* Test everything is right */
var_Change( p_libvlc, "bla", VLC_VAR_GETMIN, &val, NULL );
assert( val.i_int = i_min );
var_Change( p_libvlc, "bla", VLC_VAR_GETMAX, &val, NULL );
assert( val.i_int = i_max );
var_Change( p_libvlc, "bla", VLC_VAR_GETSTEP, &val, NULL );
assert( val.i_int = i_step );
}
static void test_variables( libvlc_instance_t *p_vlc ) static void test_variables( libvlc_instance_t *p_vlc )
{ {
libvlc_int_t *p_libvlc = p_vlc->p_libvlc_int; libvlc_int_t *p_libvlc = p_vlc->p_libvlc_int;
...@@ -324,6 +355,9 @@ static void test_variables( libvlc_instance_t *p_vlc ) ...@@ -324,6 +355,9 @@ static void test_variables( libvlc_instance_t *p_vlc )
log( "Testing choices\n" ); log( "Testing choices\n" );
test_choices( p_libvlc ); test_choices( p_libvlc );
log( "Testing var_Change()\n" );
test_change( p_libvlc );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment