Пример #1
0
    def test_modification_emits_changed(self):
        parent = QWidget()
        widget = GeneSettingDisplayWidget(parent)
        test = ModelTest()
        gene = Gene()
        setting = GeneSetting(gene, True)
        model = Model()

        test.add_setting(setting)
        widget.set_item(test, model)

        detector = Mock()
        widget.changed.connect(detector.test)

        widget.dataTable.item(0, 1).setText("inactive")
        assert detector.test.called is True
        assert widget.content_changed is True
Пример #2
0
    def test_addition_emits_changed(self):
        parent = QWidget()
        widget = GeneSettingDisplayWidget(parent)
        test = ModelTest()
        gene = Gene()
        setting = GeneSetting(gene, False)
        model = Model()

        test.add_setting(setting)
        widget.set_item(test, model)

        detector = Mock()
        widget.changed.connect(detector.test)

        widget.dataTable.update_row_from_item(GeneSetting(Gene(), True))
        assert detector.test.called is True
        assert widget.content_changed is True
Пример #3
0
    def test_setting_item(self):
        parent = QWidget()
        widget = GeneSettingDisplayWidget(parent)
        test = ModelTest()
        gene = Gene()
        setting = GeneSetting(gene, False)
        model = Model()

        test.add_setting(setting)

        widget.dataTable.populate_table = Mock()

        widget.set_item(test, model)

        widget.dataTable.populate_table.assert_called_once_with(
            test.gene_settings)
        assert widget.model is model
        assert widget.model_test is test
Пример #4
0
    def test_deletion_emits_changed(self):
        parent = QWidget()
        widget = GeneSettingDisplayWidget(parent)
        test = ModelTest()
        gene = Gene()
        setting = GeneSetting(gene, False)
        model = Model()

        test.add_setting(setting)
        widget.set_item(test, model)

        detector = Mock()
        widget.changed.connect(detector.test)

        widget.tableView.selectRow(0)
        QtTest.QTest.mouseClick(widget.button_del_item, QtCore.Qt.LeftButton)
        assert widget.dataTable.rowCount() == 0
        assert detector.test.called is True
        assert widget.content_changed is True
Пример #5
0
    def test_saving_items(self):

        parent = QWidget()
        widget = GeneSettingDisplayWidget(parent)
        test = ModelTest()
        gene = Gene()
        setting = GeneSetting(gene, False)
        model = Model()

        test.add_setting(setting)
        widget.set_item(test, model)

        new_test = ModelTest()
        widget.model_test = new_test

        assert len(new_test.gene_settings) == 0
        widget.save_state()
        assert len(new_test.gene_settings) == 1

        new_setting = list(new_test.gene_settings)[0]

        assert new_setting == setting
        assert new_setting is not setting
Пример #6
0
    def setupUi(self, EditTestDialog):
        EditTestDialog.setObjectName("EditTestDialog")
        EditTestDialog.resize(447, 307)
        self.verticalLayout_4 = QtWidgets.QVBoxLayout(EditTestDialog)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.nameLabel = QtWidgets.QLabel(EditTestDialog)
        self.nameLabel.setObjectName("nameLabel")
        self.gridLayout.addWidget(self.nameLabel, 0, 0, 1, 1)
        self.nameLineEdit = QtWidgets.QLineEdit(EditTestDialog)
        self.nameLineEdit.setObjectName("nameLineEdit")
        self.gridLayout.addWidget(self.nameLineEdit, 0, 1, 1, 1)
        self.verticalLayout_4.addLayout(self.gridLayout)
        self.splitter_horizontal = QtWidgets.QSplitter(EditTestDialog)
        self.splitter_horizontal.setOrientation(QtCore.Qt.Vertical)
        self.splitter_horizontal.setObjectName("splitter_horizontal")
        self.splitter_vertical = QtWidgets.QSplitter(self.splitter_horizontal)
        self.splitter_vertical.setOrientation(QtCore.Qt.Horizontal)
        self.splitter_vertical.setObjectName("splitter_vertical")
        self.groupBox = QtWidgets.QGroupBox(self.splitter_vertical)
        self.groupBox.setObjectName("groupBox")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox)
        self.verticalLayout.setObjectName("verticalLayout")
        self.tabWidget = QtWidgets.QTabWidget(self.groupBox)
        self.tabWidget.setObjectName("tabWidget")
        self.reactionTab = ReactionSettingDisplayWidget()
        self.reactionTab.setObjectName("reactionTab")
        self.tabWidget.addTab(self.reactionTab, "")
        self.geneTab = GeneSettingDisplayWidget()
        self.geneTab.setObjectName("geneTab")
        self.tabWidget.addTab(self.geneTab, "")
        self.verticalLayout.addWidget(self.tabWidget)
        self.groupBox_2 = QtWidgets.QGroupBox(self.splitter_vertical)
        self.groupBox_2.setObjectName("groupBox_2")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox_2)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.tabWidget2 = QtWidgets.QTabWidget(self.groupBox_2)
        self.tabWidget2.setObjectName("tabWidget2")
        self.outcomeTab = OutcomeDisplayWidget()
        self.outcomeTab.setObjectName("outcomeTab")
        self.tabWidget2.addTab(self.outcomeTab, "")
        self.referenceTab = ReferenceDisplayWidget()
        self.referenceTab.setObjectName("referenceTab")
        self.tabWidget2.addTab(self.referenceTab, "")
        self.verticalLayout_2.addWidget(self.tabWidget2)
        self.groupBox_3 = QtWidgets.QGroupBox(self.splitter_horizontal)
        self.groupBox_3.setObjectName("groupBox_3")
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.groupBox_3)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.commentWidget = CommentDisplayWidget(self.groupBox_3)
        self.commentWidget.setObjectName("commentWidget")
        self.verticalLayout_3.addWidget(self.commentWidget)
        self.verticalLayout_4.addWidget(self.splitter_horizontal)
        self.buttonBox = QtWidgets.QDialogButtonBox(EditTestDialog)
        self.buttonBox.setStyleSheet("")
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel
                                          | QtWidgets.QDialogButtonBox.Save)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout_4.addWidget(self.buttonBox)

        self.retranslateUi(EditTestDialog)
        self.tabWidget.setCurrentIndex(0)
        self.tabWidget2.setCurrentIndex(0)
        self.buttonBox.accepted.connect(EditTestDialog.accept)
        self.buttonBox.rejected.connect(EditTestDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(EditTestDialog)