diff --git a/.gitignore b/.gitignore index 708a9dc8..c6bf58c3 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,7 @@ aclocal.m4 autom4te.cache/ compile depcomp - +*.o +*.gcov +*.gcda +*.gcno diff --git a/test/Makefile.am b/test/Makefile.am index 3627af70..ca005fe3 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -42,3 +42,4 @@ test: ${bin_PROGRAMS} $(top_srcdir)/test/run_test.sh 202 $(top_srcdir)/test/run_dmenu_test.sh $(top_builddir) $(top_srcdir)/test/run_test.sh 203 $(top_srcdir)/test/run_dmenu_custom_test.sh $(top_builddir) $(top_srcdir)/test/run_test.sh 204 $(top_srcdir)/test/run_run_test.sh $(top_builddir) + $(top_srcdir)/test/run_test.sh 205 $(top_srcdir)/test/run_script_test.sh $(top_builddir) diff --git a/test/run_script_test.sh b/test/run_script_test.sh new file mode 100755 index 00000000..fef075f8 --- /dev/null +++ b/test/run_script_test.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +SP=$(readlink -f "$0") +DIR=$(dirname "$SP") +echo $DIR +# wait till it is up, run rofi with error message +sleep 1; +rofi -switchers "custom:$DIR/test_script.sh" -show custom & +RPID=$! + +# send enter. +sleep 5; +xdotool key 'Down' +sleep 0.4 +xdotool key Return + +# Get result, kill xvfb +wait ${RPID} +RETV=$? +OUTPUT=$(cat output.txt | tr '\n' ' ') +if [ "${OUTPUT}" != 'noot ' ] +then + exit 1 +fi +exit ${RETV} diff --git a/test/test_script.sh b/test/test_script.sh new file mode 100755 index 00000000..c4021380 --- /dev/null +++ b/test/test_script.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +if [ -z "$1" ] +then + echo "aap" + echo "noot" + echo "mies" +else + echo $1 > output.txt +fi