From: RĂ©mi Duraffort Date: Thu, 23 Jul 2009 13:20:05 +0000 (+0200) Subject: test: add some more tests for vlc variables. X-Git-Tag: 1.1.0-ff~4850 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=18e2416136966320d6e463321cb10525e239a3ff;hp=bbeb36cb72b1455d3f268c2a3a8490b96633dd29;p=vlc test: add some more tests for vlc variables. --- diff --git a/test/src/misc/variables.c b/test/src/misc/variables.c index ead7ef9e6e..3186c01c69 100644 --- a/test/src/misc/variables.c +++ b/test/src/misc/variables.c @@ -290,9 +290,40 @@ static void test_choices( libvlc_int_t *p_libvlc ) !strcmp( val2.p_list->p_values[0].psz_string, "one" ) ); 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" ); } +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 ) { libvlc_int_t *p_libvlc = p_vlc->p_libvlc_int; @@ -324,6 +355,9 @@ static void test_variables( libvlc_instance_t *p_vlc ) log( "Testing choices\n" ); test_choices( p_libvlc ); + + log( "Testing var_Change()\n" ); + test_change( p_libvlc ); }