diff --git a/Makefile.am b/Makefile.am index 304b5b87..efc4ef15 100644 --- a/Makefile.am +++ b/Makefile.am @@ -91,4 +91,5 @@ test: rofi ./test/run_errormsg_test.sh ./test/run_switchdialog_test.sh ./test/run_dmenu_test.sh + ./test/run_dmenu_custom_test.sh ./test/run_run_test.sh diff --git a/test/run_dmenu_custom_test.sh b/test/run_dmenu_custom_test.sh new file mode 100755 index 00000000..6b110863 --- /dev/null +++ b/test/run_dmenu_custom_test.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +# Create fake X +Xvfb :202 & +XPID=$! + +# wait till it is up, run rofi with error message +sleep 1; +echo -e -n "aap\nnoot\nmies" | ./rofi -dmenu -display :202 > output.txt & +RPID=$! + +# send enter. +sleep 5; +DISPLAY=:202 xdotool key 'c' +sleep 0.2 +DISPLAY=:202 xdotool key 'o' +sleep 0.2 +DISPLAY=:202 xdotool key 'f' +sleep 0.2 +DISPLAY=:202 xdotool key 'f' +sleep 0.2 +DISPLAY=:202 xdotool key 'e' +sleep 0.2 +DISPLAY=:202 xdotool key 'e' +sleep 0.2 +DISPLAY=:202 xdotool key Return + +# Get result, kill xvfb +wait ${RPID} +RETV=$? +kill ${XPID} + +sleep 1 + +if [ `cat output.txt` != 'coffee' ] +then + exit 1 +fi +exit ${RETV}