annotate test/gui/testhexedit.py @ 305:0615b5308710

Updated docs
author Windel Bouwman
date Fri, 06 Dec 2013 13:50:38 +0100
parents 1c7c1e619be8
children
rev   line source
189
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
1 import unittest
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
2 import hexedit
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
3 from PyQt4.QtGui import QApplication
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
4 from PyQt4.QtTest import QTest
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
5 from PyQt4.QtCore import Qt
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
6 import sys
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
7
287
1c7c1e619be8 File movage
Windel Bouwman
parents: 203
diff changeset
8
189
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
9 class HexTest(unittest.TestCase):
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
10 def setUp(self):
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
11 self.app = QApplication(sys.argv)
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
12 self.ui = hexedit.HexEditor()
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
13 self.bv = self.ui.he.bv
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
14 # Provide some random data:
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
15 self.bv.Data = bytearray(range(10)) * 8 + b'x'
287
1c7c1e619be8 File movage
Windel Bouwman
parents: 203
diff changeset
16
203
ca1ea402f6a1 Added some arm instructions
Windel Bouwman
parents: 190
diff changeset
17 def tearDown(self):
ca1ea402f6a1 Added some arm instructions
Windel Bouwman
parents: 190
diff changeset
18 self.app.processEvents()
ca1ea402f6a1 Added some arm instructions
Windel Bouwman
parents: 190
diff changeset
19 self.app.quit()
287
1c7c1e619be8 File movage
Windel Bouwman
parents: 203
diff changeset
20
189
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
21 def testOpenButton(self):
287
1c7c1e619be8 File movage
Windel Bouwman
parents: 203
diff changeset
22 self.assertEqual(0, self.bv.CursorPosition)
1c7c1e619be8 File movage
Windel Bouwman
parents: 203
diff changeset
23 #QTest.mouseClick(self.bv, Qt.LeftButton)
1c7c1e619be8 File movage
Windel Bouwman
parents: 203
diff changeset
24 self.assertEqual(161, self.bv.CursorPosition)
189
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
25 QTest.keyClick(self.bv, Qt.Key_Left)
287
1c7c1e619be8 File movage
Windel Bouwman
parents: 203
diff changeset
26 self.assertEqual(160, self.bv.CursorPosition)
189
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
27 QTest.keyClick(self.bv, Qt.Key_Up)
287
1c7c1e619be8 File movage
Windel Bouwman
parents: 203
diff changeset
28 self.assertEqual(128, self.bv.CursorPosition)
1c7c1e619be8 File movage
Windel Bouwman
parents: 203
diff changeset
29
189
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
30
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
31 if __name__ == '__main__':
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
32 unittest.main()