annotate python/thex.py @ 201:d5debbfc0200

Added all 27 core instructions of msp430
author Windel Bouwman
date Thu, 13 Jun 2013 00:07:28 +0200
parents 65dda7e7e8bd
children ca1ea402f6a1
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
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
8 class HexTest(unittest.TestCase):
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
9 def setUp(self):
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
10 self.app = QApplication(sys.argv)
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
11 self.ui = hexedit.HexEditor()
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
12 self.bv = self.ui.he.bv
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
13 # Provide some random data:
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
14 self.bv.Data = bytearray(range(10)) * 8 + b'x'
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
15 def testOpenButton(self):
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
16 QTest.mouseClick(self.bv, Qt.LeftButton)
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
17 self.assertEqual(self.bv.CursorPosition, 161)
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
18 QTest.keyClick(self.bv, Qt.Key_Left)
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
19 self.assertEqual(self.bv.CursorPosition, 160)
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
20 QTest.keyClick(self.bv, Qt.Key_Up)
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
21 self.assertEqual(self.bv.CursorPosition, 128)
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
22
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
23 if __name__ == '__main__':
5334b86ac1db Added pyqt unittest
Windel Bouwman
parents:
diff changeset
24 unittest.main()