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
c127b7e8
Commit
c127b7e8
authored
Apr 25, 2019
by
Flavio TARSETTI
Committed by
Samuel GAIST
Oct 04, 2019
Browse files
[widgets][spinboxes] added uint32 spinbox with test
parent
3666ccad
Changes
2
Hide whitespace changes
Inline
Side-by-side
beat/editor/test/test_spinboxes.py
View file @
c127b7e8
...
...
@@ -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
()
qtbot
.
addWidget
(
spinbox
)
spinbox
.
setRange
(
-
10
,
10
)
assert
spinbox
.
minimum
()
==
0
def
test_values
(
self
,
qtbot
):
spinbox
=
Uint32SpinBox
()
qtbot
.
addWidget
(
spinbox
)
spinbox
.
setRange
(
0
,
10
)
spinbox
.
setValue
(
-
10
)
assert
spinbox
.
value
()
==
spinbox
.
minimum
()
spinbox
.
setValue
(
20
)
assert
spinbox
.
value
()
==
spinbox
.
maximum
()
class
TestIn64SpinBox
(
SpinBoxBaseTest
):
klass
=
Int64SpinBox
...
...
beat/editor/widgets/spinboxes.py
View file @
c127b7e8
...
...
@@ -237,6 +237,16 @@ class AbstractNumpySpinBox(QAbstractSpinBox):
return
QAbstractSpinBox
.
StepUpEnabled
|
QAbstractSpinBox
.
StepDownEnabled
@
frozen
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
)
@
frozen
class
Int64SpinBox
(
AbstractNumpySpinBox
):
"""Spin box handling the int64 type"""
...
...
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