view test/testhexedit.py @ 343:11c5a8a70c02 devel

Fix ide
author Windel Bouwman
date Sat, 01 Mar 2014 16:27:52 +0100
parents test/gui/testhexedit.py@1c7c1e619be8
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()