#include #include #include #include #include #include #include #include "xcb-internal.h" #include "rofi.h" #include "settings.h" static int test = 0; #define TASSERT( a ) { \ assert ( a ); \ printf ( "Test %i passed (%s)\n", ++test, # a ); \ } int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup ) { fputs ( msg, stderr ); return TRUE; } int show_error_message ( const char *msg, int markup ) { fputs ( msg, stderr ); return 0; } xcb_screen_t *xcb_screen; xcb_ewmh_connection_t xcb_ewmh; int xcb_screen_nbr; #include int main ( int argc, char ** argv ) { if ( setlocale ( LC_ALL, "" ) == NULL ) { fprintf ( stderr, "Failed to set locale.\n" ); return EXIT_FAILURE; } // Pid test. // Tests basic functionality of writing it, locking, seeing if I can write same again // And close/reopen it again. { const char *path = "/tmp/rofi-test.pid"; TASSERT( create_pid_file ( NULL ) == -1 ); int fd = create_pid_file ( path ); TASSERT( fd >= 0 ); int fd2 = create_pid_file ( path ); TASSERT ( fd2 < 0 ); remove_pid_file ( fd ); fd = create_pid_file ( path ); TASSERT( fd >= 0 ); remove_pid_file ( fd ); } }