diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-01-12 14:09:42 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-01-12 14:40:41 (GMT) |
commit | 12e320a7a3a5ca93dd5287315571db1d1728e322 (patch) | |
tree | 37e46eba29bf7e0524900a457cb342724245c133 /tests | |
parent | 4c85bf275c9d472a17cc9210aebf6eb880be740a (diff) | |
download | Qt-12e320a7a3a5ca93dd5287315571db1d1728e322.zip Qt-12e320a7a3a5ca93dd5287315571db1d1728e322.tar.gz Qt-12e320a7a3a5ca93dd5287315571db1d1728e322.tar.bz2 |
Significant digits were lost in QDoubleSpinBox range when changing precision
When setting the range, the actual value precision was lost because the min
and max were saved after being formatted to the current precison (decimals
property), thus losing information. We now keep the user original values, and
use these whenever the decimals property is changed. Auto-test included.
Reviewed-by: leo
Task-number: QTBUG-6496
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp index a3f0915..35cffd6 100644 --- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp @@ -149,6 +149,7 @@ private slots: void taskQTBUG_5008_textFromValueAndValidate(); void taskQTBUG_6670_selectAllWithPrefix(); + void taskQTBUG_6496_fiddlingWithPrecision(); public slots: void valueChangedHelper(const QString &); @@ -1096,5 +1097,17 @@ void tst_QDoubleSpinBox::taskQTBUG_6670_selectAllWithPrefix() QCOMPARE(spin.value(), 12.); } +void tst_QDoubleSpinBox::taskQTBUG_6496_fiddlingWithPrecision() +{ + QDoubleSpinBox dsb; + dsb.setRange(0, 0.991); + dsb.setDecimals(1); + QCOMPARE(dsb.maximum(), 1.0); + dsb.setDecimals(2); + QCOMPARE(dsb.maximum(), 0.99); + dsb.setDecimals(3); + QCOMPARE(dsb.maximum(), 0.991); +} + QTEST_MAIN(tst_QDoubleSpinBox) #include "tst_qdoublespinbox.moc" |