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