From 89620e148153c132365e92f2a56a8d7f3a2103d4 Mon Sep 17 00:00:00 2001 From: Tommaso Cucinotta Date: Sun, 6 Feb 2011 22:50:07 +0000 Subject: [PATCH] Made use of internal hacked xvkbd optional. Now it is needed and used only if the XVKBD_HACKED environment var is defined. Made keytest.py exploit the -wait_idle option of the hacked xvkbd. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37521 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/autotests/keytest.py | 24 +++++++++++++++--------- development/autotests/run-tests.sh | 6 +++++- development/autotests/single-test.sh | 7 ++++++- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/development/autotests/keytest.py b/development/autotests/keytest.py index 748e833c96..138342f365 100755 --- a/development/autotests/keytest.py +++ b/development/autotests/keytest.py @@ -20,7 +20,8 @@ print 'Beginning keytest.py' FNULL = open('/dev/null', 'w') -DELAY = '59' +def_delay = '60' +key_delay = '' class CommandSource: @@ -207,13 +208,16 @@ def sendKeystring(keystr, LYX_PID): intr_system('import -window root '+screenshot_out+str(x.count)+".png") time.sleep(0.1) sys.stdout.flush() - if (subprocess.call( - [xvkbd_exe, "-no_root", "-xsendevent", "-window", lyx_window_name, "-delay", DELAY, "-text", keystr], - stdout=FNULL,stderr=FNULL - ) == 0): - sys.stdout.write('*') + actual_delay = key_delay + if actual_delay == '': + actual_delay = def_delay + if not xvkbd_hacked: + subprocess.call([xvkbd_exe, "-xsendevent", "-window", lyx_window_name, + "-delay", actual_delay, "-text", keystr], stdout = FNULL, stderr = FNULL) else: - sys.stdout.write('X') + subprocess.call([xvkbd_exe, "-no_root", "-wait_idle", lyx_pid, + "-xsendevent", "-window", lyx_window_name, + "-delay", actual_delay, "-text", keystr], stdout = FNULL, stderr = FNULL) def system_retry(num_retry, cmd): i = 0 @@ -256,6 +260,8 @@ xvkbd_exe = os.environ.get('XVKBD_EXE') if xvkbd_exe is None: xvkbd_exe = "xvkbd" +xvkbd_hacked = os.environ.get('XVKBD_HACKED') != None + file_new_command = os.environ.get('FILE_NEW_COMMAND') if file_new_command is None: file_new_command = "\Afn" @@ -351,8 +357,8 @@ while not failed: print 'No path /proc/' + lyx_pid + '/status, exiting' os._exit(1) elif c[0:4] == 'KD: ': - DELAY = c[4:].rstrip('\n') - print 'Setting DELAY to ' + DELAY + '.' + key_delay = c[4:].rstrip('\n') + print 'Setting DELAY to ' + key_delay + '.' elif c == 'Loop': RaiseWindow() sendKeystring(ResetCommand, lyx_pid) diff --git a/development/autotests/run-tests.sh b/development/autotests/run-tests.sh index 36ab6ecb78..8514aa1668 100755 --- a/development/autotests/run-tests.sh +++ b/development/autotests/run-tests.sh @@ -10,7 +10,11 @@ if [ ! -x xvkbd/xvkbd ]; then fi export LYX_EXE=../../../src/lyx -export XVKBD_EXE=../xvkbd/xvkbd + +if [ "$XVKBD_HACKED" != "" ]; then + export XVKBD_EXE=${XVKBD:-../xvkbd/xvkbd}; +fi + export KEYTEST=../keytest.py LYX_HOME=out-home export LYX_USERDIR=$(pwd)/$LYX_HOME/.lyx diff --git a/development/autotests/single-test.sh b/development/autotests/single-test.sh index 27c56cff1d..d5bdd87241 100755 --- a/development/autotests/single-test.sh +++ b/development/autotests/single-test.sh @@ -22,6 +22,11 @@ if [ "$(pidof lyx)" != "" ]; then fi export MAX_LOOPS=1 export LYX_EXE=${LYX_EXE:-../../src/lyx} -export XVKBD_EXE=${XVKBD_EXE:-./xvkbd/xvkbd} + +if [ "$XVKBD_HACKED" != "" ]; then + export XVKBD_EXE=${XVKBD_EXE:-./xvkbd/xvkbd}; +else + export XVKBD_EXE=${XVKBD_EXE:-xvkbd}; +fi $KEYTEST -- 2.39.2