keytests: Speed up some tests

The idea is, that strings going to the lyx-command-field
can be sent at full speed.
This commit is contained in:
Kornel Benko 2017-04-25 17:34:56 +02:00
parent fb8148b8c4
commit 515ca69359
12 changed files with 51 additions and 33 deletions

View File

@ -2,9 +2,7 @@
#
Lang en_US.utf8
TestBegin ../bug-7673.lyx > lyx-log.txt 2>&1
KK: \Ax
# 'outline-in' was needed to reproduce the crash on some commits when bisecting
KD: 1
KK: command-sequence repeat 3 char-forward; outline-in; down; down\[Return]
KK: \Axcommand-sequence repeat 3 char-forward; outline-in; down; down\[Return]
TestEnd
Assert ! pcregrep -M 'SIGSEGV' lyx-log.txt

View File

@ -2,7 +2,5 @@
#
Lang en_US.utf8
TestBegin > lyx-log.txt 2>&1
KK: \Ax
KD: 1
KK: command-sequence buffer-new; layout Itemize; self-insert a; paragraph-break; depth-increment; self-insert b; up; char-delete-backward; down\[Return]
KK: \Axcommand-sequence buffer-new; layout Itemize; self-insert a; paragraph-break; depth-increment; self-insert b; up; char-delete-backward; down\[Return]
TestEnd

View File

@ -2,7 +2,5 @@
#
Lang en_US.utf8
TestBegin ../bug-8370.lyx > lyx-log.txt 2>&1
KK: \Ax
KD: 1
KK: command-sequence change-next; change-reject; change-next\[Return]
KK: \Axcommand-sequence change-next; change-reject; change-next\[Return]
TestEnd

View File

@ -3,9 +3,7 @@
Lang en_US.utf8
TestBegin > lyx-log.txt 2>&1
KK: \Ax
KK: lyxrc-apply \\spellchecker enchant\[Return]
KK: \Ax
KK: lyxrc-apply \\spellchecker enchant\[Return]
KK: \Axlyxrc-apply \\spellchecker enchant\[Return]
KK: \Axlyxrc-apply \\spellchecker enchant\[Return]
TestEnd
Assert ! pcregrep -M 'SIGSEGV' lyx-log.txt

View File

@ -1,12 +1,8 @@
Lang en_US.utf8
TestBegin ../bug-8684.lyx > lyx-log1.txt 2>&1
KK: \Ax
KD: 1
KK: command-sequence change-next; change-reject; change-next\[Return]
KK: \Axcommand-sequence change-next; change-reject; change-next\[Return]
TestEnd
TestBegin ../bug-8684.lyx > lyx-log2.txt 2>&1
KK: \Ax
KD: 1
KK: command-sequence char-forward; change-next\[Return]
KK: \Axcommand-sequence char-forward; change-next\[Return]
TestEnd

View File

@ -8,7 +8,6 @@ KK: \CF
KK: a\[Tab]
KK: aba\[Return]\[Return]\[Return]
KK: \Cs
KK: \Ax
KK: buffer-export latex\[Return]
KK: \Axbuffer-export latex\[Return]
Lang C
TestEnd grep "^abaabaa$" test.tex

View File

@ -7,11 +7,9 @@ KK: x^(a) +\\frac 1+x^(a) \[Down]1-x^(a) \C\[Home]
KK: \CF
KK: \Cmx^(a) \[Tab]
KK: \Cmx_a
KD: 500
KK: \[Return]\[Return]\[Return]
KD: 60
KK: \Cs
KK: \Ax
KK: buffer-export latex\[Return]
KK: \Axbuffer-export latex\[Return]
Lang C
TestEnd grep '^\$x_{a}+\\frac{1+x_{a}}{1-x\^{(a)}}\$' test.tex

View File

@ -12,7 +12,6 @@ KK: x^2\[Tab]
KK: \Cm
KK: x^2n\[Return]\[Return]
KK: \Cs
KK: \Ax
KK: buffer-export latex\[Return]
KK: \Axbuffer-export latex\[Return]
Lang C
TestEnd grep '^\$x\^{2n}\$$' test.tex

View File

@ -9,8 +9,7 @@ KK: \CF
KK: a\[Tab]
KK: \Cm\\frac 1\[Down]a\[Return]\[Return]\[Return]
KK: \Cs
KK: \Ax
KK: buffer-export latex\[Return]
KK: \Axbuffer-export latex\[Return]
TestEnd
Lang C
Assert pcregrep -M '^\$\\frac\{1\}\{a\}\$ \$\\frac\{1\}\{a\}\$ a' test.tex
@ -22,8 +21,7 @@ KK: \CF
KK: a\[Tab]
KK: \Cm\\frac 1\[Down]a\[Return]\[Return]\[Return]
KK: \Cs
KK: \Ax
KK: buffer-export latex\[Return]
KK: \Axbuffer-export latex\[Return]
TestEnd
Lang C
Assert pcregrep -M '^\$\\frac\{1\}\{a\}\$ \$\\frac\{1\}\{a\}\$ \$a\$' test2.tex

View File

@ -3,7 +3,8 @@
Lang sk_SK.utf8
TestBegin test.lyx -dbg find > lyx-log.txt 2>&1
KK: This should be a LaTeX logo: \Axspecialchar-insert lyx\[Return]\[Return]
KK: This should be a LaTeX logo:
KK: \Axspecialchar-insert lyx\[Return]\[Return]
KK: for a WYSIWYG LaTeX editor.\C\[Home]
KK: \Cs
KK: \CF

View File

@ -7,7 +7,8 @@ KK: \Cs
KK: \CF
# Uncheck ignore format (depends on IT language)
KK: \At\Ai\Ah
KK: \Ce\Axregexp-mode\[Return].*\[Return]
KK: \Ce
KK: \Axregexp-mode\[Return].*\[Return]
TestEnd
Lang C
Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 6\n with len: 5' lyx-log.txt

View File

@ -204,7 +204,7 @@ def lyx_dead():
status = lyx_status(lyx_pid)
return (status == "dead") or (status == "zombie")
def sendKeystring(keystr, LYX_PID):
def sendKeystringLocal(keystr, LYX_PID):
# print "sending keystring "+keystr+"\n"
@ -243,8 +243,42 @@ def sendKeystring(keystr, LYX_PID):
xvpar.extend(["-wait_idle", lyx_pid])
xvpar.extend(["-window", lyx_window_name, "-delay", actual_delay, "-text", keystr])
print("Sending \"" + keystr + "\"\n")
subprocess.call(xvpar, stdout = FNULL, stderr = FNULL)
Axreg = re.compile(r'^(.*)\\Ax([^\\]+)(.*)$')
returnreg = re.compile(r'\\\[Return\](.*)$')
def sendKeystring(line, LYX_PID):
global key_delay
saved_delay = key_delay
while True:
m = Axreg.match(line)
if m:
prefix = m.group(1)
if prefix != "":
sendKeystringLocal(prefix, LYX_PID)
content = m.group(2)
rest = m.group(3);
m2 = returnreg.match(rest)
sendKeystringLocal('\Ax', LYX_PID)
time.sleep(0.1)
if m2:
line = m2.group(1)
key_delay = "1"
sendKeystringLocal(content + '\[Return]', LYX_PID)
key_delay = saved_delay
else:
if content != "":
sendKeystringLocal(content, LYX_PID)
key_delay = saved_delay
return
else:
if line != "":
sendKeystringLocal(line, LYX_PID)
key_delay = saved_delay
return
def system_retry(num_retry, cmd):
i = 0
rtn = intr_system(cmd)