Update of /cvsroot/pymerase/smw/smw/mathedit/unittests
In directory sc8-pr-cvs1:/tmp/cvs-serv32238/smw/mathedit/unittests
Added Files:
CheckCorrectPyQt.py CmdList_testDocument.py
Edit_testDocument.py Edit_testEditor.py
Formula_testDocument.py Formula_testEditor.py
Formula_testParser.py Formula_testScanner.py Makefile
Outline1_testDocument.py Outline2_testEditor.py Test.py
Text_testDocument.py Text_testEditor.py __init__.py
testMTextEdit.py
Log Message:
Imported version of SMW downloaded on 2003 Apr 14
--- NEW FILE: CheckCorrectPyQt.py ---
from qt import *
from smw.mathedit.medit.Text_Document import *
doc = Text_Document()
doc.insertText(0,0,"Test")
t = doc.getText()
print "The text is \"", t, "\""
assert unicode(t) == u"Test"
--- NEW FILE: CmdList_testDocument.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Edit_testDocument.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Edit_testEditor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_testDocument.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_testEditor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_testParser.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Formula_testScanner.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Makefile ---
clean:
rm -f *.pyc *.pyo *.log
--- NEW FILE: Outline1_testDocument.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Outline2_testEditor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Test.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_testDocument.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: Text_testEditor.py ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: __init__.py ---
--- NEW FILE: testMTextEdit.py ---
from smw.mathedit.medit.MTextEdit import MTextEdit
import unittest
from qt import *
class testMTextEdit( unittest.TestCase ):
def setUp( self ):
self.app = QApplication([])
self.e = MTextEdit()
self.app.setMainWidget(self.e)
self.e.show()
self.app.processEvents()
def tearDown( self ):
self.app.processEvents()
del self.e
del self.app
def testSetText( self ):
self.e.setText(u"This is the\ntext")
self.app.processEvents()
self.assertEquals(unicode((self.e.text())),u"This is the\ntext")
self.e.clear()
self.app.processEvents()
self.assertEquals(unicode((self.e.text())),u"")
def testAppend( self ):
self.e.append(u"ddd")
self.app.processEvents()
self.assertEquals(unicode(self.e.text()),u"ddd")
self.app.processEvents()
self.e.setCursorPosition(0,0)
self.app.processEvents()
self.e.append(u"\nddd");
self.app.processEvents()
self.assertEquals(unicode(self.e.text()),u"ddd\nddd")
def testInsertParagraph( self ):
self.e.insertParagraph("test",0)
self.app.processEvents()
self.assertEquals(unicode(self.e.text()),u"test\n")
self.app.processEvents()
self.e.insertParagraph("firstline",0)
self.app.processEvents()
self.assertEquals(unicode(self.e.text()),u"firstline\ntest\n")
self.app.processEvents()
self.e.insertParagraph("lastline",-1)
self.app.processEvents()
self.assertEquals(unicode(self.e.text()),
u"firstline\ntest\n\nlastline")
def testSelect( self ):
self.app.processEvents()
self.e.insertAt(u"ABCDEF",0,0)
self.app.processEvents()
self.e.setSelection(0,1,0,5)
self.app.processEvents()
self.assertEquals(self.e.getSelection(),(0,1,0,5))
self.assertEquals(unicode(self.e.selectedText()),u"BCDE")
self.e.removeSelection()
self.app.processEvents()
self.assertEquals(self.e.getSelection(),(-1,-1,-1,-1))
self.assertEquals(unicode(self.e.selectedText()),u"")
def testCutCopyPaste( self ):
self.app.processEvents()
self.e.insertAt(u"ABCDEF",0,0)
self.app.processEvents()
self.e.setSelection(0,0,0,3)
self.app.processEvents()
self.e.copy()
self.app.processEvents()
self.e.removeSelection()
self.e.setCursorPosition(0,6)
self.app.processEvents()
self.e.paste()
self.app.processEvents()
self.assertEquals(unicode((self.e.text())),u"ABCDEFABC")
self.e.setSelection(0,0,0,9)
self.app.processEvents()
self.e.cut()
self.app.processEvents()
self.assertEquals(unicode((self.e.text())),u"")
def testUndoRedo( self ):
for i in range(10):
self.e.insertAt("x"*i+"\n",i,0)
self.app.processEvents()
for i in range(10):
self.e.undo()
self.app.processEvents()
self.assertEquals(unicode((self.e.text())),u"")
for i in range(10):
self.e.redo()
self.app.processEvents()
self.assertEquals(unicode((self.e.text())),unicode("".join([u"x"*i+"\n" for i in range(10)])))
def suite():
return unittest.makeSuite(testMTextEdit,'test')
if __name__=='__main__':
unittest.main()
|