diff options
Diffstat (limited to 'tests/test_screensaving.c')
-rw-r--r-- | tests/test_screensaving.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_screensaving.c b/tests/test_screensaving.c new file mode 100644 index 0000000..b74d49d --- /dev/null +++ b/tests/test_screensaving.c @@ -0,0 +1,37 @@ +#include <stdio.h> +#include <unistd.h> + +#include "comm.h" +#include "calls.h" + +static void callback( DapiConnection* a1, int a2, int a3 ) + { + (void) a1; + (void) a2; + (void) a3; + fprintf( stderr, "Unexpected async reply, ignoring.\n" ); + } + +int main() + { + int ok; + DapiConnection* conn = dapi_connect(); + if( conn == NULL ) + { + fprintf( stderr, "Cannot connect!\n" ); + return 1; + } + dapi_setSyncCallback( conn, callback ); + if( !dapi_Init( conn )) + { + fprintf( stderr, "Initialization failed!\n" ); + return 2; + } + ok = dapi_SuspendScreensaving( conn, 1 ); + printf( "Result1: %s\n", ok == 1 ? "Ok" : "Failed" ); + sleep( 10 ); + ok = dapi_SuspendScreensaving( conn, 0 ); + printf( "Result2: %s\n", ok == 1 ? "Ok" : "Failed" ); + dapi_close( conn ); + return 0; + } |