189
|
1 import unittest
|
|
2 import hexedit
|
|
3 from PyQt4.QtGui import QApplication
|
|
4 from PyQt4.QtTest import QTest
|
|
5 from PyQt4.QtCore import Qt
|
|
6 import sys
|
|
7
|
287
|
8
|
189
|
9 class HexTest(unittest.TestCase):
|
|
10 def setUp(self):
|
|
11 self.app = QApplication(sys.argv)
|
|
12 self.ui = hexedit.HexEditor()
|
|
13 self.bv = self.ui.he.bv
|
|
14 # Provide some random data:
|
|
15 self.bv.Data = bytearray(range(10)) * 8 + b'x'
|
287
|
16
|
203
|
17 def tearDown(self):
|
|
18 self.app.processEvents()
|
|
19 self.app.quit()
|
287
|
20
|
189
|
21 def testOpenButton(self):
|
287
|
22 self.assertEqual(0, self.bv.CursorPosition)
|
|
23 #QTest.mouseClick(self.bv, Qt.LeftButton)
|
|
24 self.assertEqual(161, self.bv.CursorPosition)
|
189
|
25 QTest.keyClick(self.bv, Qt.Key_Left)
|
287
|
26 self.assertEqual(160, self.bv.CursorPosition)
|
189
|
27 QTest.keyClick(self.bv, Qt.Key_Up)
|
287
|
28 self.assertEqual(128, self.bv.CursorPosition)
|
|
29
|
189
|
30
|
|
31 if __name__ == '__main__':
|
|
32 unittest.main()
|