aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2020-11-19 08:22:59 +1100
committerNeil <nyamatongwe@gmail.com>2020-11-19 08:22:59 +1100
commitcbb67b91304fe39f98000649a2c7f3b03a6f34fe (patch)
tree418a29f0eba477b3799e50b640fffc91c16f1c8b
parente2323ba258caf64adda9990906a434e4d4a8362c (diff)
downloadscintilla-mirror-cbb67b91304fe39f98000649a2c7f3b03a6f34fe.tar.gz
On Linux/Qt, try to load Lexilla for tests that need a lexer but skip the tests
when Lexilla not found.
-rw-r--r--test/XiteQt.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/XiteQt.py b/test/XiteQt.py
index b5900a308..5f14277c3 100644
--- a/test/XiteQt.py
+++ b/test/XiteQt.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# Requires Python 2.7 or later
-import ctypes, os, sys, unittest
+import ctypes, os, platform, sys, unittest
from PySide.QtCore import *
from PySide.QtGui import *
@@ -22,6 +22,19 @@ scintillaIncludesLexers = False
# Lexilla may optionally be tested it is built and can be loaded
lexillaAvailable = False
+lexillaBinDirectory = os.path.join(scintillaDirectory, "..", "lexilla", "bin")
+lexName = "liblexilla.so"
+try:
+ lexillaSOPath = os.path.join(lexillaBinDirectory, lexName)
+ lexillaLibrary = ctypes.cdll.LoadLibrary(lexillaSOPath)
+ createLexer = lexillaLibrary.CreateLexer
+ createLexer.restype = ctypes.c_void_p
+ lexillaAvailable = True
+ print("Found Lexilla")
+except OSError:
+ print("Can't find " + lexName)
+ print("Python is built for " + " ".join(platform.architecture()))
+
class Form(QDialog):
def __init__(self, parent=None):
@@ -60,6 +73,15 @@ class XiteWin():
print(results)
sys.exit(0)
+ def ChooseLexer(self, lexer):
+ if scintillaIncludesLexers:
+ self.ed.LexerLanguage = lexer
+ elif lexillaAvailable:
+ pLexilla = createLexer(lexer)
+ self.ed.SetILexer(0, pLexilla)
+ else: # No lexers available
+ pass
+
xiteFrame = None
def main(test):