annotate test/testhexedit.py @ 409:8fe299cd2d55 devel

Close devel branch
author Windel Bouwman
date Sat, 21 Feb 2015 12:20:10 +0100
parents 11c5a8a70c02
children 62803b073d11
rev   line source
343
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
1 import sys
189
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
2 import unittest
343
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
3
189
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
4 import hexedit
343
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
5 #import ide
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
6
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
7 from PyQt5.QtWidgets import QApplication
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
8 from PyQt5.QtTest import QTest
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
9 from PyQt5.QtCore import Qt
189
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
10
287
1c7c1e619be8 File movage
Windel Bouwman
parents: 203
diff changeset
11
343
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
12 class HexEditorTest(unittest.TestCase):
189
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
13 def setUp(self):
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
14 self.app = QApplication(sys.argv)
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
15 self.ui = hexedit.HexEditor()
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
16 self.bv = self.ui.he.bv
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
17 # Provide some random data:
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
18 self.bv.Data = bytearray(range(10)) * 8 + b'x'
287
1c7c1e619be8 File movage
Windel Bouwman
parents: 203
diff changeset
19
203
ca1ea402f6a1 Added some arm instructions
Windel Bouwman
parents: 190
diff changeset
20 def tearDown(self):
ca1ea402f6a1 Added some arm instructions
Windel Bouwman
parents: 190
diff changeset
21 self.app.processEvents()
ca1ea402f6a1 Added some arm instructions
Windel Bouwman
parents: 190
diff changeset
22 self.app.quit()
287
1c7c1e619be8 File movage
Windel Bouwman
parents: 203
diff changeset
23
343
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
24 def tstOpenFile(self):
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
25 pass
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
26 #self.ui.actionOpen.trigger()
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
27 #w = self.app.activeWindow()
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
28 #print(w)
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
29 #QTest.keyClick(self.ui, Qt.Key_Escape)
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
30
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
31 def tstDataInView(self):
287
1c7c1e619be8 File movage
Windel Bouwman
parents: 203
diff changeset
32 self.assertEqual(0, self.bv.CursorPosition)
343
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
33 QTest.mouseClick(self.bv, Qt.LeftButton)
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
34 self.assertEqual(154, self.bv.CursorPosition)
189
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
35 QTest.keyClick(self.bv, Qt.Key_Left)
343
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
36 self.assertEqual(153, self.bv.CursorPosition)
189
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
37 QTest.keyClick(self.bv, Qt.Key_Up)
343
11c5a8a70c02 Fix ide
Windel Bouwman
parents: 287
diff changeset
38 self.assertEqual(137, self.bv.CursorPosition)
287
1c7c1e619be8 File movage
Windel Bouwman
parents: 203
diff changeset
39
189
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
40
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
41 if __name__ == '__main__':
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
42 unittest.main()