Exemplo n.º 1
0
    def test_init_from_param(self, qtbot, min_, max_, default_value):
        float_param = FloatParameter('potato',
                minimum=min_,
                maximum=max_,
                default=default_value,
                units='m')
        sci_input = ScientificInput(float_param)
        qtbot.addWidget(sci_input)

        assert sci_input.minimum() == min_
        assert sci_input.maximum() == max_
        assert sci_input.value() == default_value
        assert sci_input.suffix() == ' m'
Exemplo n.º 2
0
    def test_init_from_param(self, qtbot, min_, max_, default_value):
        float_param = FloatParameter('potato',
                                     minimum=min_,
                                     maximum=max_,
                                     default=default_value,
                                     units='m')
        sci_input = ScientificInput(float_param)
        qtbot.addWidget(sci_input)

        assert sci_input.minimum() == min_
        assert sci_input.maximum() == max_
        assert sci_input.value() == default_value
        assert sci_input.suffix() == ' m'
Exemplo n.º 3
0
    def test_init_from_param(self, qtbot, min_, max_, default_value,
                             value_remains_default):
        float_param = FloatParameter('potato',
                                     minimum=min_,
                                     maximum=max_,
                                     default=default_value,
                                     units='m')

        if (value_remains_default):
            # Enable check that the value is initialized to default_value
            check_value = default_value
        else:
            # Set to a non default value
            float_param.value = min_
            # Enable check that the value is changed after initialization to a non default value
            check_value = min_

        sci_input = ScientificInput(float_param)
        qtbot.addWidget(sci_input)

        assert sci_input.minimum() == min_
        assert sci_input.maximum() == max_
        assert sci_input.value() == check_value
        assert sci_input.suffix() == ' m'