Exemplo n.º 1
0
        insert = (string.digits + "\n").encode('utf-8')
        self.ed.AddText(len(data), data)
        start = time.time()
        for i in range(1000):
            self.ed.InsertText(0, insert)
        end = time.time()
        duration = end - start
        print("%6.3f testHugeInserts" % duration)
        self.xite.DoEvents()
        self.assert_(self.ed.Length > 0)

    def testHugeReplace(self):
        oneLine = (string.ascii_letters + string.digits + "\n").encode('utf-8')
        data = oneLine * 100000
        insert = (string.digits + "\n").encode('utf-8')
        self.ed.AddText(len(data), data)
        start = time.time()
        for i in range(1000):
            self.ed.TargetStart = i * len(insert)
            self.ed.TargetEnd = self.ed.TargetStart + len(oneLine)
            self.ed.ReplaceTarget(len(insert), insert)
        end = time.time()
        duration = end - start
        print("%6.3f testHugeReplace" % duration)
        self.xite.DoEvents()
        self.assert_(self.ed.Length > 0)


if __name__ == '__main__':
    XiteWin.main("performanceTests")
Exemplo n.º 2
0
			[b"class def else for if import in print return while"])

	def testHTML(self):
		self.LexExample("x.html", b"hypertext", keywordsHTML)

	def testASP(self):
		self.LexExample("x.asp", b"hypertext", keywordsHTML)

	def testPHP(self):
		self.LexExample("x.php", b"hypertext", keywordsHTML)

	def testVB(self):
		self.LexExample("x.vb", b"vb", [b"as dim or string"])

	def testLua(self):
		self.LexExample("x.lua", b"lua", [b"function end"])

	def testRuby(self):
		self.LexExample("x.rb", b"ruby", [b"class def end"])

	def testPerl(self):
		self.LexExample("x.pl", b"perl", [b"printf sleep use while"])

	def testD(self):
		self.LexExample("x.d", b"d",
			[b"keyword1", b"keyword2", b"", b"keyword4", b"keyword5",
			b"keyword6", b"keyword7"])

if __name__ == '__main__':
	XiteWin.main("lexTests")
Exemplo n.º 3
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Requires Python 3.6 or later

import XiteWin

if __name__ == "__main__":
	XiteWin.main("")
Exemplo n.º 4
0
		self.assertEquals(self.ed.GetStatus(), 0)
		self.SetText(b"ab")
		data = ctypes.create_unicode_buffer(100)
		lenData = self.GetText(2, data)
		self.assertEquals(self.ed.GetStatus(), 0)
		self.assertEquals(lenData, 1)
		self.assertEquals(data.value, "a")

	def testGetTextJustNUL(self):
		self.assertEquals(self.ed.GetStatus(), 0)
		self.SetText(b"ab")
		data = ctypes.create_unicode_buffer(100)
		lenData = self.GetText(1, data)
		self.assertEquals(self.ed.GetStatus(), 0)
		#~ print(data)
		self.assertEquals(lenData, 0)
		self.assertEquals(data.value, "")

	def testGetTextZeroLength(self):
		self.assertEquals(self.ed.GetStatus(), 0)
		self.SetText(b"ab")
		data = ctypes.create_unicode_buffer(100)
		lenData = self.GetText(0, data)
		self.assertEquals(self.ed.GetStatus(), 0)
		#~ print(data)
		self.assertEquals(lenData, 0)
		self.assertEquals(data.value, "")

if __name__ == '__main__':
	uu = Xite.main("win32Tests")
Exemplo n.º 5
0
		self.ed.SetSel(0, 0)

		self.ed.AutoCShow(0, b"za defn ghi")
		self.ed.AutoCComplete()
		self.assertEquals(self.ed.Contents(), b"zaxxx\n")

		self.assertEquals(self.ed.AutoCActive(), 0)

	def testAutoShowSelect(self):
		self.assertEquals(self.ed.AutoCActive(), 0)
		self.ed.SetSel(0, 0)

		self.ed.AutoCShow(0, b"za defn ghi")
		self.ed.AutoCSelect(0, b"d")
		self.ed.AutoCComplete()
		self.assertEquals(self.ed.Contents(), b"defnxxx\n")

		self.assertEquals(self.ed.AutoCActive(), 0)


#~ import os
#~ for x in os.getenv("PATH").split(";"):
	#~ n = "scilexer.dll"
	#~ nf = x + "\\" + n
	#~ print os.access(nf, os.R_OK), nf
if __name__ == '__main__':
	uu = XiteWin.main("simpleTests")
	#~ for x in sorted(uu.keys()):
		#~ print(x, uu[x])
	#~ print()
Exemplo n.º 6
0
		self.ed.SetSel(0, 0)

		self.ed.AutoCShow(0, b"za defn ghi")
		self.ed.AutoCComplete()
		self.assertEquals(self.ed.Contents(), b"zaxxx\n")

		self.assertEquals(self.ed.AutoCActive(), 0)

	def testAutoShowSelect(self):
		self.assertEquals(self.ed.AutoCActive(), 0)
		self.ed.SetSel(0, 0)

		self.ed.AutoCShow(0, b"za defn ghi")
		self.ed.AutoCSelect(0, b"d")
		self.ed.AutoCComplete()
		self.assertEquals(self.ed.Contents(), b"defnxxx\n")

		self.assertEquals(self.ed.AutoCActive(), 0)


#~ import os
#~ for x in os.getenv("PATH").split(";"):
	#~ n = "scilexer.dll"
	#~ nf = x + "\\" + n
	#~ print os.access(nf, os.R_OK), nf
if __name__ == '__main__':
	uu = XiteWin.main("simpleTests")
	#~ for x in sorted(uu.keys()):
		#~ print(x, uu[x])
	#~ print()
Exemplo n.º 7
0
            self.ed.SearchFlags = self.ed.SCFIND_MATCHCASE
            pos = self.ed.SearchInTarget(len(searchString), searchString)
            self.assert_(pos > 0)
        end = timer()
        duration = end - start
        print("%6.3f testUTF8CaseSearches" % duration)
        self.xite.DoEvents()

    def testUTF8Searches(self):
        self.ed.SetCodePage(65001)
        oneLine = "Fold Margin=折りたたみ表示用の余白(&F)\n".encode('utf-8')
        manyLines = oneLine * 100000
        manyLines = manyLines + "φ\n".encode('utf-8')
        self.ed.AddText(len(manyLines), manyLines)
        searchString = "φ".encode('utf-8')
        start = timer()
        for i in range(10):
            self.ed.TargetStart = 0
            self.ed.TargetEnd = self.ed.Length - 1
            self.ed.SearchFlags = 0
            pos = self.ed.SearchInTarget(len(searchString), searchString)
            self.assert_(pos > 0)
        end = timer()
        duration = end - start
        print("%6.3f testUTF8Searches" % duration)
        self.xite.DoEvents()


if __name__ == '__main__':
    Xite.main("performanceTests")
Exemplo n.º 8
0
		data = data * 100000
		insert = (string.digits + "\n").encode('utf-8')
		self.ed.AddText(len(data), data)
		start = time.time()
		for i in range(1000):
			self.ed.InsertText(0, insert)
		end = time.time()
		duration = end - start
		print("%6.3f testHugeInserts" % duration)
		self.xite.DoEvents()
		self.assert_(self.ed.Length > 0)

	def testHugeReplace(self):
		oneLine = (string.ascii_letters + string.digits + "\n").encode('utf-8')
		data = oneLine * 100000
		insert = (string.digits + "\n").encode('utf-8')
		self.ed.AddText(len(data), data)
		start = time.time()
		for i in range(1000):
			self.ed.TargetStart = i * len(insert)
			self.ed.TargetEnd = self.ed.TargetStart + len(oneLine)
			self.ed.ReplaceTarget(len(insert), insert)
		end = time.time()
		duration = end - start
		print("%6.3f testHugeReplace" % duration)
		self.xite.DoEvents()
		self.assert_(self.ed.Length > 0)

if __name__ == '__main__':
	XiteWin.main("performanceTests")
Exemplo n.º 9
0
			[b"class def else for if import in print return while"])

	def testHTML(self):
		self.LexExample("x.html", b"hypertext", keywordsHTML)

	def testASP(self):
		self.LexExample("x.asp", b"hypertext", keywordsHTML)

	def testPHP(self):
		self.LexExample("x.php", b"hypertext", keywordsHTML)

	def testVB(self):
		self.LexExample("x.vb", b"vb", [b"as dim or string"])

	def testLua(self):
		self.LexExample("x.lua", b"lua", [b"function end"])

	def testRuby(self):
		self.LexExample("x.rb", b"ruby", [b"class def end"])

	def testPerl(self):
		self.LexExample("x.pl", b"perl", [b"printf sleep use while"])

	def testD(self):
		self.LexExample("x.d", b"d",
			[b"keyword1", b"keyword2", b"", b"keyword4", b"keyword5",
			b"keyword6", b"keyword7"])

if __name__ == '__main__':
	Xite.main("lexTests")
Exemplo n.º 10
0
			self.ed.TargetEnd = self.ed.Length-1
			self.ed.SearchFlags = self.ed.SCFIND_MATCHCASE
			pos = self.ed.SearchInTarget(len(searchString), searchString)
			self.assert_(pos > 0)
		end = time.time()
		duration = end - start
		print("%6.3f testUTF8CaseSearches" % duration)
		self.xite.DoEvents()

	def testUTF8Searches(self):
		self.ed.SetCodePage(65001)
		oneLine = "Fold Margin=折りたたみ表示用の余白(&F)\n".encode('utf-8')
		manyLines = oneLine * 100000
		manyLines = manyLines + "φ\n".encode('utf-8')
		self.ed.AddText(len(manyLines), manyLines)
		searchString = "φ".encode('utf-8')
		start = time.time()
		for i in range(10):
			self.ed.TargetStart = 0
			self.ed.TargetEnd = self.ed.Length-1
			self.ed.SearchFlags = 0
			pos = self.ed.SearchInTarget(len(searchString), searchString)
			self.assert_(pos > 0)
		end = time.time()
		duration = end - start
		print("%6.3f testUTF8Searches" % duration)
		self.xite.DoEvents()

if __name__ == '__main__':
	Xite.main("performanceTests")
Exemplo n.º 11
0
    def testPHP(self):
        self.LexExample("x.php", b"hypertext", keywordsHTML)

    def testVB(self):
        self.LexExample("x.vb", b"vb", [b"as dim or string"])

    def testLua(self):
        self.LexExample("x.lua", b"lua", [b"function end"])

    def testRuby(self):
        self.LexExample("x.rb", b"ruby", [b"class def end"])

    def testPerl(self):
        self.LexExample("x.pl", b"perl", keywordsPerl)

    def testPerl52(self):
        self.LexLongCase("perl-test-5220delta.pl", b"perl", keywordsPerl)

    def testPerlPrototypes(self):
        self.LexLongCase("perl-test-sub-prototypes.pl", b"perl", keywordsPerl)

    def testD(self):
        self.LexExample("x.d", b"d", [
            b"keyword1", b"keyword2", b"", b"keyword4", b"keyword5",
            b"keyword6", b"keyword7"
        ])


if __name__ == '__main__':
    Xite.main("lexTests")
Exemplo n.º 12
0
    def testCXX(self):
        self.LexExample("x.cxx", b"cpp", [b"int"])

    def testPython(self):
        self.LexExample(
            "x.py", b"python",
            [b"class def else for if import in print return while"])

    def testHTML(self):
        self.LexExample("x.html", b"hypertext", keywordsHTML)

    def testASP(self):
        self.LexExample("x.asp", b"hypertext", keywordsHTML)

    def testPHP(self):
        self.LexExample("x.php", b"hypertext", keywordsHTML)

    def testVB(self):
        self.LexExample("x.vb", b"vb", [b"as dim or string"])

    def testD(self):
        self.LexExample("x.d", b"d", [
            b"keyword1", b"keyword2", b"", b"keyword4", b"keyword5",
            b"keyword6", b"keyword7"
        ])


if __name__ == '__main__':
    XiteWin.main("lexTests")
Exemplo n.º 13
0
# -*- coding: utf-8 -*-

import XiteWin

if __name__ == "__main__":
	XiteWin.main("")