Commit a1093cbf authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test][spinboxes] Remove unneeded duplicate base class and fix cases

parent d7d25092
...@@ -67,45 +67,6 @@ class SpinBoxBaseTest: ...@@ -67,45 +67,6 @@ class SpinBoxBaseTest:
assert spinbox.value() == spinbox.numpy_type(expected_value) assert spinbox.value() == spinbox.numpy_type(expected_value)
class SpinBoxFloat64BaseTest:
klass = None
def test_range(self, qtbot):
spinbox = self.klass()
qtbot.addWidget(spinbox)
minimum = 0
maximum = 10
spinbox.setRange(minimum, maximum)
assert spinbox.minimum() == minimum
assert spinbox.maximum() == maximum
spinbox.setValue(-10)
assert spinbox.value() == spinbox.minimum()
spinbox.setValue(20)
assert spinbox.value() == spinbox.maximum()
def test_valid_input(self, qtbot):
spinbox = self.klass()
qtbot.addWidget(spinbox)
value = "42"
with qtbot.waitSignal(spinbox.valueChanged):
qtbot.keyClicks(spinbox, value)
assert spinbox.value() == spinbox.numpy_type(value)
def test_invalid_input(self, qtbot):
spinbox = self.klass()
qtbot.addWidget(spinbox)
value = "44444444444444444444444444444444444444444444444444444444444"
expected_value = 4.4444444444444445e58
with qtbot.waitSignal(spinbox.valueChanged):
qtbot.keyClicks(spinbox, value)
assert spinbox.value() == spinbox.numpy_type(expected_value)
class TestIn64SpinBox(SpinBoxBaseTest): class TestIn64SpinBox(SpinBoxBaseTest):
klass = Int64SpinBox klass = Int64SpinBox
...@@ -145,7 +106,7 @@ class TestUin64SpinBox(SpinBoxBaseTest): ...@@ -145,7 +106,7 @@ class TestUin64SpinBox(SpinBoxBaseTest):
assert spinbox.value() == spinbox.maximum() assert spinbox.value() == spinbox.maximum()
class TestFloat64SpinBox(SpinBoxFloat64BaseTest): class TestFloat64SpinBox(SpinBoxBaseTest):
klass = Float64SpinBox klass = Float64SpinBox
def test_values(self, qtbot): def test_values(self, qtbot):
...@@ -162,3 +123,16 @@ class TestFloat64SpinBox(SpinBoxFloat64BaseTest): ...@@ -162,3 +123,16 @@ class TestFloat64SpinBox(SpinBoxFloat64BaseTest):
spinbox.setValue(-15) spinbox.setValue(-15)
assert spinbox.value() == spinbox.minimum() assert spinbox.value() == spinbox.minimum()
spinbox.setValue(15)
assert spinbox.value() == spinbox.maximum()
def test_invalid_input(self, qtbot):
spinbox = self.klass()
qtbot.addWidget(spinbox)
value = "44444444444444444444444444444444444444444444444444444444444"
expected_value = 4.444444444444445e164
with qtbot.waitSignal(spinbox.valueChanged):
qtbot.keyClicks(spinbox, value)
assert spinbox.value() == spinbox.numpy_type(expected_value)
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