diff --git a/src/axis/valueaxis/qvalueaxis.h b/src/axis/valueaxis/qvalueaxis.h index ecc08bc..e278605 100644 --- a/src/axis/valueaxis/qvalueaxis.h +++ b/src/axis/valueaxis/qvalueaxis.h @@ -60,12 +60,13 @@ public: void setLabelFormat(const QString &format); QString labelFormat() const; - void applyNiceNumbers(); - //TODO: depreciated ! void setNiceNumbersEnabled(bool enable = true); bool niceNumbersEnabled() const; +public Q_SLOTS: + void applyNiceNumbers(); + Q_SIGNALS: void minChanged(qreal min); void maxChanged(qreal max); diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml b/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml index a575073..4e79125 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml +++ b/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml @@ -132,6 +132,7 @@ Rectangle { yMax = chartView.axisY().max; yMin = chartView.axisY().min; + // Scroll left chartView.scrollLeft(10); verify(chartView.axisX().max < xMax); verify(chartView.axisX().min < xMin); @@ -142,6 +143,7 @@ Rectangle { yMax = chartView.axisY().max; yMin = chartView.axisY().min; + // Scroll right chartView.scrollRight(10); verify(chartView.axisX().max > xMax); verify(chartView.axisX().min > xMin); diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis.qml b/tests/auto/qml-qtquicktest/tst_valueaxis.qml index 01d8283..5468157 100644 --- a/tests/auto/qml-qtquicktest/tst_valueaxis.qml +++ b/tests/auto/qml-qtquicktest/tst_valueaxis.qml @@ -31,7 +31,8 @@ Rectangle { name: "tst_qml-qtquicktest ValueAxis" when: windowShown - function test_defaultPropertyValues() { + function test_properties() { + // Default properties verify(axisX.min < 0, "AxisX min"); verify(axisX.max > 0, "AxisX max"); verify(axisY.min < 0, "AxisY min"); @@ -40,16 +41,32 @@ Rectangle { verify(axisY.tickCount > 0, "AxisX tick count"); compare(axisX.niceNumbersEnabled, false, "nice numbers"); compare(axisX.labelFormat, "", "label format"); - } - function test_modifyProperties() { + // Modify properties axisX.tickCount = 3; compare(axisX.tickCount, 3, "set tick count"); - axisX.niceNumbersEnabled = true; compare(axisX.niceNumbersEnabled, true, "nice numbers"); } + function test_functions() { + // Set the axis ranges to not "nice" ones... + var min = 0.032456456; + var max = 10.67845634; + axisX.max = min; + axisX.max = max; + axisY.max = min; + axisY.max = max; + + // ...And then apply nice numbers and verify the range was changed + axisX.applyNiceNumbers(); + axisY.applyNiceNumbers(); + verify(axisX.min != min); + verify(axisX.max != max); + verify(axisY.min != min); + verify(axisY.max != max); + } + function test_signals() { minChangedSpy.clear(); maxChangedSpy.clear();