diff --git a/tests/GroupPlotTest.cpp b/tests/GroupPlotTest.cpp index 19ee3c8..ab3750f 100644 --- a/tests/GroupPlotTest.cpp +++ b/tests/GroupPlotTest.cpp @@ -19,10 +19,13 @@ void preparePlot(GroupPlot& plot) quantilesVector.push_back(quantiles); } - plot.setAxisScale(QwtPlot::yLeft, 0, 8); - plot.setAxisScale(QwtPlot::yRight, 0, 8); - plot.setAxisScale(QwtPlot::xBottom, 0.5, common::getValues().size() + 0.5, - 1); + const double maxValueForXAxis{8}; + plot.setAxisScale(QwtPlot::yLeft, 0, maxValueForXAxis); + plot.setAxisScale(QwtPlot::yRight, 0, maxValueForXAxis); + + const double maxValueForBottomAxis{ + static_cast(common::getValues().size()) + 0.5}; + plot.setAxisScale(QwtPlot::xBottom, 0.5, maxValueForBottomAxis, 1); plot.setNewData(std::move(quantilesVector), common::getNames()); plot.resize(common::getPlotSize()); } diff --git a/tests/QuantilesTest.cpp b/tests/QuantilesTest.cpp index f4ba75a..5dbadf1 100644 --- a/tests/QuantilesTest.cpp +++ b/tests/QuantilesTest.cpp @@ -5,11 +5,11 @@ #include -void QuantilesTest::testToolTip() +void QuantilesTest::testToolTip() const { Quantiles quantiles; quantiles.init(values_); - const QString expected(QStringLiteral( + const QString expected{QStringLiteral( "" "\n" "\n" @@ -21,22 +21,22 @@ void QuantilesTest::testToolTip() "\n" "\n" "\n" - "
Data count:11
Average66.62
Q107.02
Minimum5.00
Std. deviation54.48
")); + "")}; QCOMPARE(quantiles.getValuesAsToolTip(), expected); } -void QuantilesTest::testToolTipForOneValue() +void QuantilesTest::testToolTipForOneValue() const { Quantiles quantiles; const QVector singleItemData{3}; quantiles.init(singleItemData); - const QString expected( + const QString expected{ QStringLiteral("" "\n" "\n" "\n" "\n" - "
Data count:1
Average3.00
Maximum3.00
Minimum3.00
")); + "")}; QCOMPARE(quantiles.getValuesAsToolTip(), expected); } diff --git a/tests/QuantilesTest.h b/tests/QuantilesTest.h index 5abf86f..ebf596a 100644 --- a/tests/QuantilesTest.h +++ b/tests/QuantilesTest.h @@ -10,9 +10,9 @@ class QuantilesTest : public QObject QVector values_{84.66, 40., 5., 7.02, 177.01, 110.23, 138.12, 54.94, 20., 80., 15.85}; private Q_SLOTS: - void testToolTip(); + void testToolTip() const; - void testToolTipForOneValue(); + void testToolTipForOneValue() const; void testComputing();