343
|
1 import sys
|
189
|
2 import unittest
|
343
|
3
|
189
|
4 import hexedit
|
343
|
5 #import ide
|
|
6
|
|
7 from PyQt5.QtWidgets import QApplication
|
|
8 from PyQt5.QtTest import QTest
|
|
9 from PyQt5.QtCore import Qt
|
189
|
10
|
287
|
11
|
343
|
12 class HexEditorTest(unittest.TestCase):
|
189
|
13 def setUp(self):
|
|
14 self.app = QApplication(sys.argv)
|
|
15 self.ui = hexedit.HexEditor()
|
|
16 self.bv = self.ui.he.bv
|
|
17 # Provide some random data:
|
|
18 self.bv.Data = bytearray(range(10)) * 8 + b'x'
|
287
|
19
|
203
|
20 def tearDown(self):
|
|
21 self.app.processEvents()
|
|
22 self.app.quit()
|
287
|
23
|
343
|
24 def tstOpenFile(self):
|
|
25 pass
|
|
26 #self.ui.actionOpen.trigger()
|
|
27 #w = self.app.activeWindow()
|
|
28 #print(w)
|
|
29 #QTest.keyClick(self.ui, Qt.Key_Escape)
|
|
30
|
|
31 def tstDataInView(self):
|
287
|
32 self.assertEqual(0, self.bv.CursorPosition)
|
343
|
33 QTest.mouseClick(self.bv, Qt.LeftButton)
|
|
34 self.assertEqual(154, self.bv.CursorPosition)
|
189
|
35 QTest.keyClick(self.bv, Qt.Key_Left)
|
343
|
36 self.assertEqual(153, self.bv.CursorPosition)
|
189
|
37 QTest.keyClick(self.bv, Qt.Key_Up)
|
343
|
38 self.assertEqual(137, self.bv.CursorPosition)
|
287
|
39
|
189
|
40
|
|
41 if __name__ == '__main__':
|
|
42 unittest.main()
|