view test/testhexedit.py @ 350:2b02bd286fe9

Fixed A9 hello worle
author Windel Bouwman
date Sat, 08 Mar 2014 16:29:03 +0100
parents 11c5a8a70c02
children 62803b073d11
line wrap: on
line source

import sys
import unittest

import hexedit
#import ide

from PyQt5.QtWidgets import QApplication
from PyQt5.QtTest import QTest
from PyQt5.QtCore import Qt


class HexEditorTest(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 tstOpenFile(self):
        pass
        #self.ui.actionOpen.trigger()
        #w = self.app.activeWindow()
        #print(w)
        #QTest.keyClick(self.ui, Qt.Key_Escape)

    def tstDataInView(self):
        self.assertEqual(0, self.bv.CursorPosition)
        QTest.mouseClick(self.bv, Qt.LeftButton)
        self.assertEqual(154, self.bv.CursorPosition)
        QTest.keyClick(self.bv, Qt.Key_Left)
        self.assertEqual(153, self.bv.CursorPosition)
        QTest.keyClick(self.bv, Qt.Key_Up)
        self.assertEqual(137, self.bv.CursorPosition)


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