##// END OF EJS Templates
Removed the old hovered signal from bar chart...
Titta Heikkala -
r2726:17ddbeb77815
parent child
Show More
@@ -162,10 +162,8 void AbstractBarChartItem::handleDataStructureChanged()
162 Bar *bar = new Bar(set, c, this);
162 Bar *bar = new Bar(set, c, this);
163 m_bars.append(bar);
163 m_bars.append(bar);
164 connect(bar, SIGNAL(clicked(int,QBarSet*)), m_series, SIGNAL(clicked(int,QBarSet*)));
164 connect(bar, SIGNAL(clicked(int,QBarSet*)), m_series, SIGNAL(clicked(int,QBarSet*)));
165 connect(bar, SIGNAL(hovered(bool,QBarSet*)), m_series, SIGNAL(hovered(bool,QBarSet*)));
166 connect(bar, SIGNAL(hovered(bool, int, QBarSet*)), m_series, SIGNAL(hovered(bool, int, QBarSet*)));
165 connect(bar, SIGNAL(hovered(bool, int, QBarSet*)), m_series, SIGNAL(hovered(bool, int, QBarSet*)));
167 connect(bar, SIGNAL(clicked(int,QBarSet*)), set, SIGNAL(clicked(int)));
166 connect(bar, SIGNAL(clicked(int,QBarSet*)), set, SIGNAL(clicked(int)));
168 connect(bar, SIGNAL(hovered(bool,QBarSet*)), set, SIGNAL(hovered(bool)));
169 connect(bar, SIGNAL(hovered(bool, int, QBarSet*)), set, SIGNAL(hovered(bool, int)));
167 connect(bar, SIGNAL(hovered(bool, int, QBarSet*)), set, SIGNAL(hovered(bool, int)));
170 // m_layout.append(QRectF(0, 0, 1, 1));
168 // m_layout.append(QRectF(0, 0, 1, 1));
171
169
@@ -36,10 +36,8 Bar::Bar(QBarSet *barset, int index, QGraphicsItem *parent) : QGraphicsRectItem(
36 Bar::~Bar()
36 Bar::~Bar()
37 {
37 {
38 // End hover event, if bar is deleted during it
38 // End hover event, if bar is deleted during it
39 if (m_hovering) {
39 if (m_hovering)
40 emit hovered(false, m_barset);
41 emit hovered(false, m_index, m_barset);
40 emit hovered(false, m_index, m_barset);
42 }
43 }
41 }
44
42
45 void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event)
43 void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event)
@@ -53,7 +51,6 void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
53 {
51 {
54 Q_UNUSED(event)
52 Q_UNUSED(event)
55 m_hovering = true;
53 m_hovering = true;
56 emit hovered(true, m_barset);
57 emit hovered(true, m_index, m_barset);
54 emit hovered(true, m_index, m_barset);
58
55
59 }
56 }
@@ -62,7 +59,6 void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
62 {
59 {
63 Q_UNUSED(event)
60 Q_UNUSED(event)
64 m_hovering = false;
61 m_hovering = false;
65 emit hovered(false, m_barset);
66 emit hovered(false, m_index, m_barset);
62 emit hovered(false, m_index, m_barset);
67 }
63 }
68
64
@@ -52,7 +52,6 public:
52
52
53 Q_SIGNALS:
53 Q_SIGNALS:
54 void clicked(int index, QBarSet *barset);
54 void clicked(int index, QBarSet *barset);
55 void hovered(bool status, QBarSet *barset);
56 void hovered(bool status, int index, QBarSet *barset);
55 void hovered(bool status, int index, QBarSet *barset);
57
56
58 private:
57 private:
@@ -211,14 +211,6 QT_CHARTS_BEGIN_NAMESPACE
211 */
211 */
212
212
213 /*!
213 /*!
214 \fn void QAbstractBarSeries::hovered(bool status, QBarSet* barset)
215
216 The signal is emitted if mouse is hovered on top of series.
217 Parameter \a barset is the pointer of barset, where hover happened.
218 Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series.
219 */
220
221 /*!
222 \fn void QAbstractBarSeries::hovered(bool status, int index, QBarSet* barset)
214 \fn void QAbstractBarSeries::hovered(bool status, int index, QBarSet* barset)
223
215
224 The signal is emitted if mouse is hovered on top of series.
216 The signal is emitted if mouse is hovered on top of series.
@@ -77,7 +77,6 protected:
77
77
78 Q_SIGNALS:
78 Q_SIGNALS:
79 void clicked(int index, QBarSet *barset);
79 void clicked(int index, QBarSet *barset);
80 void hovered(bool status, QBarSet *barset);
81 void hovered(bool status, int index, QBarSet *barset);
80 void hovered(bool status, int index, QBarSet *barset);
82 void countChanged();
81 void countChanged();
83 void labelsVisibleChanged();
82 void labelsVisibleChanged();
@@ -134,13 +134,6 QT_CHARTS_BEGIN_NAMESPACE
134 */
134 */
135
135
136 /*!
136 /*!
137 \fn void QBarSet::hovered(bool status)
138
139 The signal is emitted if mouse is hovered on top of bar set.
140 Parameter \a status is true, if mouse entered on top of bar set, false if mouse left from top of bar set.
141 */
142
143 /*!
144 \fn void QBarSet::hovered(bool status, int index)
137 \fn void QBarSet::hovered(bool status, int index)
145
138
146 The signal is emitted if mouse is hovered on top of bar set.
139 The signal is emitted if mouse is hovered on top of bar set.
@@ -84,7 +84,6 public:
84
84
85 Q_SIGNALS:
85 Q_SIGNALS:
86 void clicked(int index);
86 void clicked(int index);
87 void hovered(bool status);
88 void hovered(bool status, int index);
87 void hovered(bool status, int index);
89 void penChanged();
88 void penChanged();
90 void brushChanged();
89 void brushChanged();
@@ -610,10 +610,7 void tst_QBarSeries::mousehovered()
610 series->append(set2);
610 series->append(set2);
611 QList<QBarSet*> barSets = series->barSets();
611 QList<QBarSet*> barSets = series->barSets();
612
612
613 QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*)));
614 QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*)));
613 QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*)));
615 QSignalSpy setSpy1(set1, SIGNAL(hovered(bool)));
616 QSignalSpy setSpy2(set2, SIGNAL(hovered(bool)));
617 QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int)));
614 QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int)));
618 QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int)));
615 QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int)));
619
616
@@ -661,37 +658,22 void tst_QBarSeries::mousehovered()
661 // move mouse to left border
658 // move mouse to left border
662 QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y()));
659 QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y()));
663 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
660 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
664 TRY_COMPARE(seriesSpy.count(), 0);
665 TRY_COMPARE(seriesIndexSpy.count(), 0);
661 TRY_COMPARE(seriesIndexSpy.count(), 0);
666 TRY_COMPARE(setSpy1.count(), 0);
667 TRY_COMPARE(setSpy2.count(), 0);
668 TRY_COMPARE(setIndexSpy1.count(), 0);
662 TRY_COMPARE(setIndexSpy1.count(), 0);
669 TRY_COMPARE(setIndexSpy2.count(), 0);
663 TRY_COMPARE(setIndexSpy2.count(), 0);
670
664
671 //=======================================================================
665 //=======================================================================
672 // move mouse on top of set1
666 // move mouse on top of set1
673 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
667 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
674 TRY_COMPARE(seriesSpy.count(), 1);
675 TRY_COMPARE(seriesIndexSpy.count(), 1);
668 TRY_COMPARE(seriesIndexSpy.count(), 1);
676 TRY_COMPARE(setSpy1.count(), 1);
677 TRY_COMPARE(setSpy2.count(), 0);
678 TRY_COMPARE(setIndexSpy1.count(), 1);
669 TRY_COMPARE(setIndexSpy1.count(), 1);
679 TRY_COMPARE(setIndexSpy2.count(), 0);
670 TRY_COMPARE(setIndexSpy2.count(), 0);
680
671
681 QList<QVariant> seriesSpyArg = seriesSpy.takeFirst();
682 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
683 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
684 QVERIFY(seriesSpyArg.at(0).toBool() == true);
685
686 QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst();
672 QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst();
687 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
673 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
688 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
674 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
689 QVERIFY(seriesIndexSpyArg.at(0).toBool() == true);
675 QVERIFY(seriesIndexSpyArg.at(0).toBool() == true);
690
676
691 QList<QVariant> setSpyArg = setSpy1.takeFirst();
692 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
693 QVERIFY(setSpyArg.at(0).toBool() == true);
694
695 QList<QVariant> setIndexSpyArg = setIndexSpy1.takeFirst();
677 QList<QVariant> setIndexSpyArg = setIndexSpy1.takeFirst();
696 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
678 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
697 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
679 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
@@ -699,47 +681,26 void tst_QBarSeries::mousehovered()
699 //=======================================================================
681 //=======================================================================
700 // move mouse from top of set1 to top of set2
682 // move mouse from top of set1 to top of set2
701 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
683 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
702 TRY_COMPARE(seriesSpy.count(), 2);
703 TRY_COMPARE(seriesIndexSpy.count(), 2);
684 TRY_COMPARE(seriesIndexSpy.count(), 2);
704 TRY_COMPARE(setSpy1.count(), 1);
705 TRY_COMPARE(setSpy2.count(), 1);
706 TRY_COMPARE(setIndexSpy1.count(), 1);
685 TRY_COMPARE(setIndexSpy1.count(), 1);
707 TRY_COMPARE(setIndexSpy2.count(), 1);
686 TRY_COMPARE(setIndexSpy2.count(), 1);
708
687
709 // should leave set1
688 // should leave set1
710 seriesSpyArg = seriesSpy.takeFirst();
711 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
712 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
713 QVERIFY(seriesSpyArg.at(0).toBool() == false);
714
715 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
689 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
716 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
690 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
717 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
691 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
718 QVERIFY(seriesIndexSpyArg.at(0).toBool() == false);
692 QVERIFY(seriesIndexSpyArg.at(0).toBool() == false);
719
693
720 setSpyArg = setSpy1.takeFirst();
721 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
722 QVERIFY(setSpyArg.at(0).toBool() == false);
723
724 setIndexSpyArg = setIndexSpy1.takeFirst();
694 setIndexSpyArg = setIndexSpy1.takeFirst();
725 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
695 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
726 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
696 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
727
697
728 // should enter set2
698 // should enter set2
729 seriesSpyArg = seriesSpy.takeFirst();
730 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
731 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
732 QVERIFY(seriesSpyArg.at(0).toBool() == true);
733
734 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
699 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
735 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
700 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
736 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
701 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
737 QVERIFY(seriesIndexSpyArg.at(0).toBool() == true);
702 QVERIFY(seriesIndexSpyArg.at(0).toBool() == true);
738
703
739 setSpyArg = setSpy2.takeFirst();
740 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
741 QVERIFY(setSpyArg.at(0).toBool() == true);
742
743 setIndexSpyArg = setIndexSpy2.takeFirst();
704 setIndexSpyArg = setIndexSpy2.takeFirst();
744 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
705 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
745 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
706 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
@@ -747,28 +708,16 void tst_QBarSeries::mousehovered()
747 //=======================================================================
708 //=======================================================================
748 // move mouse from top of set2 to background
709 // move mouse from top of set2 to background
749 QTest::mouseMove(view.viewport(), QPoint(layout.at(1).center().x(), 0));
710 QTest::mouseMove(view.viewport(), QPoint(layout.at(1).center().x(), 0));
750 TRY_COMPARE(seriesSpy.count(), 1);
751 TRY_COMPARE(seriesIndexSpy.count(), 1);
711 TRY_COMPARE(seriesIndexSpy.count(), 1);
752 TRY_COMPARE(setSpy1.count(), 0);
753 TRY_COMPARE(setSpy2.count(), 1);
754 TRY_COMPARE(setIndexSpy1.count(), 0);
712 TRY_COMPARE(setIndexSpy1.count(), 0);
755 TRY_COMPARE(setIndexSpy2.count(), 1);
713 TRY_COMPARE(setIndexSpy2.count(), 1);
756
714
757 // should leave set2
715 // should leave set2
758 seriesSpyArg = seriesSpy.takeFirst();
759 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
760 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
761 QVERIFY(seriesSpyArg.at(0).toBool() == false);
762
763 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
716 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
764 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
717 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
765 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
718 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
766 QVERIFY(seriesIndexSpyArg.at(0).toBool() == false);
719 QVERIFY(seriesIndexSpyArg.at(0).toBool() == false);
767
720
768 setSpyArg = setSpy2.takeFirst();
769 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
770 QVERIFY(setSpyArg.at(0).toBool() == false);
771
772 setIndexSpyArg = setIndexSpy2.takeFirst();
721 setIndexSpyArg = setIndexSpy2.takeFirst();
773 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
722 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
774 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
723 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
@@ -777,19 +726,11 void tst_QBarSeries::mousehovered()
777 // move mouse on top of set1, bar0 to check the index (hover into set1)
726 // move mouse on top of set1, bar0 to check the index (hover into set1)
778 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
727 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
779
728
780 TRY_COMPARE(seriesSpy.count(), 1);
781 TRY_COMPARE(seriesIndexSpy.count(), 1);
729 TRY_COMPARE(seriesIndexSpy.count(), 1);
782 TRY_COMPARE(setSpy1.count(), 1);
783 TRY_COMPARE(setSpy2.count(), 0);
784 TRY_COMPARE(setIndexSpy1.count(), 1);
730 TRY_COMPARE(setIndexSpy1.count(), 1);
785 TRY_COMPARE(setIndexSpy2.count(), 0);
731 TRY_COMPARE(setIndexSpy2.count(), 0);
786
732
787 //should enter set1, bar0
733 //should enter set1, bar0
788 seriesSpyArg = seriesSpy.takeFirst();
789 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
790 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
791 QVERIFY(seriesSpyArg.at(0).toBool() == true);
792
793 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
734 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
794 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
735 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
795 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
736 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -797,10 +738,6 void tst_QBarSeries::mousehovered()
797 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
738 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
798 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
739 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
799
740
800 setSpyArg = setSpy1.takeFirst();
801 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
802 QVERIFY(setSpyArg.at(0).toBool() == true);
803
804 setIndexSpyArg = setIndexSpy1.takeFirst();
741 setIndexSpyArg = setIndexSpy1.takeFirst();
805 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
742 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
806 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
743 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
@@ -812,19 +749,11 void tst_QBarSeries::mousehovered()
812 // hover in set1)
749 // hover in set1)
813 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
750 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
814
751
815 TRY_COMPARE(seriesSpy.count(), 2);
816 TRY_COMPARE(seriesIndexSpy.count(), 2);
752 TRY_COMPARE(seriesIndexSpy.count(), 2);
817 TRY_COMPARE(setSpy1.count(), 1);
818 TRY_COMPARE(setSpy2.count(), 1);
819 TRY_COMPARE(setIndexSpy1.count(), 1);
753 TRY_COMPARE(setIndexSpy1.count(), 1);
820 TRY_COMPARE(setIndexSpy2.count(), 1);
754 TRY_COMPARE(setIndexSpy2.count(), 1);
821
755
822 // should leave set1, bar0
756 // should leave set1, bar0
823 seriesSpyArg = seriesSpy.takeFirst();
824 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
825 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
826 QVERIFY(seriesSpyArg.at(0).toBool() == false);
827
828 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
757 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
829 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
758 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
830 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
759 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -832,10 +761,6 void tst_QBarSeries::mousehovered()
832 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
761 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
833 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
762 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
834
763
835 setSpyArg = setSpy1.takeFirst();
836 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
837 QVERIFY(setSpyArg.at(0).toBool() == false);
838
839 setIndexSpyArg = setIndexSpy1.takeFirst();
764 setIndexSpyArg = setIndexSpy1.takeFirst();
840 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
765 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
841 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
766 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
@@ -843,11 +768,6 void tst_QBarSeries::mousehovered()
843 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
768 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
844
769
845 // should enter set2, bar0
770 // should enter set2, bar0
846 seriesSpyArg = seriesSpy.takeFirst();
847 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
848 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
849 QVERIFY(seriesSpyArg.at(0).toBool() == true);
850
851 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
771 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
852 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
772 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
853 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
773 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -855,10 +775,6 void tst_QBarSeries::mousehovered()
855 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
775 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
856 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
776 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
857
777
858 setSpyArg = setSpy2.takeFirst();
859 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
860 QVERIFY(setSpyArg.at(0).toBool() == true);
861
862 setIndexSpyArg = setIndexSpy2.takeFirst();
778 setIndexSpyArg = setIndexSpy2.takeFirst();
863 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
779 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
864 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
780 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
@@ -870,19 +786,11 void tst_QBarSeries::mousehovered()
870 // hover in set1)
786 // hover in set1)
871 QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint());
787 QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint());
872
788
873 TRY_COMPARE(seriesSpy.count(), 2);
874 TRY_COMPARE(seriesIndexSpy.count(), 2);
789 TRY_COMPARE(seriesIndexSpy.count(), 2);
875 TRY_COMPARE(setSpy1.count(), 1);
876 TRY_COMPARE(setSpy2.count(), 1);
877 TRY_COMPARE(setIndexSpy1.count(), 1);
790 TRY_COMPARE(setIndexSpy1.count(), 1);
878 TRY_COMPARE(setIndexSpy2.count(), 1);
791 TRY_COMPARE(setIndexSpy2.count(), 1);
879
792
880 // should leave set2, bar0
793 // should leave set2, bar0
881 seriesSpyArg = seriesSpy.takeFirst();
882 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
883 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
884 QVERIFY(seriesSpyArg.at(0).toBool() == false);
885
886 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
794 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
887 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
795 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
888 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
796 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -890,10 +798,6 void tst_QBarSeries::mousehovered()
890 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
798 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
891 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
799 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
892
800
893 setSpyArg = setSpy2.takeFirst();
894 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
895 QVERIFY(setSpyArg.at(0).toBool() == false);
896
897 setIndexSpyArg = setIndexSpy2.takeFirst();
801 setIndexSpyArg = setIndexSpy2.takeFirst();
898 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
802 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
899 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
803 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
@@ -901,11 +805,6 void tst_QBarSeries::mousehovered()
901 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
805 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
902
806
903 // should enter set1, bar1
807 // should enter set1, bar1
904 seriesSpyArg = seriesSpy.takeFirst();
905 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
906 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
907 QVERIFY(seriesSpyArg.at(0).toBool() == true);
908
909 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
808 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
910 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
809 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
911 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
810 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -913,10 +812,6 void tst_QBarSeries::mousehovered()
913 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
812 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
914 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
813 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
915
814
916 setSpyArg = setSpy1.takeFirst();
917 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
918 QVERIFY(setSpyArg.at(0).toBool() == true);
919
920 setIndexSpyArg = setIndexSpy1.takeFirst();
815 setIndexSpyArg = setIndexSpy1.takeFirst();
921 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
816 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
922 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
817 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
@@ -928,19 +823,11 void tst_QBarSeries::mousehovered()
928 // (hover out set1)
823 // (hover out set1)
929 QTest::mouseMove(view.viewport(), QPoint((layout.at(2).right() + layout.at(3).left()) / 2, 0));
824 QTest::mouseMove(view.viewport(), QPoint((layout.at(2).right() + layout.at(3).left()) / 2, 0));
930
825
931 TRY_COMPARE(seriesSpy.count(), 1);
932 TRY_COMPARE(seriesIndexSpy.count(), 1);
826 TRY_COMPARE(seriesIndexSpy.count(), 1);
933 TRY_COMPARE(setSpy1.count(), 1);
934 TRY_COMPARE(setSpy2.count(), 0);
935 TRY_COMPARE(setIndexSpy1.count(), 1);
827 TRY_COMPARE(setIndexSpy1.count(), 1);
936 TRY_COMPARE(setIndexSpy2.count(), 0);
828 TRY_COMPARE(setIndexSpy2.count(), 0);
937
829
938 // should leave set1, bar1
830 // should leave set1, bar1
939 seriesSpyArg = seriesSpy.takeFirst();
940 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
941 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
942 QVERIFY(seriesSpyArg.at(0).toBool() == false);
943
944 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
831 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
945 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
832 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
946 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
833 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -948,10 +835,6 void tst_QBarSeries::mousehovered()
948 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
835 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
949 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
836 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
950
837
951 setSpyArg = setSpy1.takeFirst();
952 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
953 QVERIFY(setSpyArg.at(0).toBool() == false);
954
955 setIndexSpyArg = setIndexSpy1.takeFirst();
838 setIndexSpyArg = setIndexSpy1.takeFirst();
956 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
839 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
957 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
840 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
@@ -962,19 +845,11 void tst_QBarSeries::mousehovered()
962 // move mouse on top of set2, bar1 to check the index (hover in set2)
845 // move mouse on top of set2, bar1 to check the index (hover in set2)
963 QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint());
846 QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint());
964
847
965 TRY_COMPARE(seriesSpy.count(), 1);
966 TRY_COMPARE(seriesIndexSpy.count(), 1);
848 TRY_COMPARE(seriesIndexSpy.count(), 1);
967 TRY_COMPARE(setSpy1.count(), 0);
968 TRY_COMPARE(setSpy2.count(), 1);
969 TRY_COMPARE(setIndexSpy1.count(), 0);
849 TRY_COMPARE(setIndexSpy1.count(), 0);
970 TRY_COMPARE(setIndexSpy2.count(), 1);
850 TRY_COMPARE(setIndexSpy2.count(), 1);
971
851
972 // should enter set2, bar1
852 // should enter set2, bar1
973 seriesSpyArg = seriesSpy.takeFirst();
974 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
975 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
976 QVERIFY(seriesSpyArg.at(0).toBool() == true);
977
978 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
853 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
979 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
854 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
980 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
855 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -982,10 +857,6 void tst_QBarSeries::mousehovered()
982 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
857 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
983 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
858 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
984
859
985 setSpyArg = setSpy2.takeFirst();
986 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
987 QVERIFY(setSpyArg.at(0).toBool() == true);
988
989 setIndexSpyArg = setIndexSpy2.takeFirst();
860 setIndexSpyArg = setIndexSpy2.takeFirst();
990 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
861 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
991 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
862 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
@@ -997,19 +868,11 void tst_QBarSeries::mousehovered()
997 //(hover out set2)
868 //(hover out set2)
998 QTest::mouseMove(view.viewport(), QPoint((layout.at(3).right() + layout.at(3).left()) / 2, 0));
869 QTest::mouseMove(view.viewport(), QPoint((layout.at(3).right() + layout.at(3).left()) / 2, 0));
999
870
1000 TRY_COMPARE(seriesSpy.count(), 1);
1001 TRY_COMPARE(seriesIndexSpy.count(), 1);
871 TRY_COMPARE(seriesIndexSpy.count(), 1);
1002 TRY_COMPARE(setSpy1.count(), 0);
1003 TRY_COMPARE(setSpy2.count(), 1);
1004 TRY_COMPARE(setIndexSpy1.count(), 0);
872 TRY_COMPARE(setIndexSpy1.count(), 0);
1005 TRY_COMPARE(setIndexSpy2.count(), 1);
873 TRY_COMPARE(setIndexSpy2.count(), 1);
1006
874
1007 // should leave set2, bar1
875 // should leave set2, bar1
1008 seriesSpyArg = seriesSpy.takeFirst();
1009 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
1010 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
1011 QVERIFY(seriesSpyArg.at(0).toBool() == false);
1012
1013 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
876 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
1014 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
877 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
1015 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
878 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -1017,10 +880,6 void tst_QBarSeries::mousehovered()
1017 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
880 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
1018 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
881 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
1019
882
1020 setSpyArg = setSpy2.takeFirst();
1021 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
1022 QVERIFY(setSpyArg.at(0).toBool() == false);
1023
1024 setIndexSpyArg = setIndexSpy2.takeFirst();
883 setIndexSpyArg = setIndexSpy2.takeFirst();
1025 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
884 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
1026 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
885 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
@@ -558,10 +558,7 void tst_QHorizontalBarSeries::mousehovered()
558
558
559 QList<QBarSet*> barSets = series->barSets();
559 QList<QBarSet*> barSets = series->barSets();
560
560
561 QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*)));
562 QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*)));
561 QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*)));
563 QSignalSpy setSpy1(set1, SIGNAL(hovered(bool)));
564 QSignalSpy setSpy2(set2, SIGNAL(hovered(bool)));
565 QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int)));
562 QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int)));
566 QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int)));
563 QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int)));
567
564
@@ -609,37 +606,22 void tst_QHorizontalBarSeries::mousehovered()
609 // move mouse to bottom border
606 // move mouse to bottom border
610 QTest::mouseMove(view.viewport(), QPoint(layout.at(0).center().x(), 300));
607 QTest::mouseMove(view.viewport(), QPoint(layout.at(0).center().x(), 300));
611 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
608 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
612 TRY_COMPARE(seriesSpy.count(), 0);
613 TRY_COMPARE(seriesIndexSpy.count(), 0);
609 TRY_COMPARE(seriesIndexSpy.count(), 0);
614 TRY_COMPARE(setSpy1.count(), 0);
615 TRY_COMPARE(setSpy2.count(), 0);
616 TRY_COMPARE(setIndexSpy1.count(), 0);
610 TRY_COMPARE(setIndexSpy1.count(), 0);
617 TRY_COMPARE(setIndexSpy2.count(), 0);
611 TRY_COMPARE(setIndexSpy2.count(), 0);
618
612
619 //=======================================================================
613 //=======================================================================
620 // move mouse on top of set1
614 // move mouse on top of set1
621 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
615 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
622 TRY_COMPARE(seriesSpy.count(), 1);
623 TRY_COMPARE(seriesIndexSpy.count(), 1);
616 TRY_COMPARE(seriesIndexSpy.count(), 1);
624 TRY_COMPARE(setSpy1.count(), 1);
625 TRY_COMPARE(setSpy2.count(), 0);
626 TRY_COMPARE(setIndexSpy1.count(), 1);
617 TRY_COMPARE(setIndexSpy1.count(), 1);
627 TRY_COMPARE(setIndexSpy2.count(), 0);
618 TRY_COMPARE(setIndexSpy2.count(), 0);
628
619
629 QList<QVariant> seriesSpyArg = seriesSpy.takeFirst();
630 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
631 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
632 QVERIFY(seriesSpyArg.at(0).toBool() == true);
633
634 QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst();
620 QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst();
635 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
621 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
636 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
622 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
637 QVERIFY(seriesIndexSpyArg.at(0).toBool() == true);
623 QVERIFY(seriesIndexSpyArg.at(0).toBool() == true);
638
624
639 QList<QVariant> setSpyArg = setSpy1.takeFirst();
640 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
641 QVERIFY(setSpyArg.at(0).toBool() == true);
642
643 QList<QVariant> setIndexSpyArg = setIndexSpy1.takeFirst();
625 QList<QVariant> setIndexSpyArg = setIndexSpy1.takeFirst();
644 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
626 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
645 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
627 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
@@ -647,47 +629,26 void tst_QHorizontalBarSeries::mousehovered()
647 //=======================================================================
629 //=======================================================================
648 // move mouse from top of set1 to top of set2
630 // move mouse from top of set1 to top of set2
649 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
631 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
650 TRY_COMPARE(seriesSpy.count(), 2);
651 TRY_COMPARE(seriesIndexSpy.count(), 2);
632 TRY_COMPARE(seriesIndexSpy.count(), 2);
652 TRY_COMPARE(setSpy1.count(), 1);
653 TRY_COMPARE(setSpy2.count(), 1);
654 TRY_COMPARE(setIndexSpy1.count(), 1);
633 TRY_COMPARE(setIndexSpy1.count(), 1);
655 TRY_COMPARE(setIndexSpy2.count(), 1);
634 TRY_COMPARE(setIndexSpy2.count(), 1);
656
635
657 // should leave set1
636 // should leave set1
658 seriesSpyArg = seriesSpy.takeFirst();
659 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
660 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
661 QVERIFY(seriesSpyArg.at(0).toBool() == false);
662
663 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
637 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
664 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
638 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
665 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
639 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
666 QVERIFY(seriesIndexSpyArg.at(0).toBool() == false);
640 QVERIFY(seriesIndexSpyArg.at(0).toBool() == false);
667
641
668 setSpyArg = setSpy1.takeFirst();
669 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
670 QVERIFY(setSpyArg.at(0).toBool() == false);
671
672 setIndexSpyArg = setIndexSpy1.takeFirst();
642 setIndexSpyArg = setIndexSpy1.takeFirst();
673 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
643 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
674 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
644 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
675
645
676 // should enter set2
646 // should enter set2
677 seriesSpyArg = seriesSpy.takeFirst();
678 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
679 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
680 QVERIFY(seriesSpyArg.at(0).toBool() == true);
681
682 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
647 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
683 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
648 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
684 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
649 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
685 QVERIFY(seriesIndexSpyArg.at(0).toBool() == true);
650 QVERIFY(seriesIndexSpyArg.at(0).toBool() == true);
686
651
687 setSpyArg = setSpy2.takeFirst();
688 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
689 QVERIFY(setSpyArg.at(0).toBool() == true);
690
691 setIndexSpyArg = setIndexSpy2.takeFirst();
652 setIndexSpyArg = setIndexSpy2.takeFirst();
692 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
653 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
693 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
654 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
@@ -695,28 +656,16 void tst_QHorizontalBarSeries::mousehovered()
695 //=======================================================================
656 //=======================================================================
696 // move mouse from top of set2 to background
657 // move mouse from top of set2 to background
697 QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y()));
658 QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y()));
698 TRY_COMPARE(seriesSpy.count(), 1);
699 TRY_COMPARE(seriesIndexSpy.count(), 1);
659 TRY_COMPARE(seriesIndexSpy.count(), 1);
700 TRY_COMPARE(setSpy1.count(), 0);
701 TRY_COMPARE(setSpy2.count(), 1);
702 TRY_COMPARE(setIndexSpy1.count(), 0);
660 TRY_COMPARE(setIndexSpy1.count(), 0);
703 TRY_COMPARE(setIndexSpy2.count(), 1);
661 TRY_COMPARE(setIndexSpy2.count(), 1);
704
662
705 // should leave set2
663 // should leave set2
706 seriesSpyArg = seriesSpy.takeFirst();
707 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
708 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
709 QVERIFY(seriesSpyArg.at(0).toBool() == false);
710
711 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
664 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
712 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
665 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
713 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
666 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
714 QVERIFY(seriesIndexSpyArg.at(0).toBool() == false);
667 QVERIFY(seriesIndexSpyArg.at(0).toBool() == false);
715
668
716 setSpyArg = setSpy2.takeFirst();
717 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
718 QVERIFY(setSpyArg.at(0).toBool() == false);
719
720 setIndexSpyArg = setIndexSpy2.takeFirst();
669 setIndexSpyArg = setIndexSpy2.takeFirst();
721 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
670 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
722 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
671 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
@@ -725,19 +674,11 void tst_QHorizontalBarSeries::mousehovered()
725 // move mouse on top of set1, bar0 to check the index (hover into set1)
674 // move mouse on top of set1, bar0 to check the index (hover into set1)
726 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
675 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
727
676
728 TRY_COMPARE(seriesSpy.count(), 1);
729 TRY_COMPARE(seriesIndexSpy.count(), 1);
677 TRY_COMPARE(seriesIndexSpy.count(), 1);
730 TRY_COMPARE(setSpy1.count(), 1);
731 TRY_COMPARE(setSpy2.count(), 0);
732 TRY_COMPARE(setIndexSpy1.count(), 1);
678 TRY_COMPARE(setIndexSpy1.count(), 1);
733 TRY_COMPARE(setIndexSpy2.count(), 0);
679 TRY_COMPARE(setIndexSpy2.count(), 0);
734
680
735 //should enter set1, bar0
681 //should enter set1, bar0
736 seriesSpyArg = seriesSpy.takeFirst();
737 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
738 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
739 QVERIFY(seriesSpyArg.at(0).toBool() == true);
740
741 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
682 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
742 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
683 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
743 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
684 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -745,10 +686,6 void tst_QHorizontalBarSeries::mousehovered()
745 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
686 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
746 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
687 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
747
688
748 setSpyArg = setSpy1.takeFirst();
749 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
750 QVERIFY(setSpyArg.at(0).toBool() == true);
751
752 setIndexSpyArg = setIndexSpy1.takeFirst();
689 setIndexSpyArg = setIndexSpy1.takeFirst();
753 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
690 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
754 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
691 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
@@ -760,19 +697,11 void tst_QHorizontalBarSeries::mousehovered()
760 // hover in set1)
697 // hover in set1)
761 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
698 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
762
699
763 TRY_COMPARE(seriesSpy.count(), 2);
764 TRY_COMPARE(seriesIndexSpy.count(), 2);
700 TRY_COMPARE(seriesIndexSpy.count(), 2);
765 TRY_COMPARE(setSpy1.count(), 1);
766 TRY_COMPARE(setSpy2.count(), 1);
767 TRY_COMPARE(setIndexSpy1.count(), 1);
701 TRY_COMPARE(setIndexSpy1.count(), 1);
768 TRY_COMPARE(setIndexSpy2.count(), 1);
702 TRY_COMPARE(setIndexSpy2.count(), 1);
769
703
770 // should leave set1, bar0
704 // should leave set1, bar0
771 seriesSpyArg = seriesSpy.takeFirst();
772 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
773 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
774 QVERIFY(seriesSpyArg.at(0).toBool() == false);
775
776 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
705 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
777 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
706 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
778 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
707 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -780,10 +709,6 void tst_QHorizontalBarSeries::mousehovered()
780 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
709 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
781 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
710 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
782
711
783 setSpyArg = setSpy1.takeFirst();
784 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
785 QVERIFY(setSpyArg.at(0).toBool() == false);
786
787 setIndexSpyArg = setIndexSpy1.takeFirst();
712 setIndexSpyArg = setIndexSpy1.takeFirst();
788 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
713 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
789 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
714 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
@@ -791,11 +716,6 void tst_QHorizontalBarSeries::mousehovered()
791 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
716 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
792
717
793 // should enter set2, bar0
718 // should enter set2, bar0
794 seriesSpyArg = seriesSpy.takeFirst();
795 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
796 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
797 QVERIFY(seriesSpyArg.at(0).toBool() == true);
798
799 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
719 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
800 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
720 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
801 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
721 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -803,10 +723,6 void tst_QHorizontalBarSeries::mousehovered()
803 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
723 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
804 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
724 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
805
725
806 setSpyArg = setSpy2.takeFirst();
807 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
808 QVERIFY(setSpyArg.at(0).toBool() == true);
809
810 setIndexSpyArg = setIndexSpy2.takeFirst();
726 setIndexSpyArg = setIndexSpy2.takeFirst();
811 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
727 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
812 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
728 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
@@ -818,19 +734,11 void tst_QHorizontalBarSeries::mousehovered()
818 // hover in set1)
734 // hover in set1)
819 QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint());
735 QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint());
820
736
821 TRY_COMPARE(seriesSpy.count(), 2);
822 TRY_COMPARE(seriesIndexSpy.count(), 2);
737 TRY_COMPARE(seriesIndexSpy.count(), 2);
823 TRY_COMPARE(setSpy1.count(), 1);
824 TRY_COMPARE(setSpy2.count(), 1);
825 TRY_COMPARE(setIndexSpy1.count(), 1);
738 TRY_COMPARE(setIndexSpy1.count(), 1);
826 TRY_COMPARE(setIndexSpy2.count(), 1);
739 TRY_COMPARE(setIndexSpy2.count(), 1);
827
740
828 // should leave set2, bar0
741 // should leave set2, bar0
829 seriesSpyArg = seriesSpy.takeFirst();
830 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
831 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
832 QVERIFY(seriesSpyArg.at(0).toBool() == false);
833
834 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
742 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
835 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
743 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
836 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
744 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -838,10 +746,6 void tst_QHorizontalBarSeries::mousehovered()
838 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
746 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
839 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
747 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0);
840
748
841 setSpyArg = setSpy2.takeFirst();
842 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
843 QVERIFY(setSpyArg.at(0).toBool() == false);
844
845 setIndexSpyArg = setIndexSpy2.takeFirst();
749 setIndexSpyArg = setIndexSpy2.takeFirst();
846 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
750 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
847 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
751 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
@@ -849,11 +753,6 void tst_QHorizontalBarSeries::mousehovered()
849 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
753 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
850
754
851 // should enter set1, bar1
755 // should enter set1, bar1
852 seriesSpyArg = seriesSpy.takeFirst();
853 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
854 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
855 QVERIFY(seriesSpyArg.at(0).toBool() == true);
856
857 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
756 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
858 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
757 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
859 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
758 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -861,10 +760,6 void tst_QHorizontalBarSeries::mousehovered()
861 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
760 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
862 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
761 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
863
762
864 setSpyArg = setSpy1.takeFirst();
865 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
866 QVERIFY(setSpyArg.at(0).toBool() == true);
867
868 setIndexSpyArg = setIndexSpy1.takeFirst();
763 setIndexSpyArg = setIndexSpy1.takeFirst();
869 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
764 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
870 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
765 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
@@ -876,19 +771,11 void tst_QHorizontalBarSeries::mousehovered()
876 // (hover out set1)
771 // (hover out set1)
877 QTest::mouseMove(view.viewport(), QPoint(0, (layout.at(2).top() + layout.at(3).bottom()) / 2));
772 QTest::mouseMove(view.viewport(), QPoint(0, (layout.at(2).top() + layout.at(3).bottom()) / 2));
878
773
879 TRY_COMPARE(seriesSpy.count(), 1);
880 TRY_COMPARE(seriesIndexSpy.count(), 1);
774 TRY_COMPARE(seriesIndexSpy.count(), 1);
881 TRY_COMPARE(setSpy1.count(), 1);
882 TRY_COMPARE(setSpy2.count(), 0);
883 TRY_COMPARE(setIndexSpy1.count(), 1);
775 TRY_COMPARE(setIndexSpy1.count(), 1);
884 TRY_COMPARE(setIndexSpy2.count(), 0);
776 TRY_COMPARE(setIndexSpy2.count(), 0);
885
777
886 // should leave set1, bar1
778 // should leave set1, bar1
887 seriesSpyArg = seriesSpy.takeFirst();
888 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
889 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
890 QVERIFY(seriesSpyArg.at(0).toBool() == false);
891
892 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
779 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
893 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
780 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
894 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
781 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -896,10 +783,6 void tst_QHorizontalBarSeries::mousehovered()
896 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
783 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
897 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
784 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
898
785
899 setSpyArg = setSpy1.takeFirst();
900 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
901 QVERIFY(setSpyArg.at(0).toBool() == false);
902
903 setIndexSpyArg = setIndexSpy1.takeFirst();
786 setIndexSpyArg = setIndexSpy1.takeFirst();
904 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
787 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
905 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
788 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
@@ -910,19 +793,11 void tst_QHorizontalBarSeries::mousehovered()
910 // move mouse on top of set2, bar1 to check the index (hover in set2)
793 // move mouse on top of set2, bar1 to check the index (hover in set2)
911 QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint());
794 QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint());
912
795
913 TRY_COMPARE(seriesSpy.count(), 1);
914 TRY_COMPARE(seriesIndexSpy.count(), 1);
796 TRY_COMPARE(seriesIndexSpy.count(), 1);
915 TRY_COMPARE(setSpy1.count(), 0);
916 TRY_COMPARE(setSpy2.count(), 1);
917 TRY_COMPARE(setIndexSpy1.count(), 0);
797 TRY_COMPARE(setIndexSpy1.count(), 0);
918 TRY_COMPARE(setIndexSpy2.count(), 1);
798 TRY_COMPARE(setIndexSpy2.count(), 1);
919
799
920 // should enter set2, bar1
800 // should enter set2, bar1
921 seriesSpyArg = seriesSpy.takeFirst();
922 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
923 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
924 QVERIFY(seriesSpyArg.at(0).toBool() == true);
925
926 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
801 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
927 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
802 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
928 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
803 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -930,10 +805,6 void tst_QHorizontalBarSeries::mousehovered()
930 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
805 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
931 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
806 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
932
807
933 setSpyArg = setSpy2.takeFirst();
934 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
935 QVERIFY(setSpyArg.at(0).toBool() == true);
936
937 setIndexSpyArg = setIndexSpy2.takeFirst();
808 setIndexSpyArg = setIndexSpy2.takeFirst();
938 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
809 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
939 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
810 QVERIFY(setIndexSpyArg.at(0).toBool() == true);
@@ -945,19 +816,11 void tst_QHorizontalBarSeries::mousehovered()
945 //(hover out set2)
816 //(hover out set2)
946 QTest::mouseMove(view.viewport(), QPoint(0, (layout.at(3).top() + layout.at(3).bottom()) / 2));
817 QTest::mouseMove(view.viewport(), QPoint(0, (layout.at(3).top() + layout.at(3).bottom()) / 2));
947
818
948 TRY_COMPARE(seriesSpy.count(), 1);
949 TRY_COMPARE(seriesIndexSpy.count(), 1);
819 TRY_COMPARE(seriesIndexSpy.count(), 1);
950 TRY_COMPARE(setSpy1.count(), 0);
951 TRY_COMPARE(setSpy2.count(), 1);
952 TRY_COMPARE(setIndexSpy1.count(), 0);
820 TRY_COMPARE(setIndexSpy1.count(), 0);
953 TRY_COMPARE(setIndexSpy2.count(), 1);
821 TRY_COMPARE(setIndexSpy2.count(), 1);
954
822
955 // should leave set2, bar1
823 // should leave set2, bar1
956 seriesSpyArg = seriesSpy.takeFirst();
957 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
958 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
959 QVERIFY(seriesSpyArg.at(0).toBool() == false);
960
961 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
824 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
962 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
825 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
963 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
826 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -965,10 +828,6 void tst_QHorizontalBarSeries::mousehovered()
965 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
828 QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int);
966 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
829 QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1);
967
830
968 setSpyArg = setSpy2.takeFirst();
969 QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
970 QVERIFY(setSpyArg.at(0).toBool() == false);
971
972 setIndexSpyArg = setIndexSpy2.takeFirst();
831 setIndexSpyArg = setIndexSpy2.takeFirst();
973 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
832 QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool);
974 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
833 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
@@ -306,7 +306,6 void tst_QHorizontalPercentBarSeries::mousehovered()
306
306
307 QList<QBarSet*> barSets = series->barSets();
307 QList<QBarSet*> barSets = series->barSets();
308
308
309 QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*)));
310 QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*)));
309 QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*)));
311 QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int)));
310 QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int)));
312 QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int)));
311 QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int)));
@@ -355,22 +354,15 void tst_QHorizontalPercentBarSeries::mousehovered()
355 // move mouse to left border
354 // move mouse to left border
356 QTest::mouseMove(view.viewport(), QPoint(0, layout.at(4).center().y()));
355 QTest::mouseMove(view.viewport(), QPoint(0, layout.at(4).center().y()));
357 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
356 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
358 TRY_COMPARE(seriesSpy.count(), 0);
359 TRY_COMPARE(seriesIndexSpy.count(), 0);
357 TRY_COMPARE(seriesIndexSpy.count(), 0);
360
358
361 //=======================================================================
359 //=======================================================================
362 // move mouse on top of set1
360 // move mouse on top of set1
363 QTest::mouseMove(view.viewport(), layout.at(4).center().toPoint());
361 QTest::mouseMove(view.viewport(), layout.at(4).center().toPoint());
364 TRY_COMPARE(seriesSpy.count(), 1);
365 TRY_COMPARE(seriesIndexSpy.count(), 1);
362 TRY_COMPARE(seriesIndexSpy.count(), 1);
366 TRY_COMPARE(setIndexSpy1.count(), 1);
363 TRY_COMPARE(setIndexSpy1.count(), 1);
367 TRY_COMPARE(setIndexSpy2.count(), 0);
364 TRY_COMPARE(setIndexSpy2.count(), 0);
368
365
369 QList<QVariant> seriesSpyArg = seriesSpy.takeFirst();
370 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
371 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
372 QVERIFY(seriesSpyArg.at(0).toBool() == true);
373
374 QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst();
366 QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst();
375 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
367 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
376 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
368 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -383,17 +375,11 void tst_QHorizontalPercentBarSeries::mousehovered()
383 //=======================================================================
375 //=======================================================================
384 // move mouse from top of set1 to top of set2
376 // move mouse from top of set1 to top of set2
385 QTest::mouseMove(view.viewport(), layout.at(5).center().toPoint());
377 QTest::mouseMove(view.viewport(), layout.at(5).center().toPoint());
386 TRY_COMPARE(seriesSpy.count(), 2);
387 TRY_COMPARE(seriesIndexSpy.count(), 2);
378 TRY_COMPARE(seriesIndexSpy.count(), 2);
388 TRY_COMPARE(setIndexSpy1.count(), 1);
379 TRY_COMPARE(setIndexSpy1.count(), 1);
389 TRY_COMPARE(setIndexSpy2.count(), 1);
380 TRY_COMPARE(setIndexSpy2.count(), 1);
390
381
391 // should leave set1
382 // should leave set1
392 seriesSpyArg = seriesSpy.takeFirst();
393 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
394 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
395 QVERIFY(seriesSpyArg.at(0).toBool() == false);
396
397 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
383 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
398 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
384 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
399 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
385 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -404,11 +390,6 void tst_QHorizontalPercentBarSeries::mousehovered()
404 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
390 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
405
391
406 // should enter set2
392 // should enter set2
407 seriesSpyArg = seriesSpy.takeFirst();
408 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
409 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
410 QVERIFY(seriesSpyArg.at(0).toBool() == true);
411
412 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
393 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
413 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
394 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
414 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
395 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -421,17 +402,11 void tst_QHorizontalPercentBarSeries::mousehovered()
421 //=======================================================================
402 //=======================================================================
422 // move mouse from top of set2 to background
403 // move mouse from top of set2 to background
423 QTest::mouseMove(view.viewport(), QPoint(layout.at(5).center().x(), 0));
404 QTest::mouseMove(view.viewport(), QPoint(layout.at(5).center().x(), 0));
424 TRY_COMPARE(seriesSpy.count(), 1);
425 TRY_COMPARE(seriesIndexSpy.count(), 1);
405 TRY_COMPARE(seriesIndexSpy.count(), 1);
426 TRY_COMPARE(setIndexSpy1.count(), 0);
406 TRY_COMPARE(setIndexSpy1.count(), 0);
427 TRY_COMPARE(setIndexSpy2.count(), 1);
407 TRY_COMPARE(setIndexSpy2.count(), 1);
428
408
429 // should leave set2
409 // should leave set2
430 seriesSpyArg = seriesSpy.takeFirst();
431 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
432 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
433 QVERIFY(seriesSpyArg.at(0).toBool() == false);
434
435 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
410 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
436 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
411 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
437 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
412 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -445,17 +420,11 void tst_QHorizontalPercentBarSeries::mousehovered()
445 // move mouse on top of set1, bar0 to check the index (hover into set1)
420 // move mouse on top of set1, bar0 to check the index (hover into set1)
446 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
421 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
447
422
448 TRY_COMPARE(seriesSpy.count(), 1);
449 TRY_COMPARE(seriesIndexSpy.count(), 1);
423 TRY_COMPARE(seriesIndexSpy.count(), 1);
450 TRY_COMPARE(setIndexSpy1.count(), 1);
424 TRY_COMPARE(setIndexSpy1.count(), 1);
451 TRY_COMPARE(setIndexSpy2.count(), 0);
425 TRY_COMPARE(setIndexSpy2.count(), 0);
452
426
453 //should enter set1, bar0
427 //should enter set1, bar0
454 seriesSpyArg = seriesSpy.takeFirst();
455 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
456 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
457 QVERIFY(seriesSpyArg.at(0).toBool() == true);
458
459 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
428 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
460 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
429 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
461 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
430 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -475,17 +444,11 void tst_QHorizontalPercentBarSeries::mousehovered()
475 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
444 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
476 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
445 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
477
446
478 TRY_COMPARE(seriesSpy.count(), 2);
479 TRY_COMPARE(seriesIndexSpy.count(), 2);
447 TRY_COMPARE(seriesIndexSpy.count(), 2);
480 TRY_COMPARE(setIndexSpy1.count(), 1);
448 TRY_COMPARE(setIndexSpy1.count(), 1);
481 TRY_COMPARE(setIndexSpy2.count(), 1);
449 TRY_COMPARE(setIndexSpy2.count(), 1);
482
450
483 //should leave set1, bar0
451 //should leave set1, bar0
484 seriesSpyArg = seriesSpy.takeFirst();
485 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
486 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
487 QVERIFY(seriesSpyArg.at(0).toBool() == false);
488
489 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
452 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
490 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
453 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
491 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
454 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -500,11 +463,6 void tst_QHorizontalPercentBarSeries::mousehovered()
500 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
463 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
501
464
502 //should enter set2, bar0
465 //should enter set2, bar0
503 seriesSpyArg = seriesSpy.takeFirst();
504 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
505 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
506 QVERIFY(seriesSpyArg.at(0).toBool() == true);
507
508 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
466 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
509 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
467 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
510 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
468 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -523,17 +481,11 void tst_QHorizontalPercentBarSeries::mousehovered()
523 // hover in set1)
481 // hover in set1)
524 QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint());
482 QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint());
525
483
526 TRY_COMPARE(seriesSpy.count(), 2);
527 TRY_COMPARE(seriesIndexSpy.count(), 2);
484 TRY_COMPARE(seriesIndexSpy.count(), 2);
528 TRY_COMPARE(setIndexSpy1.count(), 1);
485 TRY_COMPARE(setIndexSpy1.count(), 1);
529 TRY_COMPARE(setIndexSpy2.count(), 1);
486 TRY_COMPARE(setIndexSpy2.count(), 1);
530
487
531 //should leave set2, bar0
488 //should leave set2, bar0
532 seriesSpyArg = seriesSpy.takeFirst();
533 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
534 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
535 QVERIFY(seriesSpyArg.at(0).toBool() == false);
536
537 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
489 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
538 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
490 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
539 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
491 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -548,11 +500,6 void tst_QHorizontalPercentBarSeries::mousehovered()
548 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
500 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
549
501
550 //should enter set1, bar1
502 //should enter set1, bar1
551 seriesSpyArg = seriesSpy.takeFirst();
552 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
553 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
554 QVERIFY(seriesSpyArg.at(0).toBool() == true);
555
556 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
503 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
557 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
504 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
558 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
505 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -571,17 +518,11 void tst_QHorizontalPercentBarSeries::mousehovered()
571 QTest::mouseMove(view.viewport(), QPoint(layout.at(3).left(),
518 QTest::mouseMove(view.viewport(), QPoint(layout.at(3).left(),
572 (layout.at(3).top() + layout.at(4).bottom()) / 2));
519 (layout.at(3).top() + layout.at(4).bottom()) / 2));
573
520
574 TRY_COMPARE(seriesSpy.count(), 1);
575 TRY_COMPARE(seriesIndexSpy.count(), 1);
521 TRY_COMPARE(seriesIndexSpy.count(), 1);
576 TRY_COMPARE(setIndexSpy1.count(), 1);
522 TRY_COMPARE(setIndexSpy1.count(), 1);
577 TRY_COMPARE(setIndexSpy2.count(), 0);
523 TRY_COMPARE(setIndexSpy2.count(), 0);
578
524
579 //should leave set1, bar1
525 //should leave set1, bar1
580 seriesSpyArg = seriesSpy.takeFirst();
581 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
582 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
583 QVERIFY(seriesSpyArg.at(0).toBool() == false);
584
585 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
526 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
586 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
527 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
587 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
528 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -599,17 +540,11 void tst_QHorizontalPercentBarSeries::mousehovered()
599 // move mouse on top of set2, bar1 to check the index (hover in set2)
540 // move mouse on top of set2, bar1 to check the index (hover in set2)
600 QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint());
541 QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint());
601
542
602 TRY_COMPARE(seriesSpy.count(), 1);
603 TRY_COMPARE(seriesIndexSpy.count(), 1);
543 TRY_COMPARE(seriesIndexSpy.count(), 1);
604 TRY_COMPARE(setIndexSpy1.count(), 0);
544 TRY_COMPARE(setIndexSpy1.count(), 0);
605 TRY_COMPARE(setIndexSpy2.count(), 1);
545 TRY_COMPARE(setIndexSpy2.count(), 1);
606
546
607 //should enter set2, bar1
547 //should enter set2, bar1
608 seriesSpyArg = seriesSpy.takeFirst();
609 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
610 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
611 QVERIFY(seriesSpyArg.at(0).toBool() == true);
612
613 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
548 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
614 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
549 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
615 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
550 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -629,17 +564,11 void tst_QHorizontalPercentBarSeries::mousehovered()
629 (layout.at(3).top() + layout.at(4).bottom()) / 2));
564 (layout.at(3).top() + layout.at(4).bottom()) / 2));
630
565
631 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
566 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
632 TRY_COMPARE(seriesSpy.count(), 1);
633 TRY_COMPARE(seriesIndexSpy.count(), 1);
567 TRY_COMPARE(seriesIndexSpy.count(), 1);
634 TRY_COMPARE(setIndexSpy1.count(), 0);
568 TRY_COMPARE(setIndexSpy1.count(), 0);
635 TRY_COMPARE(setIndexSpy2.count(), 1);
569 TRY_COMPARE(setIndexSpy2.count(), 1);
636
570
637 //should leave set1, bar1
571 //should leave set1, bar1
638 seriesSpyArg = seriesSpy.takeFirst();
639 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
640 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
641 QVERIFY(seriesSpyArg.at(0).toBool() == false);
642
643 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
572 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
644 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
573 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
645 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
574 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -310,7 +310,6 void tst_QHorizontalStackedBarSeries::mousehovered()
310
310
311 QList<QBarSet*> barSets = series->barSets();
311 QList<QBarSet*> barSets = series->barSets();
312
312
313 QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*)));
314 QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*)));
313 QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*)));
315 QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int)));
314 QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int)));
316 QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int)));
315 QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int)));
@@ -364,22 +363,15 void tst_QHorizontalStackedBarSeries::mousehovered()
364 // move mouse to left border
363 // move mouse to left border
365 QTest::mouseMove(view.viewport(), QPoint(0, layout.at(4).center().y()));
364 QTest::mouseMove(view.viewport(), QPoint(0, layout.at(4).center().y()));
366 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
365 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
367 TRY_COMPARE(seriesSpy.count(), 0);
368 TRY_COMPARE(seriesIndexSpy.count(), 0);
366 TRY_COMPARE(seriesIndexSpy.count(), 0);
369
367
370 //=======================================================================
368 //=======================================================================
371 // move mouse on top of set1
369 // move mouse on top of set1
372 QTest::mouseMove(view.viewport(), layout.at(4).center().toPoint());
370 QTest::mouseMove(view.viewport(), layout.at(4).center().toPoint());
373 TRY_COMPARE(seriesSpy.count(), 1);
374 TRY_COMPARE(seriesIndexSpy.count(), 1);
371 TRY_COMPARE(seriesIndexSpy.count(), 1);
375 TRY_COMPARE(setIndexSpy1.count(), 1);
372 TRY_COMPARE(setIndexSpy1.count(), 1);
376 TRY_COMPARE(setIndexSpy2.count(), 0);
373 TRY_COMPARE(setIndexSpy2.count(), 0);
377
374
378 QList<QVariant> seriesSpyArg = seriesSpy.takeFirst();
379 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
380 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
381 QVERIFY(seriesSpyArg.at(0).toBool() == true);
382
383 QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst();
375 QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst();
384 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
376 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
385 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
377 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -392,17 +384,11 void tst_QHorizontalStackedBarSeries::mousehovered()
392 //=======================================================================
384 //=======================================================================
393 // move mouse from top of set1 to top of set2
385 // move mouse from top of set1 to top of set2
394 QTest::mouseMove(view.viewport(), layout.at(5).center().toPoint());
386 QTest::mouseMove(view.viewport(), layout.at(5).center().toPoint());
395 TRY_COMPARE(seriesSpy.count(), 2);
396 TRY_COMPARE(seriesIndexSpy.count(), 2);
387 TRY_COMPARE(seriesIndexSpy.count(), 2);
397 TRY_COMPARE(setIndexSpy1.count(), 1);
388 TRY_COMPARE(setIndexSpy1.count(), 1);
398 TRY_COMPARE(setIndexSpy2.count(), 1);
389 TRY_COMPARE(setIndexSpy2.count(), 1);
399
390
400 // should leave set1
391 // should leave set1
401 seriesSpyArg = seriesSpy.takeFirst();
402 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
403 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
404 QVERIFY(seriesSpyArg.at(0).toBool() == false);
405
406 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
392 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
407 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
393 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
408 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
394 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -413,11 +399,6 void tst_QHorizontalStackedBarSeries::mousehovered()
413 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
399 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
414
400
415 // should enter set2
401 // should enter set2
416 seriesSpyArg = seriesSpy.takeFirst();
417 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
418 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
419 QVERIFY(seriesSpyArg.at(0).toBool() == true);
420
421 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
402 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
422 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
403 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
423 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
404 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -430,17 +411,11 void tst_QHorizontalStackedBarSeries::mousehovered()
430 //=======================================================================
411 //=======================================================================
431 // move mouse from top of set2 to background
412 // move mouse from top of set2 to background
432 QTest::mouseMove(view.viewport(), QPoint(layout.at(5).center().y(), 0));
413 QTest::mouseMove(view.viewport(), QPoint(layout.at(5).center().y(), 0));
433 TRY_COMPARE(seriesSpy.count(), 1);
434 TRY_COMPARE(seriesIndexSpy.count(), 1);
414 TRY_COMPARE(seriesIndexSpy.count(), 1);
435 TRY_COMPARE(setIndexSpy1.count(), 0);
415 TRY_COMPARE(setIndexSpy1.count(), 0);
436 TRY_COMPARE(setIndexSpy2.count(), 1);
416 TRY_COMPARE(setIndexSpy2.count(), 1);
437
417
438 // should leave set2
418 // should leave set2
439 seriesSpyArg = seriesSpy.takeFirst();
440 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
441 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
442 QVERIFY(seriesSpyArg.at(0).toBool() == false);
443
444 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
419 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
445 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
420 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
446 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
421 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -454,17 +429,11 void tst_QHorizontalStackedBarSeries::mousehovered()
454 // move mouse on top of set1, bar0 to check the index (hover into set1)
429 // move mouse on top of set1, bar0 to check the index (hover into set1)
455 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
430 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
456
431
457 TRY_COMPARE(seriesSpy.count(), 1);
458 TRY_COMPARE(seriesIndexSpy.count(), 1);
432 TRY_COMPARE(seriesIndexSpy.count(), 1);
459 TRY_COMPARE(setIndexSpy1.count(), 1);
433 TRY_COMPARE(setIndexSpy1.count(), 1);
460 TRY_COMPARE(setIndexSpy2.count(), 0);
434 TRY_COMPARE(setIndexSpy2.count(), 0);
461
435
462 //should enter set1, bar0
436 //should enter set1, bar0
463 seriesSpyArg = seriesSpy.takeFirst();
464 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
465 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
466 QVERIFY(seriesSpyArg.at(0).toBool() == true);
467
468 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
437 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
469 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
438 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
470 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
439 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -484,17 +453,11 void tst_QHorizontalStackedBarSeries::mousehovered()
484 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
453 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
485 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
454 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
486
455
487 TRY_COMPARE(seriesSpy.count(), 2);
488 TRY_COMPARE(seriesIndexSpy.count(), 2);
456 TRY_COMPARE(seriesIndexSpy.count(), 2);
489 TRY_COMPARE(setIndexSpy1.count(), 1);
457 TRY_COMPARE(setIndexSpy1.count(), 1);
490 TRY_COMPARE(setIndexSpy2.count(), 1);
458 TRY_COMPARE(setIndexSpy2.count(), 1);
491
459
492 //should leave set1, bar0
460 //should leave set1, bar0
493 seriesSpyArg = seriesSpy.takeFirst();
494 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
495 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
496 QVERIFY(seriesSpyArg.at(0).toBool() == false);
497
498 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
461 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
499 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
462 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
500 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
463 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -509,11 +472,6 void tst_QHorizontalStackedBarSeries::mousehovered()
509 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
472 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
510
473
511 //should enter set2, bar0
474 //should enter set2, bar0
512 seriesSpyArg = seriesSpy.takeFirst();
513 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
514 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
515 QVERIFY(seriesSpyArg.at(0).toBool() == true);
516
517 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
475 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
518 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
476 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
519 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
477 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -532,17 +490,11 void tst_QHorizontalStackedBarSeries::mousehovered()
532 // hover in set1)
490 // hover in set1)
533 QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint());
491 QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint());
534
492
535 TRY_COMPARE(seriesSpy.count(), 2);
536 TRY_COMPARE(seriesIndexSpy.count(), 2);
493 TRY_COMPARE(seriesIndexSpy.count(), 2);
537 TRY_COMPARE(setIndexSpy1.count(), 1);
494 TRY_COMPARE(setIndexSpy1.count(), 1);
538 TRY_COMPARE(setIndexSpy2.count(), 1);
495 TRY_COMPARE(setIndexSpy2.count(), 1);
539
496
540 //should leave set2, bar0
497 //should leave set2, bar0
541 seriesSpyArg = seriesSpy.takeFirst();
542 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
543 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
544 QVERIFY(seriesSpyArg.at(0).toBool() == false);
545
546 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
498 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
547 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
499 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
548 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
500 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -557,11 +509,6 void tst_QHorizontalStackedBarSeries::mousehovered()
557 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
509 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
558
510
559 //should enter set1, bar1
511 //should enter set1, bar1
560 seriesSpyArg = seriesSpy.takeFirst();
561 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
562 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
563 QVERIFY(seriesSpyArg.at(0).toBool() == true);
564
565 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
512 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
566 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
513 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
567 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
514 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -580,17 +527,11 void tst_QHorizontalStackedBarSeries::mousehovered()
580 QTest::mouseMove(view.viewport(), QPoint(layout.at(3).left(),
527 QTest::mouseMove(view.viewport(), QPoint(layout.at(3).left(),
581 (layout.at(3).top() + layout.at(4).bottom()) / 2));
528 (layout.at(3).top() + layout.at(4).bottom()) / 2));
582
529
583 TRY_COMPARE(seriesSpy.count(), 1);
584 TRY_COMPARE(seriesIndexSpy.count(), 1);
530 TRY_COMPARE(seriesIndexSpy.count(), 1);
585 TRY_COMPARE(setIndexSpy1.count(), 1);
531 TRY_COMPARE(setIndexSpy1.count(), 1);
586 TRY_COMPARE(setIndexSpy2.count(), 0);
532 TRY_COMPARE(setIndexSpy2.count(), 0);
587
533
588 //should leave set1, bar1
534 //should leave set1, bar1
589 seriesSpyArg = seriesSpy.takeFirst();
590 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
591 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
592 QVERIFY(seriesSpyArg.at(0).toBool() == false);
593
594 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
535 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
595 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
536 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
596 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
537 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -608,17 +549,11 void tst_QHorizontalStackedBarSeries::mousehovered()
608 // move mouse on top of set2, bar1 to check the index (hover in set2)
549 // move mouse on top of set2, bar1 to check the index (hover in set2)
609 QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint());
550 QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint());
610
551
611 TRY_COMPARE(seriesSpy.count(), 1);
612 TRY_COMPARE(seriesIndexSpy.count(), 1);
552 TRY_COMPARE(seriesIndexSpy.count(), 1);
613 TRY_COMPARE(setIndexSpy1.count(), 0);
553 TRY_COMPARE(setIndexSpy1.count(), 0);
614 TRY_COMPARE(setIndexSpy2.count(), 1);
554 TRY_COMPARE(setIndexSpy2.count(), 1);
615
555
616 //should enter set2, bar1
556 //should enter set2, bar1
617 seriesSpyArg = seriesSpy.takeFirst();
618 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
619 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
620 QVERIFY(seriesSpyArg.at(0).toBool() == true);
621
622 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
557 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
623 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
558 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
624 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
559 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -638,17 +573,11 void tst_QHorizontalStackedBarSeries::mousehovered()
638 (layout.at(3).top() + layout.at(4).bottom()) / 2));
573 (layout.at(3).top() + layout.at(4).bottom()) / 2));
639
574
640 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
575 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
641 TRY_COMPARE(seriesSpy.count(), 1);
642 TRY_COMPARE(seriesIndexSpy.count(), 1);
576 TRY_COMPARE(seriesIndexSpy.count(), 1);
643 TRY_COMPARE(setIndexSpy1.count(), 0);
577 TRY_COMPARE(setIndexSpy1.count(), 0);
644 TRY_COMPARE(setIndexSpy2.count(), 1);
578 TRY_COMPARE(setIndexSpy2.count(), 1);
645
579
646 //should leave set1, bar1
580 //should leave set1, bar1
647 seriesSpyArg = seriesSpy.takeFirst();
648 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
649 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
650 QVERIFY(seriesSpyArg.at(0).toBool() == false);
651
652 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
581 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
653 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
582 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
654 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
583 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -308,7 +308,6 void tst_QPercentBarSeries::mousehovered()
308
308
309 QList<QBarSet*> barSets = series->barSets();
309 QList<QBarSet*> barSets = series->barSets();
310
310
311 QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*)));
312 QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*)));
311 QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*)));
313 QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int)));
312 QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int)));
314 QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int)));
313 QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int)));
@@ -359,22 +358,15 void tst_QPercentBarSeries::mousehovered()
359 // move mouse to left border
358 // move mouse to left border
360 QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y()));
359 QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y()));
361 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
360 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
362 TRY_COMPARE(seriesSpy.count(), 0);
363 TRY_COMPARE(seriesIndexSpy.count(), 0);
361 TRY_COMPARE(seriesIndexSpy.count(), 0);
364
362
365 //=======================================================================
363 //=======================================================================
366 // move mouse on top of set1
364 // move mouse on top of set1
367 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
365 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
368 TRY_COMPARE(seriesSpy.count(), 1);
369 TRY_COMPARE(seriesIndexSpy.count(), 1);
366 TRY_COMPARE(seriesIndexSpy.count(), 1);
370 TRY_COMPARE(setIndexSpy1.count(), 1);
367 TRY_COMPARE(setIndexSpy1.count(), 1);
371 TRY_COMPARE(setIndexSpy2.count(), 0);
368 TRY_COMPARE(setIndexSpy2.count(), 0);
372
369
373 QList<QVariant> seriesSpyArg = seriesSpy.takeFirst();
374 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
375 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
376 QVERIFY(seriesSpyArg.at(0).toBool() == true);
377
378 QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst();
370 QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst();
379 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
371 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
380 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
372 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -387,17 +379,11 void tst_QPercentBarSeries::mousehovered()
387 //=======================================================================
379 //=======================================================================
388 // move mouse from top of set1 to top of set2
380 // move mouse from top of set1 to top of set2
389 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
381 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
390 TRY_COMPARE(seriesSpy.count(), 2);
391 TRY_COMPARE(seriesIndexSpy.count(), 2);
382 TRY_COMPARE(seriesIndexSpy.count(), 2);
392 TRY_COMPARE(setIndexSpy1.count(), 1);
383 TRY_COMPARE(setIndexSpy1.count(), 1);
393 TRY_COMPARE(setIndexSpy2.count(), 1);
384 TRY_COMPARE(setIndexSpy2.count(), 1);
394
385
395 // should leave set1
386 // should leave set1
396 seriesSpyArg = seriesSpy.takeFirst();
397 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
398 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
399 QVERIFY(seriesSpyArg.at(0).toBool() == false);
400
401 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
387 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
402 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
388 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
403 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
389 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -408,11 +394,6 void tst_QPercentBarSeries::mousehovered()
408 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
394 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
409
395
410 // should enter set2
396 // should enter set2
411 seriesSpyArg = seriesSpy.takeFirst();
412 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
413 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
414 QVERIFY(seriesSpyArg.at(0).toBool() == true);
415
416 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
397 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
417 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
398 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
418 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
399 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -425,17 +406,11 void tst_QPercentBarSeries::mousehovered()
425 //=======================================================================
406 //=======================================================================
426 // move mouse from top of set2 to background
407 // move mouse from top of set2 to background
427 QTest::mouseMove(view.viewport(), QPoint(layout.at(1).center().x(), 0));
408 QTest::mouseMove(view.viewport(), QPoint(layout.at(1).center().x(), 0));
428 TRY_COMPARE(seriesSpy.count(), 1);
429 TRY_COMPARE(seriesIndexSpy.count(), 1);
409 TRY_COMPARE(seriesIndexSpy.count(), 1);
430 TRY_COMPARE(setIndexSpy1.count(), 0);
410 TRY_COMPARE(setIndexSpy1.count(), 0);
431 TRY_COMPARE(setIndexSpy2.count(), 1);
411 TRY_COMPARE(setIndexSpy2.count(), 1);
432
412
433 // should leave set2
413 // should leave set2
434 seriesSpyArg = seriesSpy.takeFirst();
435 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
436 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
437 QVERIFY(seriesSpyArg.at(0).toBool() == false);
438
439 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
414 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
440 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
415 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
441 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
416 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -449,17 +424,11 void tst_QPercentBarSeries::mousehovered()
449 // move mouse on top of set1, bar0 to check the index (hover into set1)
424 // move mouse on top of set1, bar0 to check the index (hover into set1)
450 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
425 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
451
426
452 TRY_COMPARE(seriesSpy.count(), 1);
453 TRY_COMPARE(seriesIndexSpy.count(), 1);
427 TRY_COMPARE(seriesIndexSpy.count(), 1);
454 TRY_COMPARE(setIndexSpy1.count(), 1);
428 TRY_COMPARE(setIndexSpy1.count(), 1);
455 TRY_COMPARE(setIndexSpy2.count(), 0);
429 TRY_COMPARE(setIndexSpy2.count(), 0);
456
430
457 //should enter set1, bar0
431 //should enter set1, bar0
458 seriesSpyArg = seriesSpy.takeFirst();
459 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
460 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
461 QVERIFY(seriesSpyArg.at(0).toBool() == true);
462
463 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
432 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
464 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
433 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
465 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
434 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -478,17 +447,11 void tst_QPercentBarSeries::mousehovered()
478 // hover in set2)
447 // hover in set2)
479 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
448 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
480
449
481 TRY_COMPARE(seriesSpy.count(), 2);
482 TRY_COMPARE(seriesIndexSpy.count(), 2);
450 TRY_COMPARE(seriesIndexSpy.count(), 2);
483 TRY_COMPARE(setIndexSpy1.count(), 1);
451 TRY_COMPARE(setIndexSpy1.count(), 1);
484 TRY_COMPARE(setIndexSpy2.count(), 1);
452 TRY_COMPARE(setIndexSpy2.count(), 1);
485
453
486 //should leave set1, bar0
454 //should leave set1, bar0
487 seriesSpyArg = seriesSpy.takeFirst();
488 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
489 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
490 QVERIFY(seriesSpyArg.at(0).toBool() == false);
491
492 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
455 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
493 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
456 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
494 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
457 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -503,11 +466,6 void tst_QPercentBarSeries::mousehovered()
503 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
466 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
504
467
505 //should enter set2, bar0
468 //should enter set2, bar0
506 seriesSpyArg = seriesSpy.takeFirst();
507 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
508 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
509 QVERIFY(seriesSpyArg.at(0).toBool() == true);
510
511 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
469 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
512 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
470 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
513 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
471 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -526,17 +484,11 void tst_QPercentBarSeries::mousehovered()
526 // hover in set1)
484 // hover in set1)
527 QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint());
485 QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint());
528
486
529 TRY_COMPARE(seriesSpy.count(), 2);
530 TRY_COMPARE(seriesIndexSpy.count(), 2);
487 TRY_COMPARE(seriesIndexSpy.count(), 2);
531 TRY_COMPARE(setIndexSpy1.count(), 1);
488 TRY_COMPARE(setIndexSpy1.count(), 1);
532 TRY_COMPARE(setIndexSpy2.count(), 1);
489 TRY_COMPARE(setIndexSpy2.count(), 1);
533
490
534 //should leave set2, bar0
491 //should leave set2, bar0
535 seriesSpyArg = seriesSpy.takeFirst();
536 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
537 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
538 QVERIFY(seriesSpyArg.at(0).toBool() == false);
539
540 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
492 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
541 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
493 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
542 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
494 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -551,11 +503,6 void tst_QPercentBarSeries::mousehovered()
551 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
503 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
552
504
553 //should enter set1, bar1
505 //should enter set1, bar1
554 seriesSpyArg = seriesSpy.takeFirst();
555 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
556 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
557 QVERIFY(seriesSpyArg.at(0).toBool() == true);
558
559 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
506 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
560 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
507 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
561 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
508 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -575,17 +522,11 void tst_QPercentBarSeries::mousehovered()
575 layout.at(2).top()));
522 layout.at(2).top()));
576
523
577 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
524 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
578 TRY_COMPARE(seriesSpy.count(), 1);
579 TRY_COMPARE(seriesIndexSpy.count(), 1);
525 TRY_COMPARE(seriesIndexSpy.count(), 1);
580 TRY_COMPARE(setIndexSpy1.count(), 1);
526 TRY_COMPARE(setIndexSpy1.count(), 1);
581 TRY_COMPARE(setIndexSpy2.count(), 0);
527 TRY_COMPARE(setIndexSpy2.count(), 0);
582
528
583 //should leave set1, bar1
529 //should leave set1, bar1
584 seriesSpyArg = seriesSpy.takeFirst();
585 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
586 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
587 QVERIFY(seriesSpyArg.at(0).toBool() == false);
588
589 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
530 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
590 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
531 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
591 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
532 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -603,17 +544,11 void tst_QPercentBarSeries::mousehovered()
603 // move mouse on top of set2, bar1 to check the index (hover in set2)
544 // move mouse on top of set2, bar1 to check the index (hover in set2)
604 QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint());
545 QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint());
605
546
606 TRY_COMPARE(seriesSpy.count(), 1);
607 TRY_COMPARE(seriesIndexSpy.count(), 1);
547 TRY_COMPARE(seriesIndexSpy.count(), 1);
608 TRY_COMPARE(setIndexSpy1.count(), 0);
548 TRY_COMPARE(setIndexSpy1.count(), 0);
609 TRY_COMPARE(setIndexSpy2.count(), 1);
549 TRY_COMPARE(setIndexSpy2.count(), 1);
610
550
611 //should enter set2, bar1
551 //should enter set2, bar1
612 seriesSpyArg = seriesSpy.takeFirst();
613 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
614 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
615 QVERIFY(seriesSpyArg.at(0).toBool() == true);
616
617 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
552 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
618 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
553 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
619 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
554 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -633,17 +568,11 void tst_QPercentBarSeries::mousehovered()
633 layout.at(2).top()));
568 layout.at(2).top()));
634
569
635 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
570 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
636 TRY_COMPARE(seriesSpy.count(), 1);
637 TRY_COMPARE(seriesIndexSpy.count(), 1);
571 TRY_COMPARE(seriesIndexSpy.count(), 1);
638 TRY_COMPARE(setIndexSpy1.count(), 0);
572 TRY_COMPARE(setIndexSpy1.count(), 0);
639 TRY_COMPARE(setIndexSpy2.count(), 1);
573 TRY_COMPARE(setIndexSpy2.count(), 1);
640
574
641 //should leave set1, bar1
575 //should leave set1, bar1
642 seriesSpyArg = seriesSpy.takeFirst();
643 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
644 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
645 QVERIFY(seriesSpyArg.at(0).toBool() == false);
646
647 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
576 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
648 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
577 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
649 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
578 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -310,7 +310,6 void tst_QStackedBarSeries::mousehovered()
310
310
311 QList<QBarSet*> barSets = series->barSets();
311 QList<QBarSet*> barSets = series->barSets();
312
312
313 QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*)));
314 QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*)));
313 QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*)));
315 QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int)));
314 QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int)));
316 QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int)));
315 QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int)));
@@ -365,22 +364,15 void tst_QStackedBarSeries::mousehovered()
365 // move mouse to left border
364 // move mouse to left border
366 QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y()));
365 QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y()));
367 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
366 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
368 TRY_COMPARE(seriesSpy.count(), 0);
369 TRY_COMPARE(seriesIndexSpy.count(), 0);
367 TRY_COMPARE(seriesIndexSpy.count(), 0);
370
368
371 //=======================================================================
369 //=======================================================================
372 // move mouse on top of set1
370 // move mouse on top of set1
373 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
371 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
374 TRY_COMPARE(seriesSpy.count(), 1);
375 TRY_COMPARE(seriesIndexSpy.count(), 1);
372 TRY_COMPARE(seriesIndexSpy.count(), 1);
376 TRY_COMPARE(setIndexSpy1.count(), 1);
373 TRY_COMPARE(setIndexSpy1.count(), 1);
377 TRY_COMPARE(setIndexSpy2.count(), 0);
374 TRY_COMPARE(setIndexSpy2.count(), 0);
378
375
379 QList<QVariant> seriesSpyArg = seriesSpy.takeFirst();
380 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
381 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
382 QVERIFY(seriesSpyArg.at(0).toBool() == true);
383
384 QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst();
376 QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst();
385 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
377 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
386 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
378 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -393,17 +385,11 void tst_QStackedBarSeries::mousehovered()
393 //=======================================================================
385 //=======================================================================
394 // move mouse from top of set1 to top of set2
386 // move mouse from top of set1 to top of set2
395 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
387 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
396 TRY_COMPARE(seriesSpy.count(), 2);
397 TRY_COMPARE(seriesIndexSpy.count(), 2);
388 TRY_COMPARE(seriesIndexSpy.count(), 2);
398 TRY_COMPARE(setIndexSpy1.count(), 1);
389 TRY_COMPARE(setIndexSpy1.count(), 1);
399 TRY_COMPARE(setIndexSpy2.count(), 1);
390 TRY_COMPARE(setIndexSpy2.count(), 1);
400
391
401 // should leave set1
392 // should leave set1
402 seriesSpyArg = seriesSpy.takeFirst();
403 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
404 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
405 QVERIFY(seriesSpyArg.at(0).toBool() == false);
406
407 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
393 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
408 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
394 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
409 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
395 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -414,11 +400,6 void tst_QStackedBarSeries::mousehovered()
414 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
400 QVERIFY(setIndexSpyArg.at(0).toBool() == false);
415
401
416 // should enter set2
402 // should enter set2
417 seriesSpyArg = seriesSpy.takeFirst();
418 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
419 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
420 QVERIFY(seriesSpyArg.at(0).toBool() == true);
421
422 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
403 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
423 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
404 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
424 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
405 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -431,17 +412,11 void tst_QStackedBarSeries::mousehovered()
431 //=======================================================================
412 //=======================================================================
432 // move mouse from top of set2 to background
413 // move mouse from top of set2 to background
433 QTest::mouseMove(view.viewport(), QPoint(layout.at(1).center().x(), 0));
414 QTest::mouseMove(view.viewport(), QPoint(layout.at(1).center().x(), 0));
434 TRY_COMPARE(seriesSpy.count(), 1);
435 TRY_COMPARE(seriesIndexSpy.count(), 1);
415 TRY_COMPARE(seriesIndexSpy.count(), 1);
436 TRY_COMPARE(setIndexSpy1.count(), 0);
416 TRY_COMPARE(setIndexSpy1.count(), 0);
437 TRY_COMPARE(setIndexSpy2.count(), 1);
417 TRY_COMPARE(setIndexSpy2.count(), 1);
438
418
439 // should leave set2
419 // should leave set2
440 seriesSpyArg = seriesSpy.takeFirst();
441 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
442 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
443 QVERIFY(seriesSpyArg.at(0).toBool() == false);
444
445 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
420 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
446 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
421 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
447 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
422 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -455,17 +430,11 void tst_QStackedBarSeries::mousehovered()
455 // move mouse on top of set1, bar0 to check the index (hover into set1)
430 // move mouse on top of set1, bar0 to check the index (hover into set1)
456 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
431 QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint());
457
432
458 TRY_COMPARE(seriesSpy.count(), 1);
459 TRY_COMPARE(seriesIndexSpy.count(), 1);
433 TRY_COMPARE(seriesIndexSpy.count(), 1);
460 TRY_COMPARE(setIndexSpy1.count(), 1);
434 TRY_COMPARE(setIndexSpy1.count(), 1);
461 TRY_COMPARE(setIndexSpy2.count(), 0);
435 TRY_COMPARE(setIndexSpy2.count(), 0);
462
436
463 //should enter set1, bar0
437 //should enter set1, bar0
464 seriesSpyArg = seriesSpy.takeFirst();
465 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
466 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
467 QVERIFY(seriesSpyArg.at(0).toBool() == true);
468
469 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
438 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
470 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
439 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
471 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
440 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -484,17 +453,11 void tst_QStackedBarSeries::mousehovered()
484 // hover in set2)
453 // hover in set2)
485 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
454 QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint());
486
455
487 TRY_COMPARE(seriesSpy.count(), 2);
488 TRY_COMPARE(seriesIndexSpy.count(), 2);
456 TRY_COMPARE(seriesIndexSpy.count(), 2);
489 TRY_COMPARE(setIndexSpy1.count(), 1);
457 TRY_COMPARE(setIndexSpy1.count(), 1);
490 TRY_COMPARE(setIndexSpy2.count(), 1);
458 TRY_COMPARE(setIndexSpy2.count(), 1);
491
459
492 //should leave set1, bar0
460 //should leave set1, bar0
493 seriesSpyArg = seriesSpy.takeFirst();
494 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
495 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
496 QVERIFY(seriesSpyArg.at(0).toBool() == false);
497
498 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
461 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
499 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
462 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
500 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
463 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -509,11 +472,6 void tst_QStackedBarSeries::mousehovered()
509 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
472 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
510
473
511 //should enter set2, bar0
474 //should enter set2, bar0
512 seriesSpyArg = seriesSpy.takeFirst();
513 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
514 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
515 QVERIFY(seriesSpyArg.at(0).toBool() == true);
516
517 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
475 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
518 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
476 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
519 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
477 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -532,17 +490,11 void tst_QStackedBarSeries::mousehovered()
532 // hover in set1)
490 // hover in set1)
533 QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint());
491 QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint());
534
492
535 TRY_COMPARE(seriesSpy.count(), 2);
536 TRY_COMPARE(seriesIndexSpy.count(), 2);
493 TRY_COMPARE(seriesIndexSpy.count(), 2);
537 TRY_COMPARE(setIndexSpy1.count(), 1);
494 TRY_COMPARE(setIndexSpy1.count(), 1);
538 TRY_COMPARE(setIndexSpy2.count(), 1);
495 TRY_COMPARE(setIndexSpy2.count(), 1);
539
496
540 //should leave set2, bar0
497 //should leave set2, bar0
541 seriesSpyArg = seriesSpy.takeFirst();
542 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
543 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
544 QVERIFY(seriesSpyArg.at(0).toBool() == false);
545
546 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
498 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
547 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
499 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
548 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
500 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -557,11 +509,6 void tst_QStackedBarSeries::mousehovered()
557 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
509 QVERIFY(setIndexSpyArg.at(1).toInt() == 0);
558
510
559 //should enter set1, bar1
511 //should enter set1, bar1
560 seriesSpyArg = seriesSpy.takeFirst();
561 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
562 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
563 QVERIFY(seriesSpyArg.at(0).toBool() == true);
564
565 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
512 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
566 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
513 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
567 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
514 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -581,17 +528,11 void tst_QStackedBarSeries::mousehovered()
581 layout.at(2).top()));
528 layout.at(2).top()));
582
529
583 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
530 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
584 TRY_COMPARE(seriesSpy.count(), 1);
585 TRY_COMPARE(seriesIndexSpy.count(), 1);
531 TRY_COMPARE(seriesIndexSpy.count(), 1);
586 TRY_COMPARE(setIndexSpy1.count(), 1);
532 TRY_COMPARE(setIndexSpy1.count(), 1);
587 TRY_COMPARE(setIndexSpy2.count(), 0);
533 TRY_COMPARE(setIndexSpy2.count(), 0);
588
534
589 //should leave set1, bar1
535 //should leave set1, bar1
590 seriesSpyArg = seriesSpy.takeFirst();
591 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1);
592 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
593 QVERIFY(seriesSpyArg.at(0).toBool() == false);
594
595 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
536 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
596 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
537 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1);
597 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
538 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -609,17 +550,11 void tst_QStackedBarSeries::mousehovered()
609 // move mouse on top of set2, bar1 to check the index (hover in set2)
550 // move mouse on top of set2, bar1 to check the index (hover in set2)
610 QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint());
551 QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint());
611
552
612 TRY_COMPARE(seriesSpy.count(), 1);
613 TRY_COMPARE(seriesIndexSpy.count(), 1);
553 TRY_COMPARE(seriesIndexSpy.count(), 1);
614 TRY_COMPARE(setIndexSpy1.count(), 0);
554 TRY_COMPARE(setIndexSpy1.count(), 0);
615 TRY_COMPARE(setIndexSpy2.count(), 1);
555 TRY_COMPARE(setIndexSpy2.count(), 1);
616
556
617 //should enter set2, bar1
557 //should enter set2, bar1
618 seriesSpyArg = seriesSpy.takeFirst();
619 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
620 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
621 QVERIFY(seriesSpyArg.at(0).toBool() == true);
622
623 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
558 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
624 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
559 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
625 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
560 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
@@ -639,17 +574,11 void tst_QStackedBarSeries::mousehovered()
639 layout.at(2).top()));
574 layout.at(2).top()));
640
575
641 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
576 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
642 TRY_COMPARE(seriesSpy.count(), 1);
643 TRY_COMPARE(seriesIndexSpy.count(), 1);
577 TRY_COMPARE(seriesIndexSpy.count(), 1);
644 TRY_COMPARE(setIndexSpy1.count(), 0);
578 TRY_COMPARE(setIndexSpy1.count(), 0);
645 TRY_COMPARE(setIndexSpy2.count(), 1);
579 TRY_COMPARE(setIndexSpy2.count(), 1);
646
580
647 //should leave set1, bar1
581 //should leave set1, bar1
648 seriesSpyArg = seriesSpy.takeFirst();
649 QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2);
650 QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool);
651 QVERIFY(seriesSpyArg.at(0).toBool() == false);
652
653 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
582 seriesIndexSpyArg = seriesIndexSpy.takeFirst();
654 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
583 QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2);
655 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
584 QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool);
General Comments 0
You need to be logged in to leave comments. Login now