@@ -60,12 +60,13 public: | |||||
60 | void setLabelFormat(const QString &format); |
|
60 | void setLabelFormat(const QString &format); | |
61 | QString labelFormat() const; |
|
61 | QString labelFormat() const; | |
62 |
|
62 | |||
63 | void applyNiceNumbers(); |
|
|||
64 |
|
||||
65 | //TODO: depreciated ! |
|
63 | //TODO: depreciated ! | |
66 | void setNiceNumbersEnabled(bool enable = true); |
|
64 | void setNiceNumbersEnabled(bool enable = true); | |
67 | bool niceNumbersEnabled() const; |
|
65 | bool niceNumbersEnabled() const; | |
68 |
|
66 | |||
|
67 | public Q_SLOTS: | |||
|
68 | void applyNiceNumbers(); | |||
|
69 | ||||
69 | Q_SIGNALS: |
|
70 | Q_SIGNALS: | |
70 | void minChanged(qreal min); |
|
71 | void minChanged(qreal min); | |
71 | void maxChanged(qreal max); |
|
72 | void maxChanged(qreal max); |
@@ -132,6 +132,7 Rectangle { | |||||
132 | yMax = chartView.axisY().max; |
|
132 | yMax = chartView.axisY().max; | |
133 | yMin = chartView.axisY().min; |
|
133 | yMin = chartView.axisY().min; | |
134 |
|
134 | |||
|
135 | // Scroll left | |||
135 | chartView.scrollLeft(10); |
|
136 | chartView.scrollLeft(10); | |
136 | verify(chartView.axisX().max < xMax); |
|
137 | verify(chartView.axisX().max < xMax); | |
137 | verify(chartView.axisX().min < xMin); |
|
138 | verify(chartView.axisX().min < xMin); | |
@@ -142,6 +143,7 Rectangle { | |||||
142 | yMax = chartView.axisY().max; |
|
143 | yMax = chartView.axisY().max; | |
143 | yMin = chartView.axisY().min; |
|
144 | yMin = chartView.axisY().min; | |
144 |
|
145 | |||
|
146 | // Scroll right | |||
145 | chartView.scrollRight(10); |
|
147 | chartView.scrollRight(10); | |
146 | verify(chartView.axisX().max > xMax); |
|
148 | verify(chartView.axisX().max > xMax); | |
147 | verify(chartView.axisX().min > xMin); |
|
149 | verify(chartView.axisX().min > xMin); |
@@ -31,7 +31,8 Rectangle { | |||||
31 | name: "tst_qml-qtquicktest ValueAxis" |
|
31 | name: "tst_qml-qtquicktest ValueAxis" | |
32 | when: windowShown |
|
32 | when: windowShown | |
33 |
|
33 | |||
34 |
function test_ |
|
34 | function test_properties() { | |
|
35 | // Default properties | |||
35 | verify(axisX.min < 0, "AxisX min"); |
|
36 | verify(axisX.min < 0, "AxisX min"); | |
36 | verify(axisX.max > 0, "AxisX max"); |
|
37 | verify(axisX.max > 0, "AxisX max"); | |
37 | verify(axisY.min < 0, "AxisY min"); |
|
38 | verify(axisY.min < 0, "AxisY min"); | |
@@ -40,16 +41,32 Rectangle { | |||||
40 | verify(axisY.tickCount > 0, "AxisX tick count"); |
|
41 | verify(axisY.tickCount > 0, "AxisX tick count"); | |
41 | compare(axisX.niceNumbersEnabled, false, "nice numbers"); |
|
42 | compare(axisX.niceNumbersEnabled, false, "nice numbers"); | |
42 | compare(axisX.labelFormat, "", "label format"); |
|
43 | compare(axisX.labelFormat, "", "label format"); | |
43 | } |
|
|||
44 |
|
44 | |||
45 |
|
|
45 | // Modify properties | |
46 | axisX.tickCount = 3; |
|
46 | axisX.tickCount = 3; | |
47 | compare(axisX.tickCount, 3, "set tick count"); |
|
47 | compare(axisX.tickCount, 3, "set tick count"); | |
48 |
|
||||
49 | axisX.niceNumbersEnabled = true; |
|
48 | axisX.niceNumbersEnabled = true; | |
50 | compare(axisX.niceNumbersEnabled, true, "nice numbers"); |
|
49 | compare(axisX.niceNumbersEnabled, true, "nice numbers"); | |
51 | } |
|
50 | } | |
52 |
|
51 | |||
|
52 | function test_functions() { | |||
|
53 | // Set the axis ranges to not "nice" ones... | |||
|
54 | var min = 0.032456456; | |||
|
55 | var max = 10.67845634; | |||
|
56 | axisX.max = min; | |||
|
57 | axisX.max = max; | |||
|
58 | axisY.max = min; | |||
|
59 | axisY.max = max; | |||
|
60 | ||||
|
61 | // ...And then apply nice numbers and verify the range was changed | |||
|
62 | axisX.applyNiceNumbers(); | |||
|
63 | axisY.applyNiceNumbers(); | |||
|
64 | verify(axisX.min != min); | |||
|
65 | verify(axisX.max != max); | |||
|
66 | verify(axisY.min != min); | |||
|
67 | verify(axisY.max != max); | |||
|
68 | } | |||
|
69 | ||||
53 | function test_signals() { |
|
70 | function test_signals() { | |
54 | minChangedSpy.clear(); |
|
71 | minChangedSpy.clear(); | |
55 | maxChangedSpy.clear(); |
|
72 | maxChangedSpy.clear(); |
General Comments 0
You need to be logged in to leave comments.
Login now