Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.editor
Commits
a1093cbf
Commit
a1093cbf
authored
Apr 04, 2019
by
Samuel GAIST
Browse files
[test][spinboxes] Remove unneeded duplicate base class and fix cases
parent
d7d25092
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/editor/test/test_spinboxes.py
View file @
a1093cbf
...
...
@@ -67,45 +67,6 @@ class SpinBoxBaseTest:
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
):
klass
=
Int64SpinBox
...
...
@@ -145,7 +106,7 @@ class TestUin64SpinBox(SpinBoxBaseTest):
assert
spinbox
.
value
()
==
spinbox
.
maximum
()
class
TestFloat64SpinBox
(
SpinBox
Float64
BaseTest
):
class
TestFloat64SpinBox
(
SpinBoxBaseTest
):
klass
=
Float64SpinBox
def
test_values
(
self
,
qtbot
):
...
...
@@ -162,3 +123,16 @@ class TestFloat64SpinBox(SpinBoxFloat64BaseTest):
spinbox
.
setValue
(
-
15
)
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
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment