Commit c127b7e8 authored by Flavio TARSETTI's avatar Flavio TARSETTI Committed by Samuel GAIST
Browse files

[widgets][spinboxes] added uint32 spinbox with test

parent 3666ccad
......@@ -25,6 +25,7 @@
from ..widgets.spinboxes import Int64SpinBox
from ..widgets.spinboxes import Uint64SpinBox
from ..widgets.spinboxes import Uint32SpinBox
from ..widgets.spinboxes import Float64SpinBox
......@@ -67,6 +68,29 @@ class SpinBoxBaseTest:
assert spinbox.value() == spinbox.numpy_type(expected_value)
class TestUin32SpinBox(SpinBoxBaseTest):
klass = Uint32SpinBox
def test_invalid_range(self, qtbot):
spinbox = Uint32SpinBox()
spinbox.setRange(-10, 10)
assert spinbox.minimum() == 0
def test_values(self, qtbot):
spinbox = Uint32SpinBox()
spinbox.setRange(0, 10)
assert spinbox.value() == spinbox.minimum()
assert spinbox.value() == spinbox.maximum()
class TestIn64SpinBox(SpinBoxBaseTest):
klass = Int64SpinBox
......@@ -237,6 +237,16 @@ class AbstractNumpySpinBox(QAbstractSpinBox):
return QAbstractSpinBox.StepUpEnabled | QAbstractSpinBox.StepDownEnabled
class Uint32SpinBox(AbstractNumpySpinBox):
"""Spin box handling the uint32 type"""
numpy_type = np.uint32
valueChanged = pyqtSignal(numpy_type)
minimumChanged = pyqtSignal(numpy_type)
maximumChanged = pyqtSignal(numpy_type)
class Int64SpinBox(AbstractNumpySpinBox):
"""Spin box handling the int64 type"""
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment