Tests: add test for QuantitySpinBox::setValue(double)
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user