##// END OF EJS Templates
barseries mouse test fix
sauimone -
r1235:2f77897cdacd
parent child
Show More
@@ -443,7 +443,7 void tst_QBarSeries::mouseclicked()
443 series->append(set1);
443 series->append(set1);
444
444
445 QBarSet* set2 = new QBarSet(QString("set 2"));
445 QBarSet* set2 = new QBarSet(QString("set 2"));
446 *set2 << QPointF(0.5,10) << QPointF(1.5,10) << QPointF(2.5,10);
446 *set2 << QPointF(0.3,10) << QPointF(1.3,10) << QPointF(2.3,10);
447 series->append(set2);
447 series->append(set2);
448
448
449 QSignalSpy setSpy1(set1, SIGNAL(clicked(QString)));
449 QSignalSpy setSpy1(set1, SIGNAL(clicked(QString)));
@@ -458,7 +458,7 void tst_QBarSeries::mouseclicked()
458
458
459 //====================================================================================
459 //====================================================================================
460 // barset 1, category test1
460 // barset 1, category test1
461 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(75,180));
461 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(105,180));
462 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
462 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
463
463
464 QCOMPARE(setSpy1.count(), 1);
464 QCOMPARE(setSpy1.count(), 1);
@@ -473,7 +473,7 void tst_QBarSeries::mouseclicked()
473
473
474 //====================================================================================
474 //====================================================================================
475 // barset 1, category test2
475 // barset 1, category test2
476 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(160,180));
476 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(200,180));
477 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
477 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
478
478
479 QCOMPARE(setSpy1.count(), 1);
479 QCOMPARE(setSpy1.count(), 1);
@@ -488,7 +488,7 void tst_QBarSeries::mouseclicked()
488
488
489 //====================================================================================
489 //====================================================================================
490 // barset 1, category test3
490 // barset 1, category test3
491 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(255,180));
491 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(295,180));
492 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
492 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
493
493
494 QCOMPARE(setSpy1.count(), 1);
494 QCOMPARE(setSpy1.count(), 1);
@@ -503,7 +503,7 void tst_QBarSeries::mouseclicked()
503
503
504 //====================================================================================
504 //====================================================================================
505 // barset 2, category test1
505 // barset 2, category test1
506 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(115,180));
506 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(145,180));
507 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
507 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
508
508
509 QCOMPARE(setSpy1.count(), 0);
509 QCOMPARE(setSpy1.count(), 0);
@@ -518,7 +518,7 void tst_QBarSeries::mouseclicked()
518
518
519 //====================================================================================
519 //====================================================================================
520 // barset 2, category test2
520 // barset 2, category test2
521 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(205,180));
521 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(240,180));
522 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
522 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
523
523
524 QCOMPARE(setSpy1.count(), 0);
524 QCOMPARE(setSpy1.count(), 0);
@@ -533,7 +533,7 void tst_QBarSeries::mouseclicked()
533
533
534 //====================================================================================
534 //====================================================================================
535 // barset 2, category test3
535 // barset 2, category test3
536 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(300,180));
536 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(335,180));
537 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
537 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
538
538
539 QCOMPARE(setSpy1.count(), 0);
539 QCOMPARE(setSpy1.count(), 0);
@@ -550,12 +550,12 void tst_QBarSeries::mouseclicked()
550 // no event cases
550 // no event cases
551 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(1,1)); // Outside of both sets
551 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(1,1)); // Outside of both sets
552 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(1,1)); // Right mouse button outside and inside sets
552 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(1,1)); // Right mouse button outside and inside sets
553 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(75,180)); // barset 1, category test1
553 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(105,180)); // barset 1, category test1
554 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(160,180)); // barset 1, category test2
554 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(200,180)); // barset 1, category test2
555 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(255,180)); // barset 1, category test3
555 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(295,180)); // barset 1, category test3
556 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(115,180)); // barset 2, category test1
556 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(145,180)); // barset 2, category test1
557 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(205,180)); // barset 2, category test2
557 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(240,180)); // barset 2, category test2
558 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(300,180)); // barset 2, category test3
558 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(335,180)); // barset 2, category test3
559
559
560 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
560 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
561 QCOMPARE(setSpy1.count(), 0);
561 QCOMPARE(setSpy1.count(), 0);
@@ -580,7 +580,7 void tst_QBarSeries::mousehovered()
580 series->append(set1);
580 series->append(set1);
581
581
582 QBarSet* set2 = new QBarSet(QString("set 2"));
582 QBarSet* set2 = new QBarSet(QString("set 2"));
583 *set2 << QPointF(0.4,10) << QPointF(1.4,10) << QPointF(2.4,10);
583 *set2 << QPointF(0.3,10) << QPointF(1.3,10) << QPointF(2.3,10);
584 series->append(set2);
584 series->append(set2);
585
585
586 QSignalSpy setSpy1(set1, SIGNAL(hovered(bool)));
586 QSignalSpy setSpy1(set1, SIGNAL(hovered(bool)));
@@ -603,7 +603,7 void tst_QBarSeries::mousehovered()
603
603
604 //=======================================================================
604 //=======================================================================
605 // move mouse on top of set1
605 // move mouse on top of set1
606 QTest::mouseMove(view.viewport(), QPoint(75,180));
606 QTest::mouseMove(view.viewport(), QPoint(105,180));
607
607
608 QVERIFY(setSpy1.count() == 1);
608 QVERIFY(setSpy1.count() == 1);
609 QVERIFY(setSpy2.count() == 0);
609 QVERIFY(setSpy2.count() == 0);
@@ -618,7 +618,7 void tst_QBarSeries::mousehovered()
618
618
619 //=======================================================================
619 //=======================================================================
620 // move mouse from top of set1 to top of set2
620 // move mouse from top of set1 to top of set2
621 QTest::mouseMove(view.viewport(), QPoint(105,180));
621 QTest::mouseMove(view.viewport(), QPoint(145,180));
622
622
623 QVERIFY(setSpy1.count() == 1);
623 QVERIFY(setSpy1.count() == 1);
624 QVERIFY(setSpy2.count() == 1);
624 QVERIFY(setSpy2.count() == 1);
@@ -648,7 +648,7 void tst_QBarSeries::mousehovered()
648
648
649 //=======================================================================
649 //=======================================================================
650 // move mouse from top of set2 to background
650 // move mouse from top of set2 to background
651 QTest::mouseMove(view.viewport(), QPoint(135,180));
651 QTest::mouseMove(view.viewport(), QPoint(175,180));
652
652
653 QVERIFY(setSpy1.count() == 0);
653 QVERIFY(setSpy1.count() == 0);
654 QVERIFY(setSpy2.count() == 1);
654 QVERIFY(setSpy2.count() == 1);
@@ -126,7 +126,7 void tst_QGroupedBarSeries::mouseclicked()
126
126
127 //====================================================================================
127 //====================================================================================
128 // barset 1, category test1
128 // barset 1, category test1
129 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(100,180));
129 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(90,180));
130 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
130 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
131
131
132 QCOMPARE(setSpy1.count(), 1);
132 QCOMPARE(setSpy1.count(), 1);
@@ -141,7 +141,7 void tst_QGroupedBarSeries::mouseclicked()
141
141
142 //====================================================================================
142 //====================================================================================
143 // barset 1, category test2
143 // barset 1, category test2
144 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(190,180));
144 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(185,180));
145 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
145 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
146
146
147 QCOMPARE(setSpy1.count(), 1);
147 QCOMPARE(setSpy1.count(), 1);
@@ -171,7 +171,7 void tst_QGroupedBarSeries::mouseclicked()
171
171
172 //====================================================================================
172 //====================================================================================
173 // barset 2, category test1
173 // barset 2, category test1
174 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(130,180));
174 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(135,180));
175 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
175 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
176
176
177 QCOMPARE(setSpy1.count(), 0);
177 QCOMPARE(setSpy1.count(), 0);
@@ -186,7 +186,7 void tst_QGroupedBarSeries::mouseclicked()
186
186
187 //====================================================================================
187 //====================================================================================
188 // barset 2, category test2
188 // barset 2, category test2
189 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(220,180));
189 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(230,180));
190 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
190 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
191
191
192 QCOMPARE(setSpy1.count(), 0);
192 QCOMPARE(setSpy1.count(), 0);
@@ -201,7 +201,7 void tst_QGroupedBarSeries::mouseclicked()
201
201
202 //====================================================================================
202 //====================================================================================
203 // barset 2, category test3
203 // barset 2, category test3
204 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(310,180));
204 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(320,180));
205 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
205 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
206
206
207 QCOMPARE(setSpy1.count(), 0);
207 QCOMPARE(setSpy1.count(), 0);
@@ -218,12 +218,12 void tst_QGroupedBarSeries::mouseclicked()
218 // no event cases
218 // no event cases
219 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(1,1)); // Outside of both sets
219 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(1,1)); // Outside of both sets
220 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(1,1)); // Right mouse button outside and inside sets
220 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(1,1)); // Right mouse button outside and inside sets
221 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(100,180)); // barset 1, category test1
221 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(900,180)); // barset 1, category test1
222 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(190,180)); // barset 1, category test2
222 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(185,180)); // barset 1, category test2
223 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(280,180)); // barset 1, category test3
223 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(280,180)); // barset 1, category test3
224 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(130,180)); // barset 2, category test1
224 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(135,180)); // barset 2, category test1
225 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(220,180)); // barset 2, category test2
225 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(230,180)); // barset 2, category test2
226 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(310,180)); // barset 2, category test3
226 QTest::mouseClick(view.viewport(), Qt::RightButton, 0, QPoint(320,180)); // barset 2, category test3
227
227
228 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
228 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
229 QCOMPARE(setSpy1.count(), 0);
229 QCOMPARE(setSpy1.count(), 0);
@@ -260,13 +260,16 void tst_QGroupedBarSeries::mousehovered()
260 view.chart()->addSeries(series);
260 view.chart()->addSeries(series);
261 view.show();
261 view.show();
262 QTest::qWaitForWindowShown(&view);
262 QTest::qWaitForWindowShown(&view);
263 // QTest::qWait(1000*20);
263
264
264 //this is hack since view does not get events otherwise
265 //this is hack since view does not get events otherwise
265 view.setMouseTracking(true);
266 view.setMouseTracking(true);
266
267
267 //=======================================================================
268 //=======================================================================
268 // move mouse to left border
269 // move mouse to left border
270 qDebug() << "move mouse to left border";
269 QTest::mouseMove(view.viewport(), QPoint(0, 180));
271 QTest::mouseMove(view.viewport(), QPoint(0, 180));
272 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
270
273
271 QVERIFY(setSpy1.count() == 0);
274 QVERIFY(setSpy1.count() == 0);
272 QVERIFY(setSpy2.count() == 0);
275 QVERIFY(setSpy2.count() == 0);
@@ -274,7 +277,9 void tst_QGroupedBarSeries::mousehovered()
274
277
275 //=======================================================================
278 //=======================================================================
276 // move mouse on top of set1
279 // move mouse on top of set1
277 QTest::mouseMove(view.viewport(), QPoint(100,180));
280 qDebug() << "move mouse on top of set1";
281 QTest::mouseMove(view.viewport(), QPoint(90,180));
282 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
278
283
279 QVERIFY(setSpy1.count() == 1);
284 QVERIFY(setSpy1.count() == 1);
280 QVERIFY(setSpy2.count() == 0);
285 QVERIFY(setSpy2.count() == 0);
@@ -289,7 +294,9 void tst_QGroupedBarSeries::mousehovered()
289
294
290 //=======================================================================
295 //=======================================================================
291 // move mouse from top of set1 to top of set2
296 // move mouse from top of set1 to top of set2
292 QTest::mouseMove(view.viewport(), QPoint(130,180));
297 qDebug() << "move mouse from top of set1 to top of set2";
298 QTest::mouseMove(view.viewport(), QPoint(135,180));
299 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
293
300
294 QVERIFY(setSpy1.count() == 1);
301 QVERIFY(setSpy1.count() == 1);
295 QVERIFY(setSpy2.count() == 1);
302 QVERIFY(setSpy2.count() == 1);
@@ -319,7 +326,10 void tst_QGroupedBarSeries::mousehovered()
319
326
320 //=======================================================================
327 //=======================================================================
321 // move mouse from top of set2 to background
328 // move mouse from top of set2 to background
322 QTest::mouseMove(view.viewport(), QPoint(160,180));
329 qDebug() << "move mouse from top of set2 to background";
330
331 QTest::mouseMove(view.viewport(), QPoint(135,0));
332 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
323
333
324 QVERIFY(setSpy1.count() == 0);
334 QVERIFY(setSpy1.count() == 0);
325 QVERIFY(setSpy2.count() == 1);
335 QVERIFY(setSpy2.count() == 1);
General Comments 0
You need to be logged in to leave comments. Login now