Commit 6dcfabfc authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test][spinboxes] Ensure that numpy_type property works as expected

Ensure that:
- If type is different, signal is emitted and type properly changed
- If type is same, nothing happens
parent cb4c8c98
......@@ -46,6 +46,8 @@ def expected_values():
class SpinBoxBaseTest:
numpy_type = None
def test_range(self, qtbot):
spinbox = NumpySpinBox(self.numpy_type)
qtbot.addWidget(spinbox)
......@@ -210,7 +212,11 @@ class TestTypeChange(SpinBoxBaseTest):
qtbot.addWidget(spinbox)
self.numpy_type = np.float64
spinbox.setNumpyType(self.numpy_type)
with qtbot.waitSignal(spinbox.numpyTypeChanged):
spinbox.setNumpyType(self.numpy_type)
assert spinbox.numpy_type == self.numpy_type
spinbox.setRange(-10.45, 10.45)
......@@ -225,3 +231,12 @@ class TestTypeChange(SpinBoxBaseTest):
spinbox.setValue(15)
assert spinbox.value() == spinbox.maximum()
def test_type_change_with_same_type(self, qtbot):
spinbox = NumpySpinBox(self.numpy_type)
qtbot.addWidget(spinbox)
with qtbot.assertNotEmitted(spinbox.numpyTypeChanged):
spinbox.setNumpyType(self.numpy_type)
assert spinbox.numpy_type == self.numpy_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