Unittest for enocean + avoid repush of ui data

This commit is contained in:
jopohl
2016-08-18 17:02:19 +02:00
parent 0582c1a9f5
commit 64e2831faf
18 changed files with 49 additions and 19 deletions

View File

@@ -34,7 +34,7 @@ def gen():
# Remove Line: # Form implementation generated from reading ui file '/home/joe/GIT/urh/ui/fuzzing.ui'
# to avoid useless git updates when working on another computer
for line in fileinput.input(out_file_path, inplace=True):
if line.startswith("# Form implementation generated from reading ui file"):
if line.startswith("# Form implementation generated from reading ui file") or line.startswith("# Created by: "):
continue
print(line, end='')

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
@@ -372,6 +371,7 @@ class Ui_FAnalysis(object):
self.pageButtonAnalyzer = QtWidgets.QWidget()
self.pageButtonAnalyzer.setObjectName("pageButtonAnalyzer")
self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.pageButtonAnalyzer)
self.verticalLayout_5.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_5.setObjectName("verticalLayout_5")
self.btnAnalyze = QtWidgets.QToolButton(self.pageButtonAnalyzer)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
@@ -387,6 +387,7 @@ class Ui_FAnalysis(object):
self.pageProgressBar = QtWidgets.QWidget()
self.pageProgressBar.setObjectName("pageProgressBar")
self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.pageProgressBar)
self.verticalLayout_6.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_6.setObjectName("verticalLayout_6")
self.progressBarLogicAnalyzer = QtWidgets.QProgressBar(self.pageProgressBar)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
@@ -169,6 +168,7 @@ class Ui_Decoder(object):
self.page_substitution = QtWidgets.QWidget()
self.page_substitution.setObjectName("page_substitution")
self.gridLayout = QtWidgets.QGridLayout(self.page_substitution)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setObjectName("gridLayout")
self.substitution_rows = QtWidgets.QSpinBox(self.page_substitution)
self.substitution_rows.setMinimum(1)

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
@@ -34,6 +33,7 @@ class Ui_GeneratorTab(object):
self.tab_proto = QtWidgets.QWidget()
self.tab_proto.setObjectName("tab_proto")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.tab_proto)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.treeProtocols = GeneratorTreeView(self.tab_proto)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
@@ -48,6 +48,7 @@ class Ui_GeneratorTab(object):
self.tab_4 = QtWidgets.QWidget()
self.tab_4.setObjectName("tab_4")
self.gridLayout_4 = QtWidgets.QGridLayout(self.tab_4)
self.gridLayout_4.setContentsMargins(0, 0, 0, 0)
self.gridLayout_4.setObjectName("gridLayout_4")
self.lWPauses = GeneratorListWidget(self.tab_4)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
@@ -64,6 +65,7 @@ class Ui_GeneratorTab(object):
self.tab_5 = QtWidgets.QWidget()
self.tab_5.setObjectName("tab_5")
self.verticalLayout_8 = QtWidgets.QVBoxLayout(self.tab_5)
self.verticalLayout_8.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_8.setSpacing(6)
self.verticalLayout_8.setObjectName("verticalLayout_8")
self.listViewProtoLabels = GeneratorListView(self.tab_5)

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
@@ -27,6 +26,7 @@ class Ui_MainWindow(object):
self.layoutWidget = QtWidgets.QWidget(self.splitter)
self.layoutWidget.setObjectName("layoutWidget")
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.layoutWidget)
self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.lnEdtTreeFilter = QtWidgets.QLineEdit(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
@@ -65,6 +65,7 @@ class Ui_MainWindow(object):
self.tabParticipants = QtWidgets.QWidget()
self.tabParticipants.setObjectName("tabParticipants")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.tabParticipants)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.listViewParticipants = QtWidgets.QListView(self.tabParticipants)
self.listViewParticipants.setObjectName("listViewParticipants")
@@ -73,6 +74,7 @@ class Ui_MainWindow(object):
self.tabDescription = QtWidgets.QWidget()
self.tabDescription.setObjectName("tabDescription")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.tabDescription)
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.textEditProjectDescription = QtWidgets.QTextEdit(self.tabDescription)
self.textEditProjectDescription.setObjectName("textEditProjectDescription")
@@ -90,16 +92,19 @@ class Ui_MainWindow(object):
self.tab_interpretation = QtWidgets.QWidget()
self.tab_interpretation.setObjectName("tab_interpretation")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.tab_interpretation)
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.tabWidget.addTab(self.tab_interpretation, "")
self.tab_protocol = QtWidgets.QWidget()
self.tab_protocol.setObjectName("tab_protocol")
self.verticalLayout = QtWidgets.QVBoxLayout(self.tab_protocol)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.tabWidget.addTab(self.tab_protocol, "")
self.tab_generator = QtWidgets.QWidget()
self.tab_generator.setObjectName("tab_generator")
self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.tab_generator)
self.verticalLayout_5.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_5.setObjectName("verticalLayout_5")
self.tabWidget.addTab(self.tab_generator, "")
self.verticalLayout_4.addWidget(self.splitter)

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
@@ -18,6 +17,7 @@ class Ui_DialogOptions(object):
self.tabInterpretation = QtWidgets.QWidget()
self.tabInterpretation.setObjectName("tabInterpretation")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.tabInterpretation)
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.groupBox = QtWidgets.QGroupBox(self.tabInterpretation)
self.groupBox.setObjectName("groupBox")
@@ -77,6 +77,7 @@ class Ui_DialogOptions(object):
self.tabView = QtWidgets.QWidget()
self.tabView.setObjectName("tabView")
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.tabView)
self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
@@ -121,6 +122,7 @@ class Ui_DialogOptions(object):
self.tabDevices = QtWidgets.QWidget()
self.tabDevices.setObjectName("tabDevices")
self.gridLayout_3 = QtWidgets.QGridLayout(self.tabDevices)
self.gridLayout_3.setContentsMargins(0, 0, 0, 0)
self.gridLayout_3.setObjectName("gridLayout_3")
self.listWidgetDevices = QtWidgets.QListWidget(self.tabDevices)
self.listWidgetDevices.setObjectName("listWidgetDevices")

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
@@ -253,7 +252,7 @@ class Ui_SignalFrame(object):
self.layoutWidget.setObjectName("layoutWidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget)
self.verticalLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
self.verticalLayout.setContentsMargins(-1, -1, -1, 0)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!

View File

@@ -2,7 +2,7 @@ import unittest
from urh.signalprocessing.encoding import encoding
class TestCarrier(unittest.TestCase):
class TestDecoding(unittest.TestCase):
# Testmethode muss immer mit Präfix test_* starten
def test_carrier(self):
e = encoding()
@@ -17,3 +17,34 @@ class TestCarrier(unittest.TestCase):
newinpt, err = e.code_carrier(False, output)
print("Encoded: ", newinpt, err)
self.assertEqual(original_inpt, newinpt)
def test_enocean(self):
e = encoding()
# received = "01010101011010011110101011101110111011101110011000101110101000101110111011011101110100"
# First step is invert the received bits!!!
received = "10101010 1001 011000010101 000100010001 000100011001 110100010101 110100010001 0010001000 1011"
preamble = "10101010"
sof = "1001"
eof = "1011"
self.assertIn(preamble, received)
self.assertIn(sof, received)
self.assertIn(eof, received)
print("Received data", received)
# Preamble/SOF/EOF remain unchanged
expected_result = preamble + sof + "01100001 00000000 00000010 11000001 11000000 00100100" + eof
# Needs to be fixed!
decoded = e.decode(e.str2bit(received.replace(" ","")))
self.assertEqual(decoded, e.str2bit(expected_result.replace(" ", "")))