@@ -143,6 +143,7 void tst_QChartView::rubberBand() | |||||
143 | m_view->chart()->addSeries(line); |
|
143 | m_view->chart()->addSeries(line); | |
144 | m_view->chart()->createDefaultAxes(); |
|
144 | m_view->chart()->createDefaultAxes(); | |
145 | m_view->show(); |
|
145 | m_view->show(); | |
|
146 | QTest::qWaitForWindowShown(m_view); | |||
146 |
|
147 | |||
147 | QRectF plotArea = m_view->chart()->plotArea(); |
|
148 | QRectF plotArea = m_view->chart()->plotArea(); | |
148 | //this is hack since view does not get events otherwise |
|
149 | //this is hack since view does not get events otherwise | |
@@ -152,24 +153,25 void tst_QChartView::rubberBand() | |||||
152 | QSignalSpy spy0(axisY, SIGNAL(rangeChanged(qreal,qreal))); |
|
153 | QSignalSpy spy0(axisY, SIGNAL(rangeChanged(qreal,qreal))); | |
153 | QAbstractAxis* axisX = m_view->chart()->axisX(); |
|
154 | QAbstractAxis* axisX = m_view->chart()->axisX(); | |
154 | QSignalSpy spy1(axisX, SIGNAL(rangeChanged(qreal,qreal))); |
|
155 | QSignalSpy spy1(axisX, SIGNAL(rangeChanged(qreal,qreal))); | |
155 |
|
||||
156 |
|
||||
157 | QValueAxis* vaxisX = qobject_cast<QValueAxis*>(axisX); |
|
156 | QValueAxis* vaxisX = qobject_cast<QValueAxis*>(axisX); | |
158 | QValueAxis* vaxisY = qobject_cast<QValueAxis*>(axisY); |
|
157 | QValueAxis* vaxisY = qobject_cast<QValueAxis*>(axisY); | |
159 |
|
||||
160 | int minX = vaxisX->min(); |
|
158 | int minX = vaxisX->min(); | |
161 | int minY = vaxisY->min(); |
|
159 | int minY = vaxisY->min(); | |
162 | int maxX = vaxisX->max(); |
|
160 | int maxX = vaxisX->max(); | |
163 | int maxY = vaxisY->max(); |
|
161 | int maxY = vaxisY->max(); | |
164 |
|
162 | |||
165 | QTest::qWaitForWindowShown(m_view); |
|
163 | // try to ensure focus | |
166 | QTest::mouseMove(m_view->viewport(), min + plotArea.topLeft().toPoint()); |
|
164 | QApplication::setActiveWindow(m_view); | |
167 | QTest::qWait(2000); |
|
165 | m_view->setFocus(); | |
168 | QTest::mousePress(m_view->viewport(), Qt::LeftButton, 0, min + plotArea.topLeft().toPoint()); |
|
166 | QApplication::processEvents(); | |
169 | QTest::qWait(2000); |
|
167 | QVERIFY(m_view->isActiveWindow()); | |
170 | QTest::mouseMove(m_view->viewport(), plotArea.bottomRight().toPoint() - max); |
|
168 | QVERIFY(m_view->hasFocus()); | |
171 | QTest::qWait(2000); |
|
169 | ||
172 |
QTest::mouse |
|
170 | QTest::mouseMove(m_view->viewport(), min + plotArea.topLeft().toPoint(), 100); | |
|
171 | QTest::mousePress(m_view->viewport(), Qt::LeftButton, 0, min + plotArea.topLeft().toPoint(), 100); | |||
|
172 | QTest::mouseMove(m_view->viewport(), plotArea.bottomRight().toPoint() - max, 100); | |||
|
173 | QTest::mouseRelease(m_view->viewport(), Qt::LeftButton, 0, plotArea.bottomRight().toPoint() - max, 100); | |||
|
174 | QApplication::processEvents(); | |||
173 |
|
175 | |||
174 | TRY_COMPARE(spy0.count(), Xcount); |
|
176 | TRY_COMPARE(spy0.count(), Xcount); | |
175 | TRY_COMPARE(spy1.count(), Ycount); |
|
177 | TRY_COMPARE(spy1.count(), Ycount); |
@@ -563,6 +563,13 void tst_qpieseries::hoverSignal() | |||||
563 | m_view->show(); |
|
563 | m_view->show(); | |
564 | QTest::qWaitForWindowShown(m_view); |
|
564 | QTest::qWaitForWindowShown(m_view); | |
565 |
|
565 | |||
|
566 | // try to ensure focus | |||
|
567 | QApplication::setActiveWindow(m_view); | |||
|
568 | m_view->setFocus(); | |||
|
569 | QApplication::processEvents(); | |||
|
570 | QVERIFY(m_view->isActiveWindow()); | |||
|
571 | QVERIFY(m_view->hasFocus()); | |||
|
572 | ||||
566 | // move inside the slices |
|
573 | // move inside the slices | |
567 | m_series->setPieSize(1.0); |
|
574 | m_series->setPieSize(1.0); | |
568 | QRectF pieRect = m_view->chart()->plotArea(); |
|
575 | QRectF pieRect = m_view->chart()->plotArea(); |
@@ -281,6 +281,13 void tst_qpieslice::hoverSignal() | |||||
281 | view.show(); |
|
281 | view.show(); | |
282 | QTest::qWaitForWindowShown(&view); |
|
282 | QTest::qWaitForWindowShown(&view); | |
283 |
|
283 | |||
|
284 | // try to ensure focus | |||
|
285 | QApplication::setActiveWindow(&view); | |||
|
286 | view.setFocus(); | |||
|
287 | QApplication::processEvents(); | |||
|
288 | QVERIFY(view.isActiveWindow()); | |||
|
289 | QVERIFY(view.hasFocus()); | |||
|
290 | ||||
284 | // move inside the slices |
|
291 | // move inside the slices | |
285 | series->setPieSize(1.0); |
|
292 | series->setPieSize(1.0); | |
286 | QRectF pieRect = view.chart()->plotArea(); |
|
293 | QRectF pieRect = view.chart()->plotArea(); |
General Comments 0
You need to be logged in to leave comments.
Login now