From 4ab95f5d26c48c63e7d9565e092b2d1eb19ec371 Mon Sep 17 00:00:00 2001 From: QC Date: Fri, 29 Aug 2014 16:57:36 +0200 Subject: [PATCH] Add dmenu test. --- Makefile.am | 1 + test/run_dmenu_test.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 test/run_dmenu_test.sh diff --git a/Makefile.am b/Makefile.am index b9e45767..ce715686 100644 --- a/Makefile.am +++ b/Makefile.am @@ -90,3 +90,4 @@ test: rofi make -C test/ test ./test/run_errormsg_test.sh ./test/run_switchdialog_test.sh + ./test/run_dmenu_test.sh diff --git a/test/run_dmenu_test.sh b/test/run_dmenu_test.sh new file mode 100755 index 00000000..5bdb84ea --- /dev/null +++ b/test/run_dmenu_test.sh @@ -0,0 +1,31 @@ +#!/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 'Down' +sleep 0.4 +DISPLAY=:202 xdotool key 'Down' +sleep 0.4 +DISPLAY=:202 xdotool key Return + +# Get result, kill xvfb +wait ${RPID} +RETV=$? +kill ${XPID} + +sleep 1 + +if [ `cat output.txt` != 'aap' ] +then + exit 1 +fi +exit ${RETV}