예제 #1
0
    def test_setValue_should_update_value(self, qtbot, default_value):

        # set up BooleanInput
        bool_param = BooleanParameter('potato', default=default_value)
        bool_input = BooleanInput(bool_param)
        qtbot.addWidget(bool_input)

        bool_input.setValue(not default_value)
        assert bool_input.value() == (not default_value)
예제 #2
0
    def test_setValue_should_update_value(self, qtbot, default_value):

        # set up BooleanInput
        bool_param = BooleanParameter('potato', default=default_value)
        bool_input = BooleanInput(bool_param)
        qtbot.addWidget(bool_input)

        bool_input.setValue(not default_value)
        assert bool_input.value() == (not default_value)
예제 #3
0
    def test_leftclick_should_update_parameter(self, qtbot, default_value):
        # set up BooleanInput
        bool_param = BooleanParameter('potato', default=default_value)

        with mock.patch('test_inputs.BooleanParameter.value',
                new_callable=mock.PropertyMock,
                return_value=default_value) as p:
            bool_input = BooleanInput(bool_param)
            qtbot.addWidget(bool_input)
            bool_input.show()

            # TODO: fix: fails to toggle on Windows
            #qtbot.mouseClick(bool_input, QtCore.Qt.LeftButton)
            bool_input.setValue(not default_value)

            assert bool_input.value() == (not default_value)
            bool_input.parameter # lazy update
            p.assert_called_once_with(not default_value)
예제 #4
0
    def test_leftclick_should_update_parameter(self, qtbot, default_value):
        # set up BooleanInput
        bool_param = BooleanParameter('potato', default=default_value)

        with mock.patch('test_inputs.BooleanParameter.value',
                        new_callable=mock.PropertyMock,
                        return_value=default_value) as p:
            bool_input = BooleanInput(bool_param)
            qtbot.addWidget(bool_input)
            bool_input.show()

            # TODO: fix: fails to toggle on Windows
            #qtbot.mouseClick(bool_input, QtCore.Qt.LeftButton)
            bool_input.setValue(not default_value)

            assert bool_input.value() == (not default_value)
            bool_input.parameter  # lazy update
            p.assert_called_once_with(not default_value)