view python/thex.py @ 267:e7c8f7eb3f59

Added tag Working chain 1 for changeset 649884d9dc61
author Windel Bouwman
date Mon, 12 Aug 2013 20:14:47 +0200
parents ca1ea402f6a1
children
line wrap: on
line source

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):
        QTest.mouseClick(self.bv, Qt.LeftButton)
        self.assertEqual(self.bv.CursorPosition, 161)
        QTest.keyClick(self.bv, Qt.Key_Left)
        self.assertEqual(self.bv.CursorPosition, 160)
        QTest.keyClick(self.bv, Qt.Key_Up)
        self.assertEqual(self.bv.CursorPosition, 128)

if __name__ == '__main__':
    unittest.main()