Simple maintenance improvements (#1370)

* rofi moved to libera.chat

* unify some theme headers and whitespace

* consistently use the same hashbang for bash

* improve obsolete way of testing equality

see https://github.com/koalaman/shellcheck/wiki/SC2268 for explanation

* use consistent function definitions in bash scripts

* remove duplicated author and fix whitespace

* quote all variables in scripts

fixes many warnings identified through shellcheck

* fix whitespace in scripts

* fix whitespace in non-source files

* fix spelling in non-source files

* fix whitespace and indentation in source files

* fix spelling in source files
This commit is contained in:
a1346054
2021-08-14 11:03:16 +00:00
committed by GitHub
parent 69c6004681
commit c62137f8ab
113 changed files with 784 additions and 832 deletions

View File

@@ -49,7 +49,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,7 +58,7 @@ 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 ( ); \
} \
@@ -79,7 +79,6 @@ cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
return NULL;
}
int monitor_active ( G_GNUC_UNUSED workarea *mon )
{
return 0;
@@ -116,7 +115,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

@@ -49,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 ( ); \
} \
@@ -73,13 +73,12 @@ void rofi_clear_error_messages (void )
{
}
gboolean rofi_theme_parse_string ( const char *string )
{
return FALSE;
}
double textbox_get_estimated_char_height ( void )
double textbox_get_estimated_char_height ( void )
{
return 12.0;
}
@@ -110,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 ) {
@@ -137,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

@@ -50,7 +50,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 ( ); \
} \
@@ -71,7 +71,7 @@ cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
return NULL;
}
double textbox_get_estimated_char_height ( void )
double textbox_get_estimated_char_height ( void )
{
return 12.0;
}
@@ -108,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

@@ -71,7 +71,7 @@ gboolean rofi_theme_parse_string ( const char *string )
{
return FALSE;
}
double textbox_get_estimated_char_height ( void )
double textbox_get_estimated_char_height ( void )
{
return 12.0;
}
@@ -101,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" );
@@ -113,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

@@ -49,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 ( ); \
} \
@@ -57,7 +57,7 @@ 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 ( ); \
} \
@@ -87,7 +87,7 @@ cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
return NULL;
}
double textbox_get_estimated_char_height ( void )
double textbox_get_estimated_char_height ( void )
{
return 12.0;
}
@@ -120,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

@@ -66,7 +66,7 @@ gboolean rofi_theme_parse_string ( G_GNUC_UNUSED const char *string )
return FALSE;
}
double textbox_get_estimated_char_height ( void )
double textbox_get_estimated_char_height ( void )
{
return 12.0;
}
@@ -485,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" );

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

@@ -69,7 +69,7 @@ gboolean rofi_theme_parse_string ( const char *string )
return FALSE;
}
double textbox_get_estimated_char_height ( void )
double textbox_get_estimated_char_height ( void )
{
return 16.0;
}
@@ -125,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 );
}
@@ -147,7 +147,7 @@ START_TEST(test_mode_num_items)
{
unsigned int rows = mode_get_num_entries ( &help_keys_mode);
ck_assert_int_eq ( rows, 74);
for ( unsigned int i =0; i < rows; i++ ){
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 );
@@ -221,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

@@ -23,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
@@ -36,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,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

@@ -51,7 +51,7 @@ 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 ( ); \
} \

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

@@ -53,14 +53,13 @@ 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)
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
{
return 0;
}
@@ -75,7 +74,7 @@ gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNU
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 ()
@@ -130,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 );
@@ -183,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 );
@@ -202,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

@@ -51,20 +51,19 @@
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
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;
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
return NULL;
}
int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
{
fputs ( msg, stderr );
@@ -127,7 +126,6 @@ void rofi_add_error_message ( GString *msg )
static void theme_parser_setup ( void )
{
error = 0;
}
static void theme_parser_teardown ( void )
{
@@ -135,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 )
@@ -259,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
@@ -275,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)
@@ -295,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)
@@ -310,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)
@@ -329,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)
@@ -344,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)
@@ -999,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
@@ -1019,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
@@ -1039,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
@@ -1097,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";
@@ -1112,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";
@@ -1123,7 +1119,7 @@ START_TEST ( test_properties_orientation_case )
}
END_TEST
START_TEST ( test_properties_cursor )
START_TEST ( test_properties_cursor )
{
widget wid;
wid.name = "blaat";
@@ -1134,7 +1130,7 @@ START_TEST ( test_properties_cursor )
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 )
START_TEST ( test_properties_cursor_case )
{
widget wid;
wid.name = "blaat";
@@ -1145,7 +1141,7 @@ START_TEST ( test_properties_cursor_case )
ck_assert_int_eq ( rofi_theme_get_cursor_type( &wid, "txt", ROFI_CURSOR_DEFAULT), ROFI_CURSOR_TEXT);
}
END_TEST
START_TEST ( test_properties_list )
START_TEST ( test_properties_list )
{
widget wid;
wid.name = "blaat";
@@ -1238,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 =
@@ -1277,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");
@@ -1297,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
@@ -1455,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 );
@@ -1464,7 +1456,6 @@ int main ( int argc, char ** argv )
return EXIT_FAILURE;
}
Suite *s;
SRunner *sr;

View File

@@ -49,16 +49,16 @@ ThemeWidget *rofi_configuration = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
return 0;
return 0;
}
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
{
return 0;
return 0;
}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
return NULL;
}
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error )
@@ -98,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 );
@@ -190,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 );
@@ -207,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 );
@@ -221,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);
}