From 034d5632a2bc83bc593add21bc0357a03a09a11e Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Tue, 17 Mar 2015 17:36:47 +0100 Subject: [PATCH] Make tests for QT5 and QT4 work. Changing *-in.txt due to erroneous shortcuts in it.po keytest.py, single-test.cmake and CMakeLists.txt now provide a frontend hint for xvkbd. --- development/autotests/CMakeLists.txt | 1 + development/autotests/findadv-05-in.txt | 8 ++++---- development/autotests/findadv-09-in.txt | 8 ++++---- development/autotests/findadv-10-in.txt | 8 ++++---- development/autotests/findadv-11-in.txt | 4 ++-- development/autotests/findadv-14-in.txt | 8 ++++---- development/autotests/findadv-15-in.txt | 8 ++++---- development/autotests/findadv-16-in.txt | 8 ++++---- development/autotests/findadv-17-in.txt | 4 ++-- development/autotests/findadv-re-01-in.txt | 8 ++++---- development/autotests/findadv-re-02-in.txt | 12 ++++++------ development/autotests/findadv-re-03-in.txt | 8 ++++---- development/autotests/findadv-re-04-in.txt | 4 ++-- development/autotests/findadv-re-06-in.txt | 4 ++-- development/autotests/hello-world-in.txt | 5 ++--- development/autotests/keytest.py | 20 +++++++++++++------- development/autotests/single-test.cmake | 2 ++ 17 files changed, 64 insertions(+), 56 deletions(-) diff --git a/development/autotests/CMakeLists.txt b/development/autotests/CMakeLists.txt index 0ad195f71c..eca516b26c 100644 --- a/development/autotests/CMakeLists.txt +++ b/development/autotests/CMakeLists.txt @@ -105,6 +105,7 @@ if(QT_USES_X11) -DLYX_USERDIR_VER=${LYX_USERDIR_VER} -DKEYTEST_OUTFILE=${_t}-out.txt -DPACKAGE=${PACKAGE} + -DFRONTEND=${LYX_USE_QT} -DLOCALE_DIR=${LOCALE_DIR} -P ${TOP_SRC_DIR}/development/autotests/single-test.cmake) settestlabel(keytest/${_t} "key") diff --git a/development/autotests/findadv-05-in.txt b/development/autotests/findadv-05-in.txt index 2850f09f08..9c8db9f480 100644 --- a/development/autotests/findadv-05-in.txt +++ b/development/autotests/findadv-05-in.txt @@ -1,23 +1,23 @@ # Basic test for format-aware searching # -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: foo \Cefoo foo\Ce foo\C\[Home] KK: \Cs KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Ce KK: foo\[Return] TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 4\n with len: 3' lyx-log.txt -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Ce KK: foo\[Return]\[Return] TestEnd diff --git a/development/autotests/findadv-09-in.txt b/development/autotests/findadv-09-in.txt index 45e33c6143..828524f755 100644 --- a/development/autotests/findadv-09-in.txt +++ b/development/autotests/findadv-09-in.txt @@ -1,6 +1,6 @@ # Test for searching with regular expressions -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \Apb KK: one\[Return] @@ -9,18 +9,18 @@ KK: three\C\[Home] KK: \Cs KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Apb KK: \Axregexp-mode\[Return][a-z]* \[Return] TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 0\n with len: 3' lyx-log.txt -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Apb KK: \Axregexp-mode\[Return][a-z]* \[Return]\[Return] TestEnd diff --git a/development/autotests/findadv-10-in.txt b/development/autotests/findadv-10-in.txt index 7625248876..c816a51b55 100644 --- a/development/autotests/findadv-10-in.txt +++ b/development/autotests/findadv-10-in.txt @@ -1,24 +1,24 @@ # Test for searching the special LyX and LaTeX words # when ignoring format -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: This is LyX,\[Return] KK: a WYSIWYG LaTeX editor.\C\[Home] KK: \Cs KK: \CF # Uncheck ignore format (depends on IT language) -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: LyX\[Return] TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 8\n with len: 3' lyx-log.txt -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: LaTeX\[Return] TestEnd Lang C diff --git a/development/autotests/findadv-11-in.txt b/development/autotests/findadv-11-in.txt index 389e667b04..e168ad4157 100644 --- a/development/autotests/findadv-11-in.txt +++ b/development/autotests/findadv-11-in.txt @@ -12,12 +12,12 @@ TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 0\n.*idx: 0 par: 0 pos: 0\n.*idx: 1 par: 0 pos: 0\n with len: 1' lyx-log.txt -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \C\[Home] KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Cm KK: v\[Return] TestEnd diff --git a/development/autotests/findadv-14-in.txt b/development/autotests/findadv-14-in.txt index ec6d5edbea..5cafaead7e 100644 --- a/development/autotests/findadv-14-in.txt +++ b/development/autotests/findadv-14-in.txt @@ -1,24 +1,24 @@ # Finding displayed maths with ignore-format on&off (might affect #7596) # -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \Axmath-display\[Return] KK: x^2 +x^2\C\[Home] KK: \Cs KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Axmath-display\[Return] KK: x^2\[Return] TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 0\n.*idx: 0 par: 0 pos: 0\n with len: 1' lyx-log.txt -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Axmath-display\[Return] KK: x^2\[Return]\[Return] TestEnd diff --git a/development/autotests/findadv-15-in.txt b/development/autotests/findadv-15-in.txt index de05dd2151..9508aec4c2 100644 --- a/development/autotests/findadv-15-in.txt +++ b/development/autotests/findadv-15-in.txt @@ -1,24 +1,24 @@ # Finding numbered maths with ignore-format on&off (might affect #7596) # -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CM\Axmath-number-toggle\[Return] KK: x^2 +x^2\C\[Home] KK: \Cs KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \CM\Axmath-number-toggle\[Return] KK: x^2\[Return] TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 0\n.*idx: 0 par: 0 pos: 0\n with len: 1' lyx-log.txt -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \CM\Axmath-number-toggle\[Return] KK: x^2\[Return]\[Return] TestEnd diff --git a/development/autotests/findadv-16-in.txt b/development/autotests/findadv-16-in.txt index d66aba8a52..c412f85078 100644 --- a/development/autotests/findadv-16-in.txt +++ b/development/autotests/findadv-16-in.txt @@ -1,25 +1,25 @@ # Verify matches in *-environments with ignore-format off # (gather environment comes in the *-form after mutate) # -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CM\Axmath-mutate gather\[Return] KK: x^2 +x^2\C\[Home] KK: \Cs KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \CM\Axmath-mutate gather\[Return] KK: x^2\[Return] TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 0\n.*idx: 0 par: 0 pos: 0\n with len: 1' lyx-log.txt -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \CM\Axmath-mutate gather\[Return] KK: x^2\[Return]\[Return] TestEnd diff --git a/development/autotests/findadv-17-in.txt b/development/autotests/findadv-17-in.txt index 415a71b41d..a79fef42a1 100644 --- a/development/autotests/findadv-17-in.txt +++ b/development/autotests/findadv-17-in.txt @@ -10,11 +10,11 @@ TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 0\n.*idx: 0 par: 0 pos: 1\n with len: 2' lyx-log.txt -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Cm\\beta\\alpha \[Return] TestEnd Lang C diff --git a/development/autotests/findadv-re-01-in.txt b/development/autotests/findadv-re-01-in.txt index f01ad5614e..502bd3272a 100644 --- a/development/autotests/findadv-re-01-in.txt +++ b/development/autotests/findadv-re-01-in.txt @@ -10,11 +10,11 @@ TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 1\n with len: 1' lyx-log.txt # -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Axregexp-mode\[Return]\\(\[Return] TestEnd Lang C @@ -30,11 +30,11 @@ TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 3\n with len: 1' lyx-log.txt # -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Axregexp-mode\[Return]\\[\[Return] TestEnd Lang C diff --git a/development/autotests/findadv-re-02-in.txt b/development/autotests/findadv-re-02-in.txt index ae80bf69ae..f5f0382826 100644 --- a/development/autotests/findadv-re-02-in.txt +++ b/development/autotests/findadv-re-02-in.txt @@ -10,11 +10,11 @@ TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 0\n with len: 1' lyx-log.txt # -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Axregexp-mode\[Return]\\\\\[Return] TestEnd Lang C @@ -30,11 +30,11 @@ TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 7\n with len: 1' lyx-log.txt # -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Axregexp-mode\[Return]%\[Return] TestEnd Lang C @@ -50,11 +50,11 @@ TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 8\n with len: 1' lyx-log.txt # -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Axregexp-mode\[Return]\\^\[Return] TestEnd Lang C diff --git a/development/autotests/findadv-re-03-in.txt b/development/autotests/findadv-re-03-in.txt index 3f3f3f1bc1..406b7bf096 100644 --- a/development/autotests/findadv-re-03-in.txt +++ b/development/autotests/findadv-re-03-in.txt @@ -10,11 +10,11 @@ TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 5\n with len: 1' lyx-log.txt # -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Axregexp-mode\[Return]\\{\[Return] TestEnd Lang C @@ -30,11 +30,11 @@ TestEnd Lang C Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 6\n with len: 1' lyx-log.txt # -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \CF # Uncheck ignore format -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Axregexp-mode\[Return]\\}\[Return] TestEnd Lang C diff --git a/development/autotests/findadv-re-04-in.txt b/development/autotests/findadv-re-04-in.txt index d092a535ff..140cba9760 100644 --- a/development/autotests/findadv-re-04-in.txt +++ b/development/autotests/findadv-re-04-in.txt @@ -1,12 +1,12 @@ # Finding styles with regexp -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: Hello \CeHello\C\[Home] KK: \Cs KK: \CF # Uncheck ignore format (depends on IT language) -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Ce\Axregexp-mode\[Return].*\[Return] TestEnd Lang C diff --git a/development/autotests/findadv-re-06-in.txt b/development/autotests/findadv-re-06-in.txt index 296c2a5950..5759d106b3 100644 --- a/development/autotests/findadv-re-06-in.txt +++ b/development/autotests/findadv-re-06-in.txt @@ -1,11 +1,11 @@ # Finding regexps within \frac{} -Lang it_IT.utf8 +Lang sk_SK.utf8 TestBegin test.lyx -dbg find > lyx-log.txt 2>&1 KK: \Cm\\frac 1-x\[Down]1+x^2 \C\[Home] KK: \CF # Uncheck ignore format (depends on IT language) -KK: \Az\Ag\Ae +KK: \At\Ai\Ah KK: \Cm\\frac \Axregexp-mode\[Return].* \[Down]1+x^2 \[Return] TestEnd Lang C diff --git a/development/autotests/hello-world-in.txt b/development/autotests/hello-world-in.txt index 49aa1db0b6..b23daabbf4 100644 --- a/development/autotests/hello-world-in.txt +++ b/development/autotests/hello-world-in.txt @@ -55,9 +55,8 @@ # LaTeX, and verifies that the typed characters are indeed present in the # exported document. # -TestBegin test.lyx > lyx-log.txt 2>&1 +TestBegin test.lyx -dbg key > lyx-log.txt 2>&1 KK: Hello World KK: \Cs -KK: \Ax -KK: buffer-export latex\[Return] +KK: \Axbuffer-export latex\[Return] TestEnd grep "Hello World" test.tex diff --git a/development/autotests/keytest.py b/development/autotests/keytest.py index 7cae6843e5..27b6d484b7 100755 --- a/development/autotests/keytest.py +++ b/development/autotests/keytest.py @@ -209,20 +209,23 @@ def sendKeystring(keystr, LYX_PID): 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) + xvpar = [xvkbd_exe] + if qt_frontend == 'QT5': + xvpar.extend(["-no-jump-pointer"]) else: - subprocess.call([xvkbd_exe, "-no_root", "-wait_idle", lyx_pid, - "-xsendevent", "-window", lyx_window_name, - "-delay", actual_delay, "-text", keystr], stdout = FNULL, stderr = FNULL) + xvpar.extend(["-xsendevent"]) + if xvkbd_hacked: + xvpar.extend(["-wait_idle", lyx_pid]) + xvpar.extend(["-window", lyx_window_name, "-delay", actual_delay, "-text", keystr]) + + subprocess.call(xvpar, stdout = FNULL, stderr = FNULL) def system_retry(num_retry, cmd): i = 0 rtn = intr_system(cmd) while ( ( i < num_retry ) and ( rtn != 0) ): i = i + 1 - rtn = intr_system(cmd) + rtn = intr_system(cmd) time.sleep(1) if ( rtn != 0 ): print "Command Failed: "+cmd @@ -271,6 +274,9 @@ if xvkbd_exe is None: xvkbd_exe = "xvkbd" xvkbd_hacked = os.environ.get('XVKBD_HACKED') != None +qt_frontend = os.environ.get('QT_FRONTEND') +if qt_frontend is None: + qt_frontend = 'QT4' locale_dir = os.environ.get('LOCALE_DIR') if locale_dir is None: diff --git a/development/autotests/single-test.cmake b/development/autotests/single-test.cmake index f76bb214d5..34a3e96c35 100755 --- a/development/autotests/single-test.cmake +++ b/development/autotests/single-test.cmake @@ -23,6 +23,7 @@ # -DLOCALE_DIR=xxx \ # -DPO_BUILD_DIR=xxx \ # -DPACKAGE=xxx \ +# -DFRONTEND=Qt? \ # -P ${AUTOTEST_ROOT}/single-test.cmake set(KEYTEST "${AUTOTEST_ROOT}/keytest.py") @@ -74,6 +75,7 @@ if(use_hacked) else() set(XVKBD_EXE "/usr/bin/xvkbd") endif() +set(ENV{QT_FRONTEND} ${FRONTEND}) if(EXISTS "${LYX_TESTS_USERDIR}/session") execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f "${LYX_TESTS_USERDIR}/session") -- 2.39.2