diff test/gui/testhexedit.py @ 287:1c7c1e619be8

File movage
author Windel Bouwman
date Thu, 21 Nov 2013 11:57:27 +0100
parents python/thex.py@ca1ea402f6a1
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gui/testhexedit.py	Thu Nov 21 11:57:27 2013 +0100
@@ -0,0 +1,32 @@
+import unittest
+import hexedit
+from PyQt4.QtGui import QApplication
+from PyQt4.QtTest import QTest
+from PyQt4.QtCore import Qt
+import sys
+
+
+class HexTest(unittest.TestCase):
+    def setUp(self):
+        self.app = QApplication(sys.argv)
+        self.ui = hexedit.HexEditor()
+        self.bv = self.ui.he.bv
+        # Provide some random data:
+        self.bv.Data = bytearray(range(10)) * 8 + b'x'
+
+    def tearDown(self):
+        self.app.processEvents()
+        self.app.quit()
+
+    def testOpenButton(self):
+        self.assertEqual(0, self.bv.CursorPosition)
+        #QTest.mouseClick(self.bv, Qt.LeftButton)
+        self.assertEqual(161, self.bv.CursorPosition)
+        QTest.keyClick(self.bv, Qt.Key_Left)
+        self.assertEqual(160, self.bv.CursorPosition)
+        QTest.keyClick(self.bv, Qt.Key_Up)
+        self.assertEqual(128, self.bv.CursorPosition)
+
+
+if __name__ == '__main__':
+    unittest.main()