[vlc-devel] commit: test: add some more tests for vlc variables. ( Rémi Duraffort )

git version control git at videolan.org
Thu Jul 23 15:21:56 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Thu Jul 23 15:20:05 2009 +0200| [18e2416136966320d6e463321cb10525e239a3ff] | committer: Rémi Duraffort 

test: add some more tests for vlc variables.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=18e2416136966320d6e463321cb10525e239a3ff
---

 test/src/misc/variables.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/test/src/misc/variables.c b/test/src/misc/variables.c
index ead7ef9..3186c01 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 );
 }
 
 




More information about the vlc-devel mailing list