Skip to content

Commit

Permalink
Tests: add test for QuantitySpinBox::setValue(double)
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Nov 16, 2023
1 parent 6a9fa8d commit c608c77
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/src/Gui/QuantitySpinBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 62 in tests/src/Gui/QuantitySpinBox.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

shoudn't ==> shouldn't
qsb->setValue(3.5);
auto val2 = qsb->value();
QCOMPARE(val2.getFormat().precision, 7);
}

private:
std::unique_ptr<Gui::QuantitySpinBox> qsb;
};
Expand Down

0 comments on commit c608c77

Please sign in to comment.