Files
urh/tests/test_decoding_gui.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

76 lines
3.3 KiB
Python

from PyQt5.QtCore import QPoint
from tests.QtTestCase import QtTestCase
from urh import constants
from urh.controller.DecoderWidgetController import DecoderWidgetController
from urh.signalprocessing.Encoding import Encoding
class TestDecodingGUI(QtTestCase):
def setUp(self):
super().setUp()
self.add_signal_to_form("esaver.complex")
signal = self.form.signal_tab_controller.signal_frames[0].signal
self.dialog = DecoderWidgetController(decodings=self.form.compare_frame_controller.decodings,
signals=[signal], parent=self.form,
project_manager=self.form.project_manager)
if self.SHOW:
self.dialog.show()
def test_edit_decoding(self):
self.dialog.ui.combobox_decodings.setCurrentIndex(1) # NRZI
self.assertEqual(self.dialog.ui.decoderchain.count(), 1) # One Invert
self.dialog.save_to_file()
def test_build_decoding(self):
self.dialog.ui.combobox_decodings.setCurrentIndex(4)
chain = [(constants.DECODING_INVERT,),
(constants.DECODING_ENOCEAN,),
(constants.DECODING_DIFFERENTIAL,),
(constants.DECODING_CARRIER,),
(constants.DECODING_BITORDER,),
(constants.DECODING_EDGE,),
(constants.DECODING_DATAWHITENING,),
(constants.DECODING_REDUNDANCY, "2"),
(constants.DECODING_MORSE, "1;3;1"),
(constants.DECODING_SUBSTITUTION, "0:1;1:0;"),
(constants.DECODING_EXTERNAL, "./;./"),
(constants.DECODING_CUT, "0;1010")]
decoding = Encoding(chain=[c for chain_item in chain for c in chain_item])
self.dialog.decodings[4] = decoding
self.dialog.set_e()
self.assertEqual(len(chain), self.dialog.ui.decoderchain.count())
for i in range(0, self.dialog.ui.decoderchain.count()):
self.dialog.ui.decoderchain.setCurrentRow(i)
self.dialog.set_information(2)
self.assertIn(chain[i][0], self.dialog.ui.info.text())
def test_set_signal(self):
self.dialog.ui.combobox_signals.currentIndexChanged.emit(0)
self.assertEqual(self.dialog.ui.inpt.text(), "10010110")
def test_select_items(self):
for i in range(0, self.dialog.ui.basefunctions.count()):
self.dialog.ui.basefunctions.setCurrentRow(i)
self.assertIn(self.dialog.ui.basefunctions.currentItem().text(), self.dialog.ui.info.text())
for i in range(0, self.dialog.ui.additionalfunctions.count()):
self.dialog.ui.additionalfunctions.setCurrentRow(i)
self.assertIn(self.dialog.ui.additionalfunctions.currentItem().text(), self.dialog.ui.info.text())
def test_context_menu(self):
self.dialog.ui.combobox_decodings.setCurrentIndex(4)
decoding = Encoding(chain=[constants.DECODING_INVERT])
self.dialog.decodings[4] = decoding
self.dialog.set_e()
self.assertEqual(1, self.dialog.ui.decoderchain.count())
self.dialog.ui.decoderchain.context_menu_pos = QPoint(0, 0)
menu = self.dialog.ui.decoderchain.create_context_menu()
menu_actions = [action.text() for action in menu.actions() if action.text()]
self.assertEqual(3, len(menu_actions))