]> git.lyx.org Git - features.git/commitdiff
keytests: Speed up some tests
authorKornel Benko <kornel@lyx.org>
Tue, 25 Apr 2017 15:34:56 +0000 (17:34 +0200)
committerKornel Benko <kornel@lyx.org>
Tue, 25 Apr 2017 15:37:25 +0000 (17:37 +0200)
The idea is, that strings going to the lyx-command-field
can be sent at full speed.

12 files changed:
development/autotests/bug-7673-in.txt
development/autotests/bug-7673b-in.txt
development/autotests/bug-8370-in.txt
development/autotests/bug-8540-in.txt
development/autotests/bug-8684-in.txt
development/autotests/findadv-01-in.txt
development/autotests/findadv-02-in.txt
development/autotests/findadv-04-in.txt
development/autotests/findadv-20-in.txt
development/autotests/findadv-logo-in.txt
development/autotests/findadv-re-04-in.txt
development/autotests/keytest.py

index dad630b1f6349a22e07da55bf58bf1b55ea89c51..e5c657168450260ea94a7efc3eb1072c87f6a32a 100644 (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
index 7dae139f0341cf03aec7f78b126f59f27658f445..05c1291a1d58f3e341a456dbf638c6bb0cf107a3 100644 (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
index 78e554a2ed352599c250b719610cea4add36d564..808d27da131782d8ea930c4deedebf560faba274 100644 (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
index f5c1a214a74e18d25115bbd5454b0fac0f12682b..43cbbfe13bdf31af3cec19fc3f17737af782403e 100644 (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
index c6b5224ba4c3ee5f068d739c3d41385af9f95803..56421928f92e79efdba82cfa2741ee07f1f2a852 100644 (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
index 69f5b2d74a0ec1b191af9ace0ce81b334e7e3b89..90a010af530e852b6e111b3e67537e4c76eff0c8 100644 (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
index 5ac3ebff13c4c9765aef2ab900ed14549e3b9a3b..7fb840e62a230496bf81d925aacad9992e091512 100644 (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
index 0aa2b42586755bd32422a9db0c744aee22fe66ad..c294d97808b196509cbd155b8fedbbcac1d0ac5b 100644 (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
index 8f0e00aad256155298aa47b05178cd8e85511b1f..304985a54cce88addb9a368e65f8e0df09cb95fc 100644 (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
index 7b40eed41e559d6a407c5a030d840df5cd77d6e6..cb2889e169f23fd1f4d88467839a85985865bda5 100644 (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
index 140cba97606e5d19ffd21e39fde8357a4afe062c..88d6d809c5d6f249599899e38306d81a73116843 100644 (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
index 9716684708f762bc6a50f64caf810a9d31e0c6e4..d2e1a6e3b62679ad816efd003501ecf3403351b5 100755 (executable)
@@ -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)