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
|
|
8 class HexTest(unittest.TestCase):
|
|
9 def setUp(self):
|
|
10 self.app = QApplication(sys.argv)
|
|
11 self.ui = hexedit.HexEditor()
|
|
12 self.bv = self.ui.he.bv
|
|
13 # Provide some random data:
|
|
14 self.bv.Data = bytearray(range(10)) * 8 + b'x'
|
|
15 def testOpenButton(self):
|
|
16 QTest.mouseClick(self.bv, Qt.LeftButton)
|
|
17 self.assertEqual(self.bv.CursorPosition, 161)
|
|
18 QTest.keyClick(self.bv, Qt.Key_Left)
|
|
19 self.assertEqual(self.bv.CursorPosition, 160)
|
|
20 QTest.keyClick(self.bv, Qt.Key_Up)
|
|
21 self.assertEqual(self.bv.CursorPosition, 128)
|
|
22
|
|
23 if __name__ == '__main__':
|
|
24 unittest.main()
|