diff --git a/examples/SpinBox.py b/examples/SpinBox.py
index 2faf10ee..ef1d0fc5 100644
--- a/examples/SpinBox.py
+++ b/examples/SpinBox.py
@@ -26,7 +26,7 @@ spins = [
("Float with SI-prefixed units
(n, u, m, k, M, etc)",
pg.SpinBox(value=0.9, suffix='V', siPrefix=True)),
("Float with SI-prefixed units,
dec step=0.1, minStep=0.1",
- pg.SpinBox(value=1.0, suffix='V', siPrefix=True, dec=True, step=0.1, minStep=0.1)),
+ pg.SpinBox(value=1.0, suffix='PSI', siPrefix=True, dec=True, step=0.1, minStep=0.1)),
("Float with SI-prefixed units,
dec step=0.5, minStep=0.01",
pg.SpinBox(value=1.0, suffix='V', siPrefix=True, dec=True, step=0.5, minStep=0.01)),
("Float with SI-prefixed units,
dec step=1.0, minStep=0.001",
diff --git a/pyqtgraph/widgets/tests/test_spinbox.py b/pyqtgraph/widgets/tests/test_spinbox.py
index 10087881..cff97da7 100644
--- a/pyqtgraph/widgets/tests/test_spinbox.py
+++ b/pyqtgraph/widgets/tests/test_spinbox.py
@@ -18,6 +18,8 @@ def test_spinbox_formatting():
(12345678955, '12345678955', dict(int=True, decimals=100)),
(1.45e-9, '1.45e-09 A', dict(int=False, decimals=6, suffix='A', siPrefix=False)),
(1.45e-9, '1.45 nA', dict(int=False, decimals=6, suffix='A', siPrefix=True)),
+ (1.45, '1.45 PSI', dict(int=False, decimals=6, suffix='PSI', siPrefix=True)),
+ (1.45e-3, '1.45 mPSI', dict(int=False, decimals=6, suffix='PSI', siPrefix=True)),
(-2500.3427, '$-2500.34', dict(int=False, format='${value:0.02f}')),
]
@@ -26,3 +28,14 @@ def test_spinbox_formatting():
sb.setValue(value)
assert sb.value() == value
assert pg.asUnicode(sb.text()) == text
+
+ # test setting value
+ if not opts.get('int', False):
+ suf = sb.opts['suffix']
+ sb.lineEdit().setText('0.1' + suf)
+ sb.editingFinishedEvent()
+ assert sb.value() == 0.1
+ if suf != '':
+ sb.lineEdit().setText('0.1 m' + suf)
+ sb.editingFinishedEvent()
+ assert sb.value() == 0.1e-3