diff --git a/tests/src/Gui/QuantitySpinBox.cpp b/tests/src/Gui/QuantitySpinBox.cpp index ebfc454c70..4e12f731e7 100644 --- a/tests/src/Gui/QuantitySpinBox.cpp +++ b/tests/src/Gui/QuantitySpinBox.cpp @@ -47,6 +47,24 @@ private Q_SLOTS: QCOMPARE(result, Base::Quantity(0.1, QLatin1String("mm"))); } + void test_KeepFormat() // NOLINT + { + auto quant = qsb->value(); + auto format = quant.getFormat(); + format.precision = 7; + quant.setFormat(format); + + qsb->setValue(quant); + + auto val1 = qsb->value(); + QCOMPARE(val1.getFormat().precision, 7); + + // format shoudn't change after setting a double + qsb->setValue(3.5); + auto val2 = qsb->value(); + QCOMPARE(val2.getFormat().precision, 7); + } + private: std::unique_ptr qsb; };