diff options
author | Kari Oikarinen <kari.oikarinen@qt.io> | 2017-12-21 09:35:19 +0200 |
---|---|---|
committer | Kari Oikarinen <kari.oikarinen@qt.io> | 2017-12-21 11:21:35 +0000 |
commit | 146e375210f406e62fd952d150bc1bcd926d60cb (patch) | |
tree | 291b363d277d8d57c0450cace788ea97e8431818 /tests/auto | |
parent | 6b3a1a975e1f0237e78c3d329411c15f00577b01 (diff) |
Add labelsPrecision property to bar charts
Allow choosing the number of significant digits in the value labels for the
bars. Before this this has been hardcoded to 6, so the default value stays as 6
for backward compatibility.
Task-number: QTBUG-64370
Change-Id: I022bdad21aca7a7750ed46181b4ec97726bd9dc5
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qbarseries/tst_qbarseries.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qbarseries/tst_qbarseries.cpp b/tests/auto/qbarseries/tst_qbarseries.cpp index 5fe2808c..ef49b1ca 100644 --- a/tests/auto/qbarseries/tst_qbarseries.cpp +++ b/tests/auto/qbarseries/tst_qbarseries.cpp @@ -72,6 +72,7 @@ private slots: void setLabelsFormat(); void setLabelsPosition(); void setLabelsAngle(); + void setLabelsPrecision(); void opacity(); void mouseclicked_data(); void mouseclicked(); @@ -430,6 +431,19 @@ void tst_QBarSeries::setLabelsAngle() QCOMPARE(m_barseries->labelsAngle(), 55.0); } +void tst_QBarSeries::setLabelsPrecision() +{ + QSignalSpy labelsPrecisionSpy(m_barseries, + SIGNAL(labelsPrecisionChanged(int))); + QCOMPARE(m_barseries->labelsPrecision(), 6); + + m_barseries->setLabelsPrecision(9); + TRY_COMPARE(labelsPrecisionSpy.count(), 1); + QList<QVariant> arguments = labelsPrecisionSpy.takeFirst(); + QVERIFY(arguments.at(0).value<int>() == 9); + QCOMPARE(m_barseries->labelsPrecision(), 9); +} + void tst_QBarSeries::opacity() { QSignalSpy opacitySpy(m_barseries, SIGNAL(opacityChanged())); |