#define _GNU_SOURCE #include #include #include #include #include /** * DESC: tests the basic usage of object "line". Drawing is not tested. * * IMP: HIGH * * Check for memory leaks using valgrind with options: * --leak-check=full --leak-resolution=high --show-reachable=yes */ int main( int argc, char *argv[] ) { line_t *l1 = line_new(); char *s; debug_level = 0; /* 1 = warn, 2 = info, 3 = verbose, 4 = debug mode */ SET_RECT( l1->r, 10, 20, 100, 200 ); COLOR_FROM_ARGB( OBJECT_COLOR( l1 ), COLOR_MAGENTA ); s = object_str( l1 ); dbg( "%s\n", s ); assert_equal_str( s, (char*) "Line( depth=0, color=0x00ff00ff, transp=0.000, " "p0=( 10, 20 ), p1=( 100, 200 ) )" ); free( s ); s = object_str( NULL ); dbg( "%s\n", s ); assert_equal_str( s, (char*)"Object is NULL!" ); free( s ); object_free( l1 ); return 0; }