Files
urh/tests/QtTestCase.py
Johannes Pohl fa12774090 add checksum integration
* add draft for crc configure dialog

* add ui file

* improve delegate sizing

* fix open editors function call placement

* consider system font size for optimal editor height

* fix font height on windows only as other OSes are fine with default

* simplify windows height special case

* add draft for crc configure dialog

* add ui file

* add tab widget to properties dialog + remove unneeded underline fonts

* rename type -> field type + add crclabel class

* cast labels to crclabel if field type gets changed

* dynamic tab creation in label dialog depending on special status labels

* integrate CRC widget to dialog

* use model for crc data ranges and enhance editor behaviour

* move default crc polynomials to class level

* make crc polynomial configurable in widget

* fix line edit validator + set crc polynomial on combobox change

* show crc status in label table

* fix unnittest polynomial assignment

* Index error catched, when dragging WSP-encoded data into generator

* show expected CRC in value table

* add action for updating automatically assigned message types

* add draft for crc configure dialog

* add ui file

* add tab widget to properties dialog + remove unneeded underline fonts

* rename type -> field type + add crclabel class

* cast labels to crclabel if field type gets changed

* dynamic tab creation in label dialog depending on special status labels

* integrate CRC widget to dialog

* use model for crc data ranges and enhance editor behaviour

* move default crc polynomials to class level

* make crc polynomial configurable in widget

* fix line edit validator + set crc polynomial on combobox change

* show crc status in label table

* fix unnittest polynomial assignment

* show expected CRC in value table

* add action for updating automatically assigned message types

* centralize bit view methods

* make start value and final xor configurable

* add Checksum Label Type + WSP Checksum subtype

* Ensure Start Value and Final XOR have same length as polynomial

* pad zeros at front

* add crc info label and fix sync between polynomial and xor values

* various fixes

* test wsp hash functionality

* minor fixes

* use array.array for parameters to make crcs comparable

* integrate crc to generation

* add unittest for cc1101

* set wait cursor when extracting archives

* remove unneeded status bar in interpretation

* set wait cursor when extracting archives in project manager

* fix size policy for analysis search line edit

* save checksum labels in project

* improve alignment

* remove double line edit

* add test for checksum integration in generator

* update coverage

* specify coverage format

* generate xml coverage report

* generate coverage report only for python 3.5

* generate coverage report only for python 3.5

* add variable to control coverage

* generate coverage report on success

* generate coverage report after success

* remove deprecated

* add virtualenv opt

* use codecov

* revert to deprecated

* Removed CRC and 'remove_preamble, remove_sync' from CC1101 Data Whitening

* repair unittests

* fix table copy selection

* use plain bits for checksum calculation in generation

* add parent
2017-07-02 20:47:46 +02:00

67 lines
2.1 KiB
Python

import os
import sys
import unittest
import sip
from PyQt5.QtCore import Qt
from PyQt5.QtTest import QTest
from PyQt5.QtWidgets import QApplication
from tests.utils_testing import write_settings, get_path_for_data_file
from urh.controller.MainController import MainController
import faulthandler
faulthandler.enable()
class QtTestCase(unittest.TestCase):
CLOSE_TIMEOUT = 10
WAIT_TIMEOUT_BEFORE_NEW = 10
SHOW = os.path.exists(os.path.join(os.path.dirname(os.path.realpath(__file__)), "show_gui"))
@classmethod
def setUpClass(cls):
write_settings()
cls.app = QApplication(sys.argv)
@classmethod
def tearDownClass(cls):
cls.app.quit()
sip.delete(cls.app)
cls.app = None
def setUp(self):
self.form = MainController()
if self.SHOW:
self.form.show()
def wait_before_new_file(self):
QApplication.instance().processEvents()
QTest.qWait(self.WAIT_TIMEOUT_BEFORE_NEW)
def add_signal_to_form(self, filename: str):
self.wait_before_new_file()
self.form.add_signalfile(get_path_for_data_file(filename))
def add_signal_to_generator(self, signal_index: int):
gframe = self.form.generator_tab_controller
item = gframe.tree_model.rootItem.children[0].children[signal_index]
index = gframe.tree_model.createIndex(signal_index, 0, item)
rect = gframe.ui.treeProtocols.visualRect(index)
QTest.mousePress(gframe.ui.treeProtocols.viewport(), Qt.LeftButton, pos=rect.center())
self.assertEqual(gframe.ui.treeProtocols.selectedIndexes()[0], index)
mimedata = gframe.tree_model.mimeData(gframe.ui.treeProtocols.selectedIndexes())
gframe.table_model.dropMimeData(mimedata, 1, -1, -1, gframe.table_model.createIndex(0, 0))
def tearDown(self):
if hasattr(self, "dialog"):
self.dialog.close()
if hasattr(self, "form"):
self.form.close_all()
if self.SHOW:
self.form.close()
QApplication.instance().processEvents()
QTest.qWait(self.CLOSE_TIMEOUT)