mirror of
https://github.com/davatorium/rofi.git
synced 2024-10-27 05:23:18 -04:00
59 lines
1.5 KiB
C
59 lines
1.5 KiB
C
#include <assert.h>
|
|
#include <locale.h>
|
|
#include <glib.h>
|
|
#include <stdio.h>
|
|
#include <helper.h>
|
|
#include <string.h>
|
|
#include <xcb/xcb_ewmh.h>
|
|
#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 ); \
|
|
}
|
|
void rofi_add_error_message ( GString *msg )
|
|
{
|
|
}
|
|
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 <x11-helper.h>
|
|
|
|
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 );
|
|
}
|
|
}
|