Tests: add test for QuantitySpinBox::setValue(double)

This commit is contained in:
wmayer
2023-11-16 19:35:41 +01:00
committed by wwmayer
parent 900d3e878e
commit 18aeb4e812

View File

@@ -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<Gui::QuantitySpinBox> qsb;
};