Merge commit '1a1dc7282f5ed010af874398b5b3d70ea7cda8e8' into wayland

This commit is contained in:
lbonn
2021-09-06 13:00:57 +02:00
178 changed files with 5880 additions and 3057 deletions

View File

@@ -40,6 +40,7 @@
#include "xrmoptions.h"
#include "helper.h"
#include "display.h"
#include "rofi-icon-fetcher.h"
unsigned int test =0;
#define TASSERT( a ) { \
assert ( a ); \
@@ -49,7 +50,7 @@ unsigned int test =0;
#define TASSERTE( a, b ) { \
if ( ( a ) == ( b ) ) { \
printf ( "Test %u passed (%s == %s) (%d == %d)\n", ++test, # a, # b, a, b ); \
}else { \
} else { \
printf ( "Test %u failed (%s == %s) (%d != %d)\n", ++test, # a, # b, a, b ); \
abort ( ); \
} \
@@ -58,12 +59,26 @@ unsigned int test =0;
#define TASSERTW( a, b ) { \
if ( ( a ) == ( b ) ) { \
printf ( "Test %u passed (%s == %s) (%p == %p)\n", ++test, # a, # b, (void *)a, (void *)b ); \
}else { \
} else { \
printf ( "Test %u failed (%s == %s) (%p != %p)\n", ++test, # a, # b, (void *)a, (void *)b ); \
abort ( ); \
} \
}
ThemeWidget *rofi_configuration = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
int monitor_active ( G_GNUC_UNUSED workarea *mon )
{
@@ -79,7 +94,7 @@ char * rofi_expand_path ( G_GNUC_UNUSED const char *path )
return NULL;
}
char * helper_get_theme_path ( const char *file )
char * helper_get_theme_path ( const char *file, const char *ext)
{
return g_strdup ( file );
}
@@ -101,7 +116,6 @@ void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int
}
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{
{

View File

@@ -2,14 +2,14 @@
TOP_DIR=$1
xrdb -retain -load ${TOP_DIR}/doc/old-theme-convert-input.theme
rofi -config ${TOP_DIR}/doc/old-theme-convert-input.theme -dump-theme | grep -v "Rofi version" > temp.txt
xrdb -retain -load "${TOP_DIR}/doc/old-theme-convert-input.theme"
rofi -config "${TOP_DIR}/doc/old-theme-convert-input.theme" -dump-theme | grep -v "Rofi version" > temp.txt
if ! diff temp.txt ${TOP_DIR}/doc/old-theme-convert-output.rasi > /dev/null
if ! diff temp.txt "${TOP_DIR}/doc/old-theme-convert-output.rasi" >/dev/null
then
echo "Convert default theme failed"
diff temp.txt ${TOP_DIR}/doc/old-theme-convert-output.rasi
exit 1;
diff temp.txt "${TOP_DIR}/doc/old-theme-convert-output.rasi"
exit 1
fi
exit ${RETV}
exit "${RETV}"

View File

@@ -2,13 +2,13 @@
TOP_DIR=$1
rofi -no-config -dump-theme | grep -v "Rofi version" > temp.txt
rofi -no-config -dump-theme | grep -v "Rofi version" > temp.txt
if ! diff temp.txt ${TOP_DIR}/doc/default_theme.rasi > /dev/null
if ! diff temp.txt "${TOP_DIR}/doc/default_theme.rasi" >/dev/null
then
echo "Dump default theme does not match."
diff temp.txt ${TOP_DIR}/doc/default_theme.rasi
exit 1;
diff temp.txt "${TOP_DIR}/doc/default_theme.rasi"
exit 1
fi
exit ${RETV}
exit "${RETV}"

View File

@@ -2,13 +2,13 @@
TOP_DIR=$1
rofi -h -config ${TOP_DIR}/doc/test_xr.txt | awk 'BEGIN{ found=1} /^Global options:/{found=0} {if (found) print }' > help-output.txt
rofi -h -config "${TOP_DIR}/doc/test_xr.txt" | awk 'BEGIN{ found=1} /^Global options:/{found=0} {if (found) print }' > help-output.txt
if ! diff help-output.txt ${TOP_DIR}/doc/help-output.txt > /dev/null
if ! diff help-output.txt "${TOP_DIR}/doc/help-output.txt" >/dev/null
then
diff help-output.txt ${TOP_DIR}/doc/help-output.txt
diff help-output.txt "${TOP_DIR}/doc/help-output.txt"
echo "Help output does not match."
exit 1;
exit 1
fi
exit ${RETV}
exit "${RETV}"

View File

@@ -37,6 +37,8 @@
#include "xcb-internal.h"
#include "rofi.h"
#include "settings.h"
#include "widgets/textbox.h"
#include "rofi-icon-fetcher.h"
static int test = 0;
@@ -47,11 +49,48 @@ static int test = 0;
#define TASSERTE( a, b ) { \
if ( ( a ) == ( b ) ) { \
printf ( "Test %i passed (%s == %s) (%u == %u)\n", ++test, # a, # b, a, b ); \
}else { \
} else { \
printf ( "Test %i failed (%s == %s) (%u != %u)\n", ++test, # a, # b, a, b ); \
abort ( ); \
} \
}
#include "theme.h"
ThemeWidget *rofi_theme = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
void rofi_clear_error_messages (void )
{
}
gboolean rofi_theme_parse_string ( const char *string )
{
return FALSE;
}
double textbox_get_estimated_char_height ( void )
{
return 12.0;
}
void rofi_view_get_current_monitor ( int *width, int *height )
{
*width = 1920;
*height = 1080;
}
double textbox_get_estimated_ch ( void )
{
return 9.0;
}
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
{
}
@@ -70,7 +109,7 @@ void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *cont
{
}
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{
if ( setlocale ( LC_ALL, "" ) == NULL ) {
@@ -97,12 +136,12 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
TASSERT ( strcmp ( list[9], "4" ) == 0 );
cmd_set_arguments ( llength, list);
TASSERT( find_arg ( "-e") == 2 );
TASSERT( find_arg ( "-x") == -1 );
TASSERT ( find_arg ( "-e") == 2 );
TASSERT ( find_arg ( "-x") == -1 );
char *str;
TASSERT( find_arg_str ( "-e", &str) == TRUE );
TASSERT ( find_arg_str ( "-e", &str) == TRUE );
TASSERT ( str == list[3] );
TASSERT( find_arg_str ( "-x", &str) == FALSE );
TASSERT ( find_arg_str ( "-x", &str) == FALSE );
// Should be unmodified.
TASSERT ( str == list[3] );

View File

@@ -32,11 +32,14 @@
#include <helper.h>
#include <string.h>
#include <xcb/xcb_ewmh.h>
#include "theme.h"
#include "display.h"
#include "xcb.h"
#include "xcb-internal.h"
#include "rofi.h"
#include "settings.h"
#include "widgets/textbox.h"
#include "rofi-icon-fetcher.h"
static int test = 0;
@@ -47,11 +50,45 @@ static int test = 0;
#define TASSERTE( a, b ) { \
if ( ( a ) == ( b ) ) { \
printf ( "Test %i passed (%s == %s) (%u == %u)\n", ++test, # a, # b, a, b ); \
}else { \
} else { \
printf ( "Test %i failed (%s == %s) (%u != %u)\n", ++test, # a, # b, a, b ); \
abort ( ); \
} \
}
ThemeWidget *rofi_theme = NULL;
void rofi_clear_error_messages ( void ) {}
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
double textbox_get_estimated_char_height ( void )
{
return 12.0;
}
void rofi_view_get_current_monitor ( int *width, int *height )
{
*width = 1920;
*height = 1080;
}
double textbox_get_estimated_ch ( void )
{
return 9.0;
}
gboolean rofi_theme_parse_string ( const char *string )
{
return 0;
}
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
{
}
@@ -71,7 +108,7 @@ void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *cont
{
}
int main ( int argc, char ** argv )
int main ( int argc, char **argv )
{
cmd_set_arguments ( argc, argv );

View File

@@ -37,6 +37,8 @@
#include "xcb-internal.h"
#include "rofi.h"
#include "settings.h"
#include "widgets/textbox.h"
#include "rofi-icon-fetcher.h"
static int test = 0;
@@ -44,6 +46,44 @@ static int test = 0;
assert ( a ); \
printf ( "Test %i passed (%s)\n", ++test, # a ); \
}
#include "theme.h"
ThemeWidget *rofi_theme = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
void rofi_clear_error_messages ( void )
{
}
gboolean rofi_theme_parse_string ( const char *string )
{
return FALSE;
}
double textbox_get_estimated_char_height ( void )
{
return 12.0;
}
void rofi_view_get_current_monitor ( int *width, int *height )
{
*width = 1920;
*height = 1080;
}
double textbox_get_estimated_ch ( void )
{
return 9.0;
}
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
{
}
@@ -61,7 +101,7 @@ void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *cont
{
}
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{
if ( setlocale ( LC_ALL, "" ) == NULL ) {
fprintf ( stderr, "Failed to set locale.\n" );
@@ -73,15 +113,15 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
{
const char *tmpd = g_get_tmp_dir ();
char *path = g_build_filename (tmpd, "rofi-pid.pid", NULL);
TASSERT( create_pid_file ( NULL ) == -1 );
TASSERT ( create_pid_file ( NULL ) == -1 );
int fd = create_pid_file ( path );
TASSERT( fd >= 0 );
TASSERT ( fd >= 0 );
int fd2 = create_pid_file ( path );
TASSERT ( fd2 < 0 );
remove_pid_file ( fd );
fd = create_pid_file ( path );
TASSERT( fd >= 0 );
TASSERT ( fd >= 0 );
remove_pid_file ( fd );
free ( path );
}

View File

@@ -32,11 +32,13 @@
#include <helper.h>
#include <string.h>
#include <xcb/xcb_ewmh.h>
#include "theme.h"
#include "display.h"
#include "xcb.h"
#include "xcb-internal.h"
#include "rofi.h"
#include "settings.h"
#include "rofi-icon-fetcher.h"
static int test = 0;
@@ -47,7 +49,7 @@ static int test = 0;
#define TASSERTE( a, b ) { \
if ( ( a ) == ( b ) ) { \
printf ( "Test %i passed (%s == %s) (%u == %u)\n", ++test, # a, # b, a, b ); \
}else { \
} else { \
printf ( "Test %i failed (%s == %s) (%u != %u)\n", ++test, # a, # b, a, b ); \
abort ( ); \
} \
@@ -55,11 +57,49 @@ static int test = 0;
#define TASSERTL( a, b ) { \
if ( ( a ) == ( b ) ) { \
printf ( "Test %i passed (%s == %s) (%d == %d)\n", ++test, # a, # b, a, b ); \
}else { \
} else { \
printf ( "Test %i failed (%s == %s) (%d != %d)\n", ++test, # a, # b, a, b ); \
abort ( ); \
} \
}
#include "widgets/textbox.h"
ThemeWidget *rofi_theme = NULL;
gboolean rofi_theme_parse_string ( const char *string )
{
return FALSE;
}
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
void rofi_clear_error_messages ( void ) {}
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
double textbox_get_estimated_char_height ( void )
{
return 12.0;
}
void rofi_view_get_current_monitor ( int *width, int *height )
{
*width = 1920;
*height = 1080;
}
double textbox_get_estimated_ch ( void )
{
return 9.0;
}
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
{
@@ -80,7 +120,7 @@ void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *cont
{
}
int main ( int argc, char ** argv )
int main ( int argc, char **argv )
{
cmd_set_arguments ( argc, argv );

View File

@@ -33,14 +33,52 @@
#include <string.h>
#include <xcb/xcb_ewmh.h>
#include "display.h"
#include "theme.h"
#include "xcb.h"
#include "xcb-internal.h"
#include "rofi.h"
#include "settings.h"
#include "rofi-types.h"
#include "widgets/textbox.h"
#include "rofi-icon-fetcher.h"
#include <check.h>
ThemeWidget *rofi_theme = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
{
return 0;
}
void rofi_clear_error_messages ( void ) {}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
gboolean rofi_theme_parse_string ( G_GNUC_UNUSED const char *string )
{
return FALSE;
}
double textbox_get_estimated_char_height ( void )
{
return 12.0;
}
void rofi_view_get_current_monitor ( int *width, int *height )
{
*width = 1920;
*height = 1080;
}
double textbox_get_estimated_ch ( void )
{
return 9.0;
}
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
{
}
@@ -447,7 +485,7 @@ static Suite * helper_tokenizer_suite (void)
return s;
}
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{
if ( setlocale ( LC_ALL, "" ) == NULL ) {
fprintf ( stderr, "Failed to set locale.\n" );
@@ -465,5 +503,5 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char ** argv )
number_failed = srunner_ntests_failed(sr);
srunner_free(sr);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@@ -117,7 +117,7 @@ static void history_test ( void )
unlink ( file );
}
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{
history_test ();

View File

@@ -37,14 +37,46 @@
#include <mode-private.h>
#include <dialogs/help-keys.h>
#include <xkbcommon/xkbcommon.h>
#include "theme.h"
#include "rofi.h"
#include "display.h"
#include "xcb.h"
#include "widgets/textbox.h"
#include <keyb.h>
#include <helper.h>
#include <check.h>
#include "rofi-icon-fetcher.h"
ThemeWidget *rofi_theme = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
{
return 0;
}
void rofi_clear_error_messages ( void ) {}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
gboolean rofi_theme_parse_string ( const char *string )
{
return FALSE;
}
double textbox_get_estimated_char_height ( void )
{
return 16.0;
}
double textbox_get_estimated_ch ( void )
{
return 9.0;
}
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
{
}
@@ -57,11 +89,6 @@ int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
fputs ( msg, stderr );
return TRUE;
}
int textbox_get_estimated_char_height ( void );
int textbox_get_estimated_char_height ( void )
{
return 16;
}
void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int *height )
{
@@ -98,7 +125,7 @@ static void test_mode_setup ( void )
{
ck_assert_int_eq ( mode_init ( &help_keys_mode ), TRUE);
}
static void test_mode_teardown (void )
static void test_mode_teardown ( void )
{
mode_destroy ( &help_keys_mode );
}
@@ -119,8 +146,8 @@ END_TEST
START_TEST(test_mode_num_items)
{
unsigned int rows = mode_get_num_entries ( &help_keys_mode);
ck_assert_int_eq ( rows, 72);
for ( unsigned int i =0; i < rows; i++ ){
ck_assert_int_eq ( rows, 74);
for ( unsigned int i =0; i < rows; i++ ) {
int state = 0;
GList *list = NULL;
char *v = mode_get_display_value ( &help_keys_mode, i, &state, &list, TRUE );
@@ -194,7 +221,6 @@ static Suite * mode_suite (void)
return s;
}
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{
setup_abe ();

View File

@@ -4,7 +4,6 @@ tests=(
run_errormsg_test
run_switchdialog_test
run_dmenu_test
run_dmenu_custom_test
run_run_test
run_script_test
run_script_meta_test
@@ -13,7 +12,6 @@ tests=(
run_dmenu_empty
run_dmenu_issue_292
run_screenshot_test
xr_dump_test
run_combi_test
run_regex_test
run_glob_test
@@ -25,7 +23,7 @@ tests=(
run_window_test
)
cd ${MESON_BUILD_ROOT}
cd -- "${MESON_BUILD_ROOT}"
mkdir -p test-x-logs
rm -f core
display=200
@@ -38,11 +36,11 @@ for test in "${tests[@]}"; do
echo "COREDUMP"
echo "bt" | gdb ./rofi core
more ${log_prefix}*.log | cat
exit ${ret}
exit "${ret}"
elif [[ ${ret} != 0 ]]; then
echo "FAIL"
more ${log_prefix}*.log | cat
exit ${ret}
exit "${ret}"
fi
echo "PASS"
display=$(( display + 1 ))

View File

@@ -4,8 +4,8 @@ rofi -show combi -modi combi -combi-modi run,drun &
RPID=$!
# send enter.
sleep 5;
xdotool key 't'
sleep 5
xdotool key 't'
sleep 0.4
xdotool key 'r'
sleep 0.4
@@ -15,8 +15,8 @@ xdotool key 'e'
sleep 0.4
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
exit ${RETV}
exit "${RETV}"

View File

@@ -1,38 +0,0 @@
#!/usr/bin/env bash
echo -e -n "aap\nnoot\nmies" | rofi -width -30 -dmenu -multi-select > output.txt &
RPID=$!
# send enter.
sleep 5;
xdotool key 'c'
sleep 0.2
xdotool key 'o'
sleep 0.2
xdotool key 'f'
sleep 0.2
xdotool key 'f'
sleep 0.2
xdotool key 'e'
sleep 0.2
xdotool key 'e'
sleep 0.2
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
RETV=$?
OUTPUT=$( tr '\n' ' ' < output.txt )
if [ "${OUTPUT}" != 'coffee ' ]
then
exit 1
fi
OUTPUT=$(rofi -dump-xresources)
if [ -z "${OUTPUT}" ]
then
exit 1
fi
exit ${RETV}

View File

@@ -1,14 +1,14 @@
#!/usr/bin/env bash
rofi -dmenu & < /dev/null
rofi -dmenu & </dev/null
RPID=$!
sleep 4
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
if [ ${RETV} -eq 0 ]
if [ "${RETV}" -eq 0 ]
then
exit 0
else

View File

@@ -1,13 +1,13 @@
#!/usr/bin/env bash
# wait till it is up, run rofi with error message
sleep 1;
echo {0..100} | tr " " "\n" | rofi -dmenu -multi-select > output.txt &
sleep 1
echo {0..100} | tr " " "\n" | rofi -dmenu -multi-select > output.txt &
RPID=$!
# send enter.
sleep 5;
xdotool key '2'
sleep 5
xdotool key '2'
sleep 0.4
xdotool key Shift+Return
#2
@@ -35,8 +35,8 @@ xdotool key Shift+Return
#32
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
OUTPUT=$(tr '\n' ' ' < output.txt)
if [ "${OUTPUT}" != '2 12 20 21 22 23 24 25 26 27 28 29 ' ]
@@ -44,5 +44,5 @@ then
echo "Got: '${OUTPUT}' expected '2 12 20 21 22 23 24 25 26 27 28 29 '"
exit 1
fi
echo ${RETV}
exit ${RETV}
echo "${RETV}"
exit "${RETV}"

View File

@@ -1,23 +1,23 @@
#!/usr/bin/env bash
# wait till it is up, run rofi with error message
sleep 1;
sleep 1
ulimit -c unlimited
echo -e -n "aap\nnoot\nmies" | rofi -dmenu -normal-window -multi-select > output.txt &
echo -e -n "aap\nnoot\nmies" | rofi -dmenu -normal-window -multi-select > output.txt &
RPID=$!
sleep 4
xdotool getactivewindow windowsize 100% 100%
echo "Window resized"
# send enter.
sleep 1
xdotool key 'Down'
xdotool key 'Down'
sleep 0.4
xdotool key Shift+Return
xdotool key Shift+Return
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
if [ "${RETV}" == "139" ]
then
@@ -30,5 +30,5 @@ then
echo "Got: '${OUTPUT}' expected 'noot mies '"
exit 1
fi
echo ${RETV}
exit ${RETV}
echo "${RETV}"
exit "${RETV}"

View File

@@ -1,20 +1,20 @@
#!/usr/bin/env bash
# wait till it is up, run rofi with error message
sleep 1;
echo -e -n "aap\nnoot\nmies" | rofi -dmenu -multi-select > output.txt &
sleep 1
echo -e -n "aap\nnoot\nmies" | rofi -dmenu -multi-select > output.txt &
RPID=$!
# send enter.
sleep 5;
xdotool key 'Down'
sleep 5
xdotool key 'Down'
sleep 0.4
xdotool key Shift+Return
xdotool key Shift+Return
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
OUTPUT=$( tr '\n' ' ' < output.txt )
if [ "${OUTPUT}" != 'noot mies ' ]
@@ -22,5 +22,5 @@ then
echo "Got: '${OUTPUT}' expected 'noot mies '"
exit 1
fi
echo ${RETV}
exit ${RETV}
echo "${RETV}"
exit "${RETV}"

View File

@@ -1,11 +1,11 @@
#!/usr/bin/env bash
rofi -show drun -modi drun &
rofi -show drun -modi drun &
RPID=$!
# send enter.
sleep 5;
xdotool key 't'
sleep 5
xdotool key 't'
sleep 0.4
xdotool key 'r'
sleep 0.4
@@ -15,8 +15,8 @@ xdotool key 'e'
sleep 0.4
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
exit ${RETV}
exit "${RETV}"

View File

@@ -1,13 +1,13 @@
#!/usr/bin/env bash
# wait till it is up, run rofi with error message
sleep 1 && rofi -e "Printing error message" &
sleep 1 && rofi -e "Printing error message" &
RPID=$!
# send enter.
sleep 5 && xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
exit ${RETV}
exit "${RETV}"

View File

@@ -1,10 +1,10 @@
#!/usr/bin/env bash
echo -en "nooty\naap\nnoot\nmies" | rofi -matching glob -dmenu > output.txt &
echo -en "nooty\naap\nnoot\nmies" | rofi -matching glob -dmenu > output.txt &
RPID=$!
# send enter.
sleep 5;
sleep 5
xdotool key 'n'
sleep 0.4
xdotool key Shift+'8'
@@ -13,8 +13,8 @@ xdotool key 't'
sleep 0.4
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
OUTPUT=$(cat output.txt)
if [ "${OUTPUT}" != 'nooty' ]
@@ -23,4 +23,4 @@ then
exit 1
fi
exit ${RETV}
exit "${RETV}"

View File

@@ -2,13 +2,13 @@
# wait till it is up, run rofi with error message
rm -f output.txt
sleep 1;
sleep 1
echo -e -n "aap\nnoot\nmies" | rofi -dmenu -no-custom -kb-custom-1 F5 -kb-move-front "" -kb-custom-2 "Control+a" > output.txt &
RPID=$!
# send enter.
sleep 5;
xdotool key 'q'
sleep 5
xdotool key 'q'
sleep 0.4
xdotool key Return
sleep 0.4
@@ -18,8 +18,8 @@ xdotool key "Control+a"
sleep 0.4
xdotool key Escape
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
OUTPUT=$(tr '\n' ' ' < output.txt)
if [ "${OUTPUT}" != '' ]
@@ -27,7 +27,7 @@ then
echo "Got: '${OUTPUT}' expected nothing"
exit 1
fi
if [ ${RETV} != 1 ]
if [ "${RETV}" != 1 ]
then
exit 1
exit 1
fi

View File

@@ -4,8 +4,8 @@ rofi -show window -modi window &
RPID=$!
# send enter.
sleep 5;
xdotool key 't'
sleep 5
xdotool key 't'
sleep 0.4
xdotool key 'r'
sleep 0.4
@@ -15,8 +15,8 @@ xdotool key 'e'
sleep 0.4
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
exit ${RETV}
exit "${RETV}"

View File

@@ -4,8 +4,8 @@ echo -e "aap\nnoot\nmies" | rofi -dmenu &
RPID=$!
# send enter.
sleep 5;
xdotool key 't'
sleep 5
xdotool key 't'
sleep 0.4
xdotool key 'r'
sleep 0.4
@@ -13,12 +13,12 @@ xdotool key 'u'
sleep 0.4
xdotool key 'e'
sleep 0.4
xdotool key End
xdotool key End
sleep 0.4
xdotool key Return
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
exit ${RETV}
exit "${RETV}"

View File

@@ -1,11 +1,11 @@
#!/usr/bin/env bash
echo -en "nooty\naap\nnoot\nmies" | rofi -matching regex -dmenu > output.txt &
echo -en "nooty\naap\nnoot\nmies" | rofi -matching regex -dmenu > output.txt &
RPID=$!
# send enter.
sleep 5;
xdotool key Shift+'6'
sleep 5
xdotool key Shift+'6'
sleep 0.4
xdotool key 'n'
sleep 0.4
@@ -19,8 +19,8 @@ xdotool key Shift+'4'
sleep 0.4
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
OUTPUT=$(cat output.txt)
if [ "${OUTPUT}" != 'noot' ]
@@ -29,4 +29,4 @@ then
exit 1
fi
exit ${RETV}
exit "${RETV}"

View File

@@ -1,11 +1,11 @@
#!/usr/bin/env bash
rofi -show run &
rofi -show run &
RPID=$!
# send enter.
sleep 5;
xdotool key 't'
sleep 5
xdotool key 't'
sleep 0.4
xdotool key 'r'
sleep 0.4
@@ -15,8 +15,8 @@ xdotool key 'e'
sleep 0.4
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
exit ${RETV}
exit "${RETV}"

View File

@@ -1,12 +1,12 @@
#!/usr/bin/env bash
export ROFI_PNG_OUTPUT=out.png
rofi -show run &
rofi -show run &
RPID=$!
# send enter.
sleep 5;
xdotool key 't'
sleep 5
xdotool key 't'
sleep 0.4
xdotool key 'r'
sleep 0.4
@@ -16,8 +16,8 @@ xdotool key Alt+Shift+s
sleep 0.4
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
if [ ! -f out.png ]
@@ -25,4 +25,4 @@ then
echo "Failed to create screenshot"
exit 1
fi
exit ${RETV}
exit "${RETV}"

View File

@@ -4,23 +4,23 @@ SP=$(readlink -f "$0")
DIR=$(dirname "$SP")
echo "$DIR/test_script.sh"
# wait till it is up, run rofi with error message
sleep 1;
sleep 1
rofi -modi "custom:$DIR/test_script.sh" -show custom &
RPID=$!
# send enter.
sleep 5;
sleep 5
xdotool key 'z'
sleep 0.4
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
OUTPUT=$( tr '\n' ' ' < output.txt )
echo ${OUTPUT}
echo "${OUTPUT}"
if [ "${OUTPUT}" != 'mies ' ]
then
exit 1
fi
exit ${RETV}
exit "${RETV}"

View File

@@ -4,23 +4,23 @@ SP=$(readlink -f "$0")
DIR=$(dirname "$SP")
echo "$DIR/test_script.sh"
# wait till it is up, run rofi with error message
sleep 1;
rofi -modi "custom:$DIR/test_script.sh" -show custom &
sleep 1
rofi -modi "custom:$DIR/test_script.sh" -show custom &
RPID=$!
# send enter.
sleep 5;
xdotool key 'Down'
sleep 5
xdotool key 'Down'
sleep 0.4
xdotool key Return
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
OUTPUT=$( tr '\n' ' ' < output.txt )
echo ${OUTPUT}
echo "${OUTPUT}"
if [ "${OUTPUT}" != 'noot ' ]
then
exit 1
fi
exit ${RETV}
exit "${RETV}"

View File

@@ -1,12 +1,12 @@
#!/usr/bin/env bash
# wait till it is up, run rofi with error message
sleep 1 && rofi -show run -modi run &
sleep 1 && rofi -show run -modi run &
RPID=$!
# send enter.
sleep 5;
xdotool key 'shift+slash'
sleep 5
xdotool key 'shift+slash'
sleep 0.4
xdotool key 'shift+slash'
sleep 0.4
@@ -14,10 +14,10 @@ xdotool key 'shift+slash'
sleep 0.4
xdotool key Escape
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
sleep 1
exit ${RETV}
exit "${RETV}"

View File

@@ -2,14 +2,14 @@
XPID=
FPID=
function create_fake_x ( )
create_fake_x()
{
export DISPLAY=":$1"
echo -n "Starting fake X for display ${DISPLAY}: "
Xvfb -nolisten tcp +extension XINERAMA +xinerama -screen 0 1280x1024x24 ${DISPLAY} &>$2-server.log &
Xvfb -nolisten tcp +extension XINERAMA +xinerama -screen 0 1280x1024x24 "${DISPLAY}" &>$2-server.log &
XPID=$!
echo "pid ${XPID}"
sleep 1;
sleep 1
if [ -x "$(which fluxbox 2>/dev/null)" ]; then
echo -n "Starting fluxbox for display ${DISPLAY}: "
timeout -k 30s 30s fluxbox &>$2-fluxbox.log &
@@ -19,24 +19,24 @@ function create_fake_x ( )
fi
}
function destroy_fake_x ( )
destroy_fake_x()
{
if [ -n "${XPID}" ]
then
if [ -n "${FPID}" ]; then
echo -n "Stopping fluxbox for display ${DISPLAY} (pid ${FPID}): "
if kill ${FPID} &>$1-kill-fluxbox.log; then
if kill "${FPID}" &>$1-kill-fluxbox.log; then
echo -n " killed... "
wait ${FPID} &>$1-wait-fluxbox.log
wait "${FPID}" &>$1-wait-fluxbox.log
echo "stopped"
else
echo -n " failed to kill"
fi
fi
echo -n "Stopping fake X for display ${DISPLAY} (pid ${XPID}): "
if kill ${XPID} &>$1-kill-X.log; then
if kill "${XPID}" &>$1-kill-X.log; then
echo -n " killed... "
wait ${XPID} &>$1-wait-X.log
wait "${XPID}" &>$1-wait-X.log
echo "stopped"
else
echo -n " failed to kill"
@@ -55,4 +55,4 @@ RES=$?
destroy_fake_x "$2"
exit ${RES}
exit "${RES}"

View File

@@ -1,46 +1,46 @@
#!/usr/bin/env bash
# wait till it is up, run rofi with error message
sleep 1;
sleep 1
xterm -T MonkeySee sh &
XPID=$!
echo "Started MonkeySee xterm: pid ${XPID}"
sleep 1;
sleep 1
xterm -T TermUnwanted sh &
TPID=$!
echo "Started TermUnwanted xterm: pid ${TPID}"
sleep 1;
sleep 1
rofi -modi window -show window > output.txt &
RPID=$!
echo "Started rofi: pid ${RPID}"
# send enter.
sleep 5;
sleep 5
xdotool type 'MonkeySee'
sleep 0.4
xdotool key Return
sleep 1;
sleep 1
xdotool key Ctrl+d
sleep 1;
sleep 1
echo -n "Killing TermUnwanted: "
if kill ${TPID}; then
if kill "${TPID}"; then
echo "done"
wait ${TPID}
wait "${TPID}"
fi
if ps -q ${XPID} # pgrep -u $USER xterm
if ps -q "${XPID}" # pgrep -u $USER xterm
then
echo "Found remaining xterms: $(pgrep -u $USER xterm)"
kill ${XPID}
echo "Found remaining xterms: $(pgrep -u "$USER" xterm)"
kill "${XPID}"
fi
if ps -q ${RPID}
if ps -q "${RPID}"
then
echo "Rofi still running"
kill ${RPID}
kill "${RPID}"
exit 1
fi
# Get result, kill xvfb
wait ${RPID}
# Get result, kill xvfb
wait "${RPID}"
RETV=$?
exit ${RETV}
exit "${RETV}"

View File

@@ -42,6 +42,7 @@
#include "xrmoptions.h"
#include "helper.h"
#include "display.h"
#include "rofi-icon-fetcher.h"
unsigned int test =0;
#define TASSERT( a ) { \
assert ( a ); \
@@ -51,18 +52,34 @@ unsigned int test =0;
#define TASSERTE( a, b ) { \
if ( ( a ) == ( b ) ) { \
printf ( "Test %u passed (%s == %s) (%u == %u)\n", ++test, # a, # b, a, b ); \
}else { \
} else { \
printf ( "Test %u failed (%s == %s) (%u != %u)\n", ++test, # a, # b, a, b ); \
abort ( ); \
} \
}
ThemeWidget *rofi_configuration = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
int monitor_active ( G_GNUC_UNUSED workarea *mon )
{
return 0;
}
char * helper_get_theme_path ( const char *file )
char * helper_get_theme_path ( const char *file, const char *ext )
{
return g_strdup ( file );
}

View File

@@ -6,5 +6,5 @@ then
echo "noot"
echo -ne "mies\0meta\x1fzoom\n"
else
echo $1 > output.txt
echo "$1" > output.txt
fi

View File

@@ -42,6 +42,7 @@
#include "settings.h"
#include "xrmoptions.h"
#include "rofi-icon-fetcher.h"
static int test = 0;
unsigned int normal_window_mode = 0;
@@ -52,12 +53,28 @@ unsigned int normal_window_mode = 0;
#include "view.h"
ThemeWidget *rofi_configuration = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error )
{
return FALSE;
}
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg)
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
{
}
void rofi_view_queue_redraw ()
@@ -112,8 +129,8 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
TASSERT ( widget_get_width ( WIDGET ( box ) ) > 0 );
TASSERT ( textbox_get_height ( box ) > 0 );
TASSERT ( widget_get_width ( WIDGET ( box ) ) >= textbox_get_font_width ( box ) );
TASSERT ( textbox_get_height ( box ) >= textbox_get_font_height ( box ) );
TASSERT ( widget_get_width ( WIDGET ( box ) ) >= textbox_get_font_width ( box ) );
TASSERT ( textbox_get_height ( box ) >= textbox_get_font_height ( box ) );
TASSERT ( textbox_get_estimated_char_width ( ) > 0 );
@@ -165,18 +182,18 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
textbox_cursor ( box, 8 );
textbox_keybinding ( box, REMOVE_WORD_BACK );
TASSERT ( box->cursor == 4 );
TASSERT ( strcmp ( box->text, "aap mies" ) == 0 );
TASSERT ( strcmp ( box->text, "aap mies" ) == 0 );
textbox_keybinding ( box, REMOVE_TO_EOL );
TASSERT ( box->cursor == 4 );
TASSERT ( strcmp ( box->text, "aap " ) == 0 );
TASSERT ( strcmp ( box->text, "aap " ) == 0 );
textbox_text ( box, "aap noot mies" );
textbox_cursor ( box, 8 );
textbox_keybinding ( box, REMOVE_WORD_FORWARD );
TASSERT ( strcmp ( box->text, "aap noot" ) == 0 );
TASSERT ( strcmp ( box->text, "aap noot" ) == 0 );
textbox_keybinding ( box, MOVE_FRONT );
TASSERT ( box->cursor == 0 );
textbox_keybinding ( box, CLEAR_LINE );
TASSERT ( strcmp ( box->text, "" ) == 0 );
TASSERT ( strcmp ( box->text, "" ) == 0 );
textbox_text ( box, "aap noot mies" );
textbox_keybinding ( box, MOVE_END );
textbox_keybinding ( box, MOVE_WORD_BACK );
@@ -184,7 +201,7 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
textbox_keybinding ( box, MOVE_WORD_BACK );
TASSERT ( box->cursor == 4 );
textbox_keybinding ( box, REMOVE_TO_SOL );
TASSERT ( strcmp ( box->text, "noot mies" ) == 0 );
TASSERT ( strcmp ( box->text, "noot mies" ) == 0 );
TASSERT ( box->cursor == 0 );
textbox_font ( box, HIGHLIGHT );

View File

@@ -41,6 +41,7 @@
#include "css-colors.h"
#include "widgets/widget-internal.h"
#include "widgets/textbox.h"
#include "rofi-icon-fetcher.h"
#include <check.h>
@@ -48,6 +49,21 @@
#define REAL_COMPARE_DELTA 0.001
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
void rofi_clear_error_messages ( void ) {}
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
{
fputs ( msg, stderr );
@@ -110,7 +126,6 @@ void rofi_add_error_message ( GString *msg )
static void theme_parser_setup ( void )
{
error = 0;
}
static void theme_parser_teardown ( void )
{
@@ -118,7 +133,6 @@ static void theme_parser_teardown ( void )
ck_assert_int_eq ( error, 0);
rofi_theme_free ( rofi_theme );
rofi_theme = NULL;
}
START_TEST (test_core_empty_string )
@@ -149,9 +163,9 @@ START_TEST (test_core_empty_section )
ck_assert_ptr_null ( rofi_theme->properties );
ck_assert_ptr_null ( rofi_theme->parent );
ck_assert_str_eq ( rofi_theme->name, "Root" );
ck_assert_str_eq ( rofi_theme->widgets[3]->name, "test" );
ck_assert_ptr_null ( rofi_theme->widgets[3]->properties );
ck_assert_ptr_eq ( rofi_theme->widgets[3]->parent, rofi_theme );
//ck_assert_str_eq ( rofi_theme->widgets[3]->name, "test" );
//ck_assert_ptr_null ( rofi_theme->widgets[3]->properties );
//ck_assert_ptr_eq ( rofi_theme->widgets[3]->parent, rofi_theme );
}
END_TEST
START_TEST (test_core_error_root )
@@ -242,9 +256,9 @@ START_TEST ( test_properties_distance_em)
RofiDistance d = (RofiDistance){ {1, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_SOLID};
RofiPadding pi = (RofiPadding){d,d,d,d};
RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi);
ck_assert_int_eq ( p.left.base.distance , 10 );
ck_assert_int_eq( p.left.base.type , ROFI_PU_EM );
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
ck_assert_int_eq ( p.left.base.distance , 10 );
ck_assert_int_eq( p.left.base.type , ROFI_PU_EM );
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
}
END_TEST
@@ -258,14 +272,14 @@ START_TEST ( test_properties_distance_em_linestyle)
RofiDistance d = (RofiDistance){ {1, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_SOLID};
RofiPadding pi = (RofiPadding){d,d,d,d};
RofiPadding p = rofi_theme_get_padding ( &wid, "sol", pi);
ck_assert_double_eq_tol ( p.left.base.distance , 1.3 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_EM );
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
ck_assert_double_eq_tol ( p.left.base.distance , 1.3 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_EM );
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
p = rofi_theme_get_padding ( &wid, "dash", pi);
ck_assert_double_eq_tol ( p.left.base.distance , 1.5 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_EM );
ck_assert_int_eq( p.left.style, ROFI_HL_DASH);
ck_assert_double_eq_tol ( p.left.base.distance , 1.5 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_EM );
ck_assert_int_eq( p.left.style, ROFI_HL_DASH);
}
END_TEST
START_TEST ( test_properties_distance_px)
@@ -278,9 +292,9 @@ START_TEST ( test_properties_distance_px)
RofiDistance d = (RofiDistance){ {1, ROFI_PU_EM, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_DASH};
RofiPadding pi = (RofiPadding){d,d,d,d};
RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi);
ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_PX );
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_PX );
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
}
END_TEST
START_TEST ( test_properties_distance_px_linestyle)
@@ -293,13 +307,13 @@ START_TEST ( test_properties_distance_px_linestyle)
RofiDistance d = (RofiDistance){ {1, ROFI_PU_EM, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_DASH};
RofiPadding pi = (RofiPadding){d,d,d,d};
RofiPadding p = rofi_theme_get_padding ( &wid, "sol", pi);
ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_PX );
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_PX );
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
p = rofi_theme_get_padding ( &wid, "dash", pi);
ck_assert_double_eq_tol ( p.left.base.distance , 14.0 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_PX );
ck_assert_int_eq( p.left.style, ROFI_HL_DASH);
ck_assert_double_eq_tol ( p.left.base.distance , 14.0 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_PX );
ck_assert_int_eq( p.left.style, ROFI_HL_DASH);
}
END_TEST
START_TEST ( test_properties_distance_percent)
@@ -312,9 +326,9 @@ START_TEST ( test_properties_distance_percent)
RofiDistance d = (RofiDistance){ {1, ROFI_PU_EM, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_DASH};
RofiPadding pi = (RofiPadding){d,d,d,d};
RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi);
ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_PERCENT);
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_PERCENT);
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
}
END_TEST
START_TEST ( test_properties_distance_percent_linestyle)
@@ -327,13 +341,13 @@ START_TEST ( test_properties_distance_percent_linestyle)
RofiDistance d = (RofiDistance){ {1, ROFI_PU_EM, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_DASH};
RofiPadding pi = (RofiPadding){d,d,d,d};
RofiPadding p = rofi_theme_get_padding ( &wid, "sol", pi);
ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_PERCENT);
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
ck_assert_double_eq_tol ( p.left.base.distance , 10.0 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_PERCENT);
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
p = rofi_theme_get_padding ( &wid, "dash", pi);
ck_assert_double_eq_tol ( p.left.base.distance , 10 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_PERCENT);
ck_assert_int_eq( p.left.style, ROFI_HL_DASH);
ck_assert_double_eq_tol ( p.left.base.distance , 10 , REAL_COMPARE_DELTA );
ck_assert_int_eq( p.left.base.type , ROFI_PU_PERCENT);
ck_assert_int_eq( p.left.style, ROFI_HL_DASH);
}
END_TEST
START_TEST ( test_properties_position)
@@ -982,14 +996,14 @@ START_TEST ( test_properties_padding_2 )
RofiDistance d = (RofiDistance){ {1, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_SOLID};
RofiPadding pi = (RofiPadding){d,d,d,d};
RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi);
ck_assert_double_eq_tol ( p.left.base.distance , 20, REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.left.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.right.base.distance , 20, REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.right.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.top.base.distance , 10, REAL_COMPARE_DELTA);
ck_assert_int_eq ( p.top.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.bottom.base.distance , 10, REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.bottom.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.left.base.distance , 20, REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.left.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.right.base.distance , 20, REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.right.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.top.base.distance , 10, REAL_COMPARE_DELTA);
ck_assert_int_eq ( p.top.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.bottom.base.distance , 10, REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.bottom.base.type , ROFI_PU_PX );
}
END_TEST
@@ -1002,14 +1016,14 @@ START_TEST ( test_properties_padding_3 )
RofiDistance d = (RofiDistance){ {1, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_SOLID};
RofiPadding pi = (RofiPadding){d,d,d,d};
RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi);
ck_assert_double_eq_tol ( p.left.base.distance , 30, REAL_COMPARE_DELTA);
ck_assert_int_eq ( p.left.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.right.base.distance , 30, REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.right.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.top.base.distance , 10, REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.top.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.bottom.base.distance , 20, REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.bottom.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.left.base.distance , 30, REAL_COMPARE_DELTA);
ck_assert_int_eq ( p.left.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.right.base.distance , 30, REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.right.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.top.base.distance , 10, REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.top.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.bottom.base.distance , 20, REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.bottom.base.type , ROFI_PU_PX );
}
END_TEST
@@ -1022,14 +1036,14 @@ START_TEST ( test_properties_padding_4 )
RofiDistance d = (RofiDistance){ {1, ROFI_PU_PX, ROFI_DISTANCE_MODIFIER_NONE,NULL, NULL }, ROFI_HL_SOLID};
RofiPadding pi = (RofiPadding){d,d,d,d};
RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi);
ck_assert_double_eq_tol ( p.left.base.distance , 40 , REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.left.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.right.base.distance , 30 , REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.right.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.top.base.distance , 10 , REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.top.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.bottom.base.distance , 20 , REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.bottom.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.left.base.distance , 40 , REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.left.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.right.base.distance , 30 , REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.right.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.top.base.distance , 10 , REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.top.base.type , ROFI_PU_PX );
ck_assert_double_eq_tol ( p.bottom.base.distance , 20 , REAL_COMPARE_DELTA );
ck_assert_int_eq ( p.bottom.base.type , ROFI_PU_PX );
}
END_TEST
@@ -1080,8 +1094,7 @@ START_TEST ( test_properties_integer)
}
END_TEST
START_TEST ( test_properties_orientation )
START_TEST ( test_properties_orientation )
{
widget wid;
wid.name = "blaat";
@@ -1095,7 +1108,7 @@ START_TEST ( test_properties_orientation )
}
END_TEST
START_TEST ( test_properties_orientation_case )
START_TEST ( test_properties_orientation_case )
{
widget wid;
wid.name = "blaat";
@@ -1106,7 +1119,29 @@ START_TEST ( test_properties_orientation_case )
}
END_TEST
START_TEST ( test_properties_list )
START_TEST ( test_properties_cursor )
{
widget wid;
wid.name = "blaat";
wid.state = NULL;
rofi_theme_parse_string ( "* { def: default; ptr: pointer; txt: text; }");
ck_assert_int_eq ( rofi_theme_get_cursor_type( &wid, "def", ROFI_CURSOR_TEXT), ROFI_CURSOR_DEFAULT);
ck_assert_int_eq ( rofi_theme_get_cursor_type( &wid, "ptr", ROFI_CURSOR_DEFAULT), ROFI_CURSOR_POINTER);
ck_assert_int_eq ( rofi_theme_get_cursor_type( &wid, "txt", ROFI_CURSOR_DEFAULT), ROFI_CURSOR_TEXT);
}
END_TEST
START_TEST ( test_properties_cursor_case )
{
widget wid;
wid.name = "blaat";
wid.state = NULL;
rofi_theme_parse_string ( "* { def: dEfault; ptr: POINter; txt: tExt; }");
ck_assert_int_eq ( rofi_theme_get_cursor_type( &wid, "def", ROFI_CURSOR_TEXT), ROFI_CURSOR_DEFAULT);
ck_assert_int_eq ( rofi_theme_get_cursor_type( &wid, "ptr", ROFI_CURSOR_DEFAULT), ROFI_CURSOR_POINTER);
ck_assert_int_eq ( rofi_theme_get_cursor_type( &wid, "txt", ROFI_CURSOR_DEFAULT), ROFI_CURSOR_TEXT);
}
END_TEST
START_TEST ( test_properties_list )
{
widget wid;
wid.name = "blaat";
@@ -1199,13 +1234,11 @@ START_TEST ( test_core_properties_error )
g_string_free ( error_msg, TRUE);
error_msg = NULL;
error = 0;
}
END_TEST
START_TEST ( test_import_error )
{
rofi_theme_parse_string("@import \"/non-existing-file.rasi\"");
const char *errstr =
@@ -1238,13 +1271,12 @@ START_TEST ( test_prepare_path )
f = rofi_theme_parse_prepare_file ( "/tmp/test.rasi" , "/random/");
ck_assert_ptr_nonnull ( f );
ck_assert_str_eq ( f, "/tmp/test.rasi" );
g_free ( f );
g_free ( f );
g_free ( current_dir );
}
END_TEST
START_TEST(test_properties_types_names)
{
ck_assert_str_eq ( PropertyTypeName[P_INTEGER], "Integer");
@@ -1258,7 +1290,6 @@ START_TEST(test_properties_types_names)
ck_assert_str_eq ( PropertyTypeName[P_HIGHLIGHT], "Highlight");
ck_assert_str_eq ( PropertyTypeName[P_LIST], "List");
ck_assert_str_eq ( PropertyTypeName[P_ORIENTATION], "Orientation");
}
END_TEST
@@ -1375,6 +1406,13 @@ static Suite * theme_parser_suite (void)
tcase_add_test ( tc_prop_orientation, test_properties_orientation_case );
suite_add_tcase(s, tc_prop_orientation );
}
{
TCase *tc_prop_cursor = tcase_create("Propertiescursor");
tcase_add_checked_fixture(tc_prop_cursor, theme_parser_setup, theme_parser_teardown);
tcase_add_test ( tc_prop_cursor, test_properties_cursor);
tcase_add_test ( tc_prop_cursor, test_properties_cursor_case );
suite_add_tcase(s, tc_prop_cursor );
}
{
TCase *tc_prop_list = tcase_create("Propertieslist");
tcase_add_checked_fixture(tc_prop_list, theme_parser_setup, theme_parser_teardown);
@@ -1409,7 +1447,7 @@ static Suite * theme_parser_suite (void)
return s;
}
int main ( int argc, char ** argv )
int main ( int argc, char **argv )
{
cmd_set_arguments ( argc, argv );
@@ -1418,7 +1456,6 @@ int main ( int argc, char ** argv )
return EXIT_FAILURE;
}
Suite *s;
SRunner *sr;

View File

@@ -38,11 +38,29 @@
#include "display.h"
#include "xrmoptions.h"
#include "xcb.h"
#include "rofi-icon-fetcher.h"
unsigned int test =0;
#define TASSERT( a ) { \
assert ( a ); \
printf ( "Test %3u passed (%s)\n", ++test, # a ); \
}
ThemeWidget *rofi_configuration = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
}
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
{
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error )
{
return FALSE;
@@ -80,8 +98,8 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
widget_move ( wid, 10, 10);
// Getter, setter x pos
//
TASSERT( widget_get_x_pos ( wid ) == 10 );
TASSERT( widget_get_y_pos ( wid ) == 10 );
TASSERT ( widget_get_x_pos ( wid ) == 10 );
TASSERT ( widget_get_y_pos ( wid ) == 10 );
// Left of box
TASSERT ( widget_intersect ( wid, 0, 0) == 0 );
@@ -172,14 +190,13 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
TASSERT ( widget_intersect ( wid, 20+30, 20+40) == 0 );
TASSERT ( widget_intersect ( wid, 20+30, 20+50) == 0 );
TASSERT ( widget_intersect ( wid, -100, -100) == 0);
TASSERT ( widget_intersect ( wid, INT_MIN, INT_MIN) == 0);
TASSERT ( widget_intersect ( wid, INT_MAX, INT_MAX) == 0);
// Other wrappers.
TASSERT ( widget_get_height ( wid ) == wid->h);
TASSERT ( widget_get_width ( wid ) == wid->w);
TASSERT ( widget_get_height ( wid ) == wid->h);
TASSERT ( widget_get_width ( wid ) == wid->w);
TASSERT ( widget_enabled ( wid ) == FALSE );
widget_enable ( wid );
@@ -189,8 +206,8 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
// Null pointer tests.
TASSERT ( widget_intersect ( NULL, 0, 0) == 0 );
widget_move ( NULL, 0, 0 );
TASSERT ( widget_get_height ( NULL ) == 0);
TASSERT ( widget_get_width ( NULL ) == 0);
TASSERT ( widget_get_height ( NULL ) == 0);
TASSERT ( widget_get_width ( NULL ) == 0);
TASSERT ( widget_enabled ( NULL ) == 0);
widget_disable ( NULL );
widget_enable ( NULL );
@@ -203,6 +220,5 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
widget_trigger_action ( NULL, 0, 0, 0 );
widget_set_trigger_action_handler ( NULL, NULL, NULL );
g_free(wid);
}

View File

@@ -1,15 +0,0 @@
#!/usr/bin/env bash
TOP_DIR=$1
xrdb -retain -load ${TOP_DIR}/doc/test_xr.txt
rofi -config ${TOP_DIR}/doc/test_xr.txt -dump-xresources | grep -v "rofi.display-" | grep -v "The display name of this browser" > temp.txt
if ! diff temp.txt ${TOP_DIR}/doc/test_xr.txt > /dev/null
then
echo "Dump xresources does not match."
diff temp.txt ${TOP_DIR}/doc/test_xr.txt
exit 1;
fi
exit ${RETV}