@@ -160,8 +160,10 void AbstractBarChartItem::handleDataStructureChanged() | |||||
160 | m_bars.append(bar); |
|
160 | m_bars.append(bar); | |
161 | connect(bar, SIGNAL(clicked(int,QBarSet*)), m_series, SIGNAL(clicked(int,QBarSet*))); |
|
161 | connect(bar, SIGNAL(clicked(int,QBarSet*)), m_series, SIGNAL(clicked(int,QBarSet*))); | |
162 | connect(bar, SIGNAL(hovered(bool,QBarSet*)), m_series, SIGNAL(hovered(bool,QBarSet*))); |
|
162 | connect(bar, SIGNAL(hovered(bool,QBarSet*)), m_series, SIGNAL(hovered(bool,QBarSet*))); | |
|
163 | connect(bar, SIGNAL(hovered(bool, int, QBarSet*)), m_series, SIGNAL(hovered(bool, int, QBarSet*))); | |||
163 | connect(bar, SIGNAL(clicked(int,QBarSet*)), set, SIGNAL(clicked(int))); |
|
164 | connect(bar, SIGNAL(clicked(int,QBarSet*)), set, SIGNAL(clicked(int))); | |
164 | connect(bar, SIGNAL(hovered(bool,QBarSet*)), set, SIGNAL(hovered(bool))); |
|
165 | connect(bar, SIGNAL(hovered(bool,QBarSet*)), set, SIGNAL(hovered(bool))); | |
|
166 | connect(bar, SIGNAL(hovered(bool, int, QBarSet*)), set, SIGNAL(hovered(bool, int))); | |||
165 | // m_layout.append(QRectF(0, 0, 1, 1)); |
|
167 | // m_layout.append(QRectF(0, 0, 1, 1)); | |
166 |
|
168 | |||
167 | // Labels |
|
169 | // Labels |
@@ -38,6 +38,7 Bar::~Bar() | |||||
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); |
|
40 | emit hovered(false, m_barset); | |
|
41 | emit hovered(false, m_index, m_barset); | |||
41 | } |
|
42 | } | |
42 | } |
|
43 | } | |
43 |
|
44 | |||
@@ -53,6 +54,7 void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event) | |||||
53 | Q_UNUSED(event) |
|
54 | Q_UNUSED(event) | |
54 | m_hovering = true; |
|
55 | m_hovering = true; | |
55 | emit hovered(true, m_barset); |
|
56 | emit hovered(true, m_barset); | |
|
57 | emit hovered(true, m_index, m_barset); | |||
56 |
|
58 | |||
57 | } |
|
59 | } | |
58 |
|
60 | |||
@@ -61,6 +63,7 void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | |||||
61 | Q_UNUSED(event) |
|
63 | Q_UNUSED(event) | |
62 | m_hovering = false; |
|
64 | m_hovering = false; | |
63 | emit hovered(false, m_barset); |
|
65 | emit hovered(false, m_barset); | |
|
66 | emit hovered(false, m_index, m_barset); | |||
64 | } |
|
67 | } | |
65 |
|
68 | |||
66 | #include "moc_bar_p.cpp" |
|
69 | #include "moc_bar_p.cpp" |
@@ -53,6 +53,7 public: | |||||
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); |
|
55 | void hovered(bool status, QBarSet *barset); | |
|
56 | void hovered(bool status, int index, QBarSet *barset); | |||
56 |
|
57 | |||
57 | private: |
|
58 | private: | |
58 | int m_index; |
|
59 | int m_index; |
@@ -142,12 +142,22 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
142 | Parameter \a barset is the pointer of barset, where hover happened. |
|
142 | Parameter \a barset is the pointer of barset, where hover happened. | |
143 | Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. |
|
143 | Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. | |
144 | */ |
|
144 | */ | |
|
145 | ||||
|
146 | /*! | |||
|
147 | \fn void QAbstractBarSeries::hovered(bool status, int index, QBarSet* barset) | |||
|
148 | ||||
|
149 | The signal is emitted if mouse is hovered on top of series. | |||
|
150 | Parameter \a barset is the pointer of barset, where hover happened. | |||
|
151 | Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. | |||
|
152 | Hovered bar inside the set is indexed by \a index. | |||
|
153 | */ | |||
145 | /*! |
|
154 | /*! | |
146 | \qmlsignal AbstractBarSeries::onHovered(bool status, BarSet barset) |
|
155 | \qmlsignal AbstractBarSeries::onHovered(bool status, int index, BarSet barset) | |
147 |
|
156 | |||
148 | The signal is emitted if mouse is hovered on top of series. |
|
157 | The signal is emitted if mouse is hovered on top of series. | |
149 | Parameter \a barset is the pointer of barset, where hover happened. |
|
158 | Parameter \a barset is the pointer of barset, where hover happened. | |
150 | Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. |
|
159 | Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series. | |
|
160 | Hovered bar inside the set is indexed by \a index. | |||
151 | */ |
|
161 | */ | |
152 |
|
162 | |||
153 | /*! |
|
163 | /*! |
@@ -61,6 +61,7 protected: | |||||
61 | Q_SIGNALS: |
|
61 | Q_SIGNALS: | |
62 | void clicked(int index, QBarSet *barset); |
|
62 | void clicked(int index, QBarSet *barset); | |
63 | void hovered(bool status, QBarSet *barset); |
|
63 | void hovered(bool status, QBarSet *barset); | |
|
64 | void hovered(bool status, int index, QBarSet *barset); | |||
64 | void countChanged(); |
|
65 | void countChanged(); | |
65 | void labelsVisibleChanged(); |
|
66 | void labelsVisibleChanged(); | |
66 |
|
67 |
@@ -130,6 +130,14 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
130 | Parameter \a status is true, if mouse entered on top of bar set, false if mouse left from top of bar set. |
|
130 | Parameter \a status is true, if mouse entered on top of bar set, false if mouse left from top of bar set. | |
131 | */ |
|
131 | */ | |
132 |
|
132 | |||
|
133 | /*! | |||
|
134 | \fn void QBarSet::hovered(bool status, int index) | |||
|
135 | ||||
|
136 | The signal is emitted if mouse is hovered on top of bar set. | |||
|
137 | Parameter \a status is true, if mouse entered on top of bar set, false if mouse left from top of bar set. | |||
|
138 | Hovered bar inside the set is indexed by \a index. | |||
|
139 | */ | |||
|
140 | ||||
133 |
|
141 | |||
134 | /*! |
|
142 | /*! | |
135 | \fn void QBarSet::labelChanged() |
|
143 | \fn void QBarSet::labelChanged() |
@@ -85,6 +85,7 public: | |||||
85 | Q_SIGNALS: |
|
85 | Q_SIGNALS: | |
86 | void clicked(int index); |
|
86 | void clicked(int index); | |
87 | void hovered(bool status); |
|
87 | void hovered(bool status); | |
|
88 | void hovered(bool status, int index); | |||
88 | void penChanged(); |
|
89 | void penChanged(); | |
89 | void brushChanged(); |
|
90 | void brushChanged(); | |
90 | void labelChanged(); |
|
91 | void labelChanged(); |
@@ -553,8 +553,11 void tst_QBarSeries::mousehovered() | |||||
553 | QList<QBarSet*> barSets = series->barSets(); |
|
553 | QList<QBarSet*> barSets = series->barSets(); | |
554 |
|
554 | |||
555 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*))); |
|
555 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*))); | |
|
556 | QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*))); | |||
556 | QSignalSpy setSpy1(set1, SIGNAL(hovered(bool))); |
|
557 | QSignalSpy setSpy1(set1, SIGNAL(hovered(bool))); | |
557 | QSignalSpy setSpy2(set2, SIGNAL(hovered(bool))); |
|
558 | QSignalSpy setSpy2(set2, SIGNAL(hovered(bool))); | |
|
559 | QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int))); | |||
|
560 | QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int))); | |||
558 |
|
561 | |||
559 | QChartView view(new QChart()); |
|
562 | QChartView view(new QChart()); | |
560 | view.resize(400,300); |
|
563 | view.resize(400,300); | |
@@ -601,31 +604,49 void tst_QBarSeries::mousehovered() | |||||
601 | QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y())); |
|
604 | QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y())); | |
602 | QCoreApplication::processEvents(QEventLoop::AllEvents, 10000); |
|
605 | QCoreApplication::processEvents(QEventLoop::AllEvents, 10000); | |
603 | TRY_COMPARE(seriesSpy.count(), 0); |
|
606 | TRY_COMPARE(seriesSpy.count(), 0); | |
|
607 | TRY_COMPARE(seriesIndexSpy.count(), 0); | |||
604 | TRY_COMPARE(setSpy1.count(), 0); |
|
608 | TRY_COMPARE(setSpy1.count(), 0); | |
605 | TRY_COMPARE(setSpy2.count(), 0); |
|
609 | TRY_COMPARE(setSpy2.count(), 0); | |
|
610 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
611 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
606 |
|
612 | |||
607 | //======================================================================= |
|
613 | //======================================================================= | |
608 | // move mouse on top of set1 |
|
614 | // move mouse on top of set1 | |
609 | QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint()); |
|
615 | QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint()); | |
610 | TRY_COMPARE(seriesSpy.count(), 1); |
|
616 | TRY_COMPARE(seriesSpy.count(), 1); | |
|
617 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
611 | TRY_COMPARE(setSpy1.count(), 1); |
|
618 | TRY_COMPARE(setSpy1.count(), 1); | |
612 | TRY_COMPARE(setSpy2.count(), 0); |
|
619 | TRY_COMPARE(setSpy2.count(), 0); | |
|
620 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
621 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
613 |
|
622 | |||
614 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); |
|
623 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); | |
615 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); |
|
624 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
616 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
625 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
617 | QVERIFY(seriesSpyArg.at(0).toBool() == true); |
|
626 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
618 |
|
627 | |||
|
628 | QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
629 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
630 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
631 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
632 | ||||
619 | QList<QVariant> setSpyArg = setSpy1.takeFirst(); |
|
633 | QList<QVariant> setSpyArg = setSpy1.takeFirst(); | |
620 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); |
|
634 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |
621 | QVERIFY(setSpyArg.at(0).toBool() == true); |
|
635 | QVERIFY(setSpyArg.at(0).toBool() == true); | |
622 |
|
636 | |||
|
637 | QList<QVariant> setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
638 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
639 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
640 | ||||
623 | //======================================================================= |
|
641 | //======================================================================= | |
624 | // move mouse from top of set1 to top of set2 |
|
642 | // move mouse from top of set1 to top of set2 | |
625 | QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint()); |
|
643 | QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint()); | |
626 | TRY_COMPARE(seriesSpy.count(), 2); |
|
644 | TRY_COMPARE(seriesSpy.count(), 2); | |
|
645 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
627 | TRY_COMPARE(setSpy1.count(), 1); |
|
646 | TRY_COMPARE(setSpy1.count(), 1); | |
628 | TRY_COMPARE(setSpy2.count(), 1); |
|
647 | TRY_COMPARE(setSpy2.count(), 1); | |
|
648 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
649 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
629 |
|
650 | |||
630 | // should leave set1 |
|
651 | // should leave set1 | |
631 | seriesSpyArg = seriesSpy.takeFirst(); |
|
652 | seriesSpyArg = seriesSpy.takeFirst(); | |
@@ -633,26 +654,47 void tst_QBarSeries::mousehovered() | |||||
633 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
654 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
634 | QVERIFY(seriesSpyArg.at(0).toBool() == false); |
|
655 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
635 |
|
656 | |||
|
657 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
658 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
659 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
660 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
661 | ||||
636 | setSpyArg = setSpy1.takeFirst(); |
|
662 | setSpyArg = setSpy1.takeFirst(); | |
637 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); |
|
663 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |
638 | QVERIFY(setSpyArg.at(0).toBool() == false); |
|
664 | QVERIFY(setSpyArg.at(0).toBool() == false); | |
639 |
|
665 | |||
|
666 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
667 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
668 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
669 | ||||
640 | // should enter set2 |
|
670 | // should enter set2 | |
641 | seriesSpyArg = seriesSpy.takeFirst(); |
|
671 | seriesSpyArg = seriesSpy.takeFirst(); | |
642 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); |
|
672 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
643 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
673 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
644 | QVERIFY(seriesSpyArg.at(0).toBool() == true); |
|
674 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
645 |
|
675 | |||
|
676 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
677 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
678 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
679 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
680 | ||||
646 | setSpyArg = setSpy2.takeFirst(); |
|
681 | setSpyArg = setSpy2.takeFirst(); | |
647 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); |
|
682 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |
648 | QVERIFY(setSpyArg.at(0).toBool() == true); |
|
683 | QVERIFY(setSpyArg.at(0).toBool() == true); | |
649 |
|
684 | |||
|
685 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
686 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
687 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
688 | ||||
650 | //======================================================================= |
|
689 | //======================================================================= | |
651 | // move mouse from top of set2 to background |
|
690 | // move mouse from top of set2 to background | |
652 | QTest::mouseMove(view.viewport(), QPoint(layout.at(1).center().x(), 0)); |
|
691 | QTest::mouseMove(view.viewport(), QPoint(layout.at(1).center().x(), 0)); | |
653 | TRY_COMPARE(seriesSpy.count(), 1); |
|
692 | TRY_COMPARE(seriesSpy.count(), 1); | |
|
693 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
654 | TRY_COMPARE(setSpy1.count(), 0); |
|
694 | TRY_COMPARE(setSpy1.count(), 0); | |
655 | TRY_COMPARE(setSpy2.count(), 1); |
|
695 | TRY_COMPARE(setSpy2.count(), 1); | |
|
696 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
697 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
656 |
|
698 | |||
657 | // should leave set2 |
|
699 | // should leave set2 | |
658 | seriesSpyArg = seriesSpy.takeFirst(); |
|
700 | seriesSpyArg = seriesSpy.takeFirst(); | |
@@ -660,9 +702,272 void tst_QBarSeries::mousehovered() | |||||
660 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
702 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
661 | QVERIFY(seriesSpyArg.at(0).toBool() == false); |
|
703 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
662 |
|
704 | |||
|
705 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
706 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
707 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
708 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
709 | ||||
|
710 | setSpyArg = setSpy2.takeFirst(); | |||
|
711 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
712 | QVERIFY(setSpyArg.at(0).toBool() == false); | |||
|
713 | ||||
|
714 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
715 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
716 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
717 | ||||
|
718 | //======================================================================= | |||
|
719 | // move mouse on top of set1, bar0 to check the index (hover into set1) | |||
|
720 | QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint()); | |||
|
721 | ||||
|
722 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
723 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
724 | TRY_COMPARE(setSpy1.count(), 1); | |||
|
725 | TRY_COMPARE(setSpy2.count(), 0); | |||
|
726 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
727 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
|
728 | ||||
|
729 | //should enter set1, bar0 | |||
|
730 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
731 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
732 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
733 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
734 | ||||
|
735 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
736 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
737 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
738 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
739 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
740 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
741 | ||||
|
742 | setSpyArg = setSpy1.takeFirst(); | |||
|
743 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
744 | QVERIFY(setSpyArg.at(0).toBool() == true); | |||
|
745 | ||||
|
746 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
747 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
748 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
749 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
750 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
751 | ||||
|
752 | //======================================================================= | |||
|
753 | // move mouse on top of set2, bar0 to check the index (hover out set1, | |||
|
754 | // hover in set1) | |||
|
755 | QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint()); | |||
|
756 | ||||
|
757 | TRY_COMPARE(seriesSpy.count(), 2); | |||
|
758 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
759 | TRY_COMPARE(setSpy1.count(), 1); | |||
|
760 | TRY_COMPARE(setSpy2.count(), 1); | |||
|
761 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
762 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
763 | ||||
|
764 | // should leave set1, bar0 | |||
|
765 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
766 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
767 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
768 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
769 | ||||
|
770 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
771 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
772 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
773 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
774 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
775 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
776 | ||||
|
777 | setSpyArg = setSpy1.takeFirst(); | |||
|
778 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
779 | QVERIFY(setSpyArg.at(0).toBool() == false); | |||
|
780 | ||||
|
781 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
782 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
783 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
784 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
785 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
786 | ||||
|
787 | // should enter set2, bar0 | |||
|
788 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
789 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
790 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
791 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
792 | ||||
|
793 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
794 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
795 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
796 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
797 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
798 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
799 | ||||
|
800 | setSpyArg = setSpy2.takeFirst(); | |||
|
801 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
802 | QVERIFY(setSpyArg.at(0).toBool() == true); | |||
|
803 | ||||
|
804 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
805 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
806 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
807 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
808 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
809 | ||||
|
810 | //======================================================================= | |||
|
811 | // move mouse on top of set1, bar1 to check the index (hover out set 2, | |||
|
812 | // hover in set1) | |||
|
813 | QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint()); | |||
|
814 | ||||
|
815 | TRY_COMPARE(seriesSpy.count(), 2); | |||
|
816 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
817 | TRY_COMPARE(setSpy1.count(), 1); | |||
|
818 | TRY_COMPARE(setSpy2.count(), 1); | |||
|
819 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
820 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
821 | ||||
|
822 | // should leave set2, bar0 | |||
|
823 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
824 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
825 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
826 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
827 | ||||
|
828 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
829 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
830 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
831 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
832 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
833 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
834 | ||||
663 | setSpyArg = setSpy2.takeFirst(); |
|
835 | setSpyArg = setSpy2.takeFirst(); | |
664 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); |
|
836 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |
665 | QVERIFY(setSpyArg.at(0).toBool() == false); |
|
837 | QVERIFY(setSpyArg.at(0).toBool() == false); | |
|
838 | ||||
|
839 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
840 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
841 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
842 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
843 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
844 | ||||
|
845 | // should enter set1, bar1 | |||
|
846 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
847 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
848 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
849 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
850 | ||||
|
851 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
852 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
853 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
854 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
855 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
856 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
857 | ||||
|
858 | setSpyArg = setSpy1.takeFirst(); | |||
|
859 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
860 | QVERIFY(setSpyArg.at(0).toBool() == true); | |||
|
861 | ||||
|
862 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
863 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
864 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
865 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
866 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
867 | ||||
|
868 | //======================================================================= | |||
|
869 | // move mouse on top of view between set1 and set2 to check the index | |||
|
870 | // (hover out set1) | |||
|
871 | QTest::mouseMove(view.viewport(), QPoint((layout.at(2).right() + layout.at(3).left()) / 2, 0)); | |||
|
872 | ||||
|
873 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
874 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
875 | TRY_COMPARE(setSpy1.count(), 1); | |||
|
876 | TRY_COMPARE(setSpy2.count(), 0); | |||
|
877 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
878 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
|
879 | ||||
|
880 | // should leave set1, bar1 | |||
|
881 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
882 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
883 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
884 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
885 | ||||
|
886 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
887 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
888 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
889 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
890 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
891 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
892 | ||||
|
893 | setSpyArg = setSpy1.takeFirst(); | |||
|
894 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
895 | QVERIFY(setSpyArg.at(0).toBool() == false); | |||
|
896 | ||||
|
897 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
898 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
899 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
900 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
901 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
902 | ||||
|
903 | //======================================================================= | |||
|
904 | // move mouse on top of set2, bar1 to check the index (hover in set2) | |||
|
905 | QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint()); | |||
|
906 | ||||
|
907 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
908 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
909 | TRY_COMPARE(setSpy1.count(), 0); | |||
|
910 | TRY_COMPARE(setSpy2.count(), 1); | |||
|
911 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
912 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
913 | ||||
|
914 | // should enter set2, bar1 | |||
|
915 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
916 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
917 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
918 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
919 | ||||
|
920 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
921 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
922 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
923 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
924 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
925 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
926 | ||||
|
927 | setSpyArg = setSpy2.takeFirst(); | |||
|
928 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
929 | QVERIFY(setSpyArg.at(0).toBool() == true); | |||
|
930 | ||||
|
931 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
932 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
933 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
934 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
935 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
936 | ||||
|
937 | //======================================================================= | |||
|
938 | // move mouse on top of the view between bar1 and bar2 to check the index | |||
|
939 | //(hover out set2) | |||
|
940 | QTest::mouseMove(view.viewport(), QPoint((layout.at(3).right() + layout.at(3).left()) / 2, 0)); | |||
|
941 | ||||
|
942 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
943 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
944 | TRY_COMPARE(setSpy1.count(), 0); | |||
|
945 | TRY_COMPARE(setSpy2.count(), 1); | |||
|
946 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
947 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
948 | ||||
|
949 | // should leave set2, bar1 | |||
|
950 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
951 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
952 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
953 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
954 | ||||
|
955 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
956 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
957 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
958 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
959 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
960 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
961 | ||||
|
962 | setSpyArg = setSpy2.takeFirst(); | |||
|
963 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
964 | QVERIFY(setSpyArg.at(0).toBool() == false); | |||
|
965 | ||||
|
966 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
967 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
968 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
969 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
970 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
666 | } |
|
971 | } | |
667 |
|
972 | |||
668 | void tst_QBarSeries::clearWithAnimations() |
|
973 | void tst_QBarSeries::clearWithAnimations() |
@@ -501,8 +501,11 void tst_QHorizontalBarSeries::mousehovered() | |||||
501 | QList<QBarSet*> barSets = series->barSets(); |
|
501 | QList<QBarSet*> barSets = series->barSets(); | |
502 |
|
502 | |||
503 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*))); |
|
503 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*))); | |
|
504 | QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*))); | |||
504 | QSignalSpy setSpy1(set1, SIGNAL(hovered(bool))); |
|
505 | QSignalSpy setSpy1(set1, SIGNAL(hovered(bool))); | |
505 | QSignalSpy setSpy2(set2, SIGNAL(hovered(bool))); |
|
506 | QSignalSpy setSpy2(set2, SIGNAL(hovered(bool))); | |
|
507 | QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int))); | |||
|
508 | QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int))); | |||
506 |
|
509 | |||
507 | QChartView view(new QChart()); |
|
510 | QChartView view(new QChart()); | |
508 | view.resize(400,300); |
|
511 | view.resize(400,300); | |
@@ -549,31 +552,49 void tst_QHorizontalBarSeries::mousehovered() | |||||
549 | QTest::mouseMove(view.viewport(), QPoint(layout.at(0).center().x(), 300)); |
|
552 | QTest::mouseMove(view.viewport(), QPoint(layout.at(0).center().x(), 300)); | |
550 | QCoreApplication::processEvents(QEventLoop::AllEvents, 10000); |
|
553 | QCoreApplication::processEvents(QEventLoop::AllEvents, 10000); | |
551 | TRY_COMPARE(seriesSpy.count(), 0); |
|
554 | TRY_COMPARE(seriesSpy.count(), 0); | |
|
555 | TRY_COMPARE(seriesIndexSpy.count(), 0); | |||
552 | TRY_COMPARE(setSpy1.count(), 0); |
|
556 | TRY_COMPARE(setSpy1.count(), 0); | |
553 | TRY_COMPARE(setSpy2.count(), 0); |
|
557 | TRY_COMPARE(setSpy2.count(), 0); | |
|
558 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
559 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
554 |
|
560 | |||
555 | //======================================================================= |
|
561 | //======================================================================= | |
556 | // move mouse on top of set1 |
|
562 | // move mouse on top of set1 | |
557 | QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint()); |
|
563 | QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint()); | |
558 | TRY_COMPARE(seriesSpy.count(), 1); |
|
564 | TRY_COMPARE(seriesSpy.count(), 1); | |
|
565 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
559 | TRY_COMPARE(setSpy1.count(), 1); |
|
566 | TRY_COMPARE(setSpy1.count(), 1); | |
560 | TRY_COMPARE(setSpy2.count(), 0); |
|
567 | TRY_COMPARE(setSpy2.count(), 0); | |
|
568 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
569 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
561 |
|
570 | |||
562 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); |
|
571 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); | |
563 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); |
|
572 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
564 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
573 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
565 | QVERIFY(seriesSpyArg.at(0).toBool() == true); |
|
574 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
566 |
|
575 | |||
|
576 | QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
577 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
578 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
579 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
580 | ||||
567 | QList<QVariant> setSpyArg = setSpy1.takeFirst(); |
|
581 | QList<QVariant> setSpyArg = setSpy1.takeFirst(); | |
568 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); |
|
582 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |
569 | QVERIFY(setSpyArg.at(0).toBool() == true); |
|
583 | QVERIFY(setSpyArg.at(0).toBool() == true); | |
570 |
|
584 | |||
|
585 | QList<QVariant> setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
586 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
587 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
588 | ||||
571 | //======================================================================= |
|
589 | //======================================================================= | |
572 | // move mouse from top of set1 to top of set2 |
|
590 | // move mouse from top of set1 to top of set2 | |
573 | QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint()); |
|
591 | QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint()); | |
574 | TRY_COMPARE(seriesSpy.count(), 2); |
|
592 | TRY_COMPARE(seriesSpy.count(), 2); | |
|
593 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
575 | TRY_COMPARE(setSpy1.count(), 1); |
|
594 | TRY_COMPARE(setSpy1.count(), 1); | |
576 | TRY_COMPARE(setSpy2.count(), 1); |
|
595 | TRY_COMPARE(setSpy2.count(), 1); | |
|
596 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
597 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
577 |
|
598 | |||
578 | // should leave set1 |
|
599 | // should leave set1 | |
579 | seriesSpyArg = seriesSpy.takeFirst(); |
|
600 | seriesSpyArg = seriesSpy.takeFirst(); | |
@@ -581,26 +602,47 void tst_QHorizontalBarSeries::mousehovered() | |||||
581 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
602 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
582 | QVERIFY(seriesSpyArg.at(0).toBool() == false); |
|
603 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
583 |
|
604 | |||
|
605 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
606 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
607 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
608 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
609 | ||||
584 | setSpyArg = setSpy1.takeFirst(); |
|
610 | setSpyArg = setSpy1.takeFirst(); | |
585 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); |
|
611 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |
586 | QVERIFY(setSpyArg.at(0).toBool() == false); |
|
612 | QVERIFY(setSpyArg.at(0).toBool() == false); | |
587 |
|
613 | |||
|
614 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
615 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
616 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
617 | ||||
588 | // should enter set2 |
|
618 | // should enter set2 | |
589 | seriesSpyArg = seriesSpy.takeFirst(); |
|
619 | seriesSpyArg = seriesSpy.takeFirst(); | |
590 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); |
|
620 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
591 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
621 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
592 | QVERIFY(seriesSpyArg.at(0).toBool() == true); |
|
622 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
593 |
|
623 | |||
|
624 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
625 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
626 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
627 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
628 | ||||
594 | setSpyArg = setSpy2.takeFirst(); |
|
629 | setSpyArg = setSpy2.takeFirst(); | |
595 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); |
|
630 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |
596 | QVERIFY(setSpyArg.at(0).toBool() == true); |
|
631 | QVERIFY(setSpyArg.at(0).toBool() == true); | |
597 |
|
632 | |||
|
633 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
634 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
635 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
636 | ||||
598 | //======================================================================= |
|
637 | //======================================================================= | |
599 | // move mouse from top of set2 to background |
|
638 | // move mouse from top of set2 to background | |
600 | QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y())); |
|
639 | QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y())); | |
601 | TRY_COMPARE(seriesSpy.count(), 1); |
|
640 | TRY_COMPARE(seriesSpy.count(), 1); | |
|
641 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
602 | TRY_COMPARE(setSpy1.count(), 0); |
|
642 | TRY_COMPARE(setSpy1.count(), 0); | |
603 | TRY_COMPARE(setSpy2.count(), 1); |
|
643 | TRY_COMPARE(setSpy2.count(), 1); | |
|
644 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
645 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
604 |
|
646 | |||
605 | // should leave set2 |
|
647 | // should leave set2 | |
606 | seriesSpyArg = seriesSpy.takeFirst(); |
|
648 | seriesSpyArg = seriesSpy.takeFirst(); | |
@@ -608,9 +650,272 void tst_QHorizontalBarSeries::mousehovered() | |||||
608 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
650 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
609 | QVERIFY(seriesSpyArg.at(0).toBool() == false); |
|
651 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
610 |
|
652 | |||
|
653 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
654 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
655 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
656 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
657 | ||||
|
658 | setSpyArg = setSpy2.takeFirst(); | |||
|
659 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
660 | QVERIFY(setSpyArg.at(0).toBool() == false); | |||
|
661 | ||||
|
662 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
663 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
664 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
665 | ||||
|
666 | //======================================================================= | |||
|
667 | // move mouse on top of set1, bar0 to check the index (hover into set1) | |||
|
668 | QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint()); | |||
|
669 | ||||
|
670 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
671 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
672 | TRY_COMPARE(setSpy1.count(), 1); | |||
|
673 | TRY_COMPARE(setSpy2.count(), 0); | |||
|
674 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
675 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
|
676 | ||||
|
677 | //should enter set1, bar0 | |||
|
678 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
679 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
680 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
681 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
682 | ||||
|
683 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
684 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
685 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
686 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
687 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
688 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
689 | ||||
|
690 | setSpyArg = setSpy1.takeFirst(); | |||
|
691 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
692 | QVERIFY(setSpyArg.at(0).toBool() == true); | |||
|
693 | ||||
|
694 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
695 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
696 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
697 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
698 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
699 | ||||
|
700 | //======================================================================= | |||
|
701 | // move mouse on top of set2, bar0 to check the index (hover out set1, | |||
|
702 | // hover in set1) | |||
|
703 | QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint()); | |||
|
704 | ||||
|
705 | TRY_COMPARE(seriesSpy.count(), 2); | |||
|
706 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
707 | TRY_COMPARE(setSpy1.count(), 1); | |||
|
708 | TRY_COMPARE(setSpy2.count(), 1); | |||
|
709 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
710 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
711 | ||||
|
712 | // should leave set1, bar0 | |||
|
713 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
714 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
715 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
716 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
717 | ||||
|
718 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
719 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
720 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
721 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
722 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
723 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
724 | ||||
|
725 | setSpyArg = setSpy1.takeFirst(); | |||
|
726 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
727 | QVERIFY(setSpyArg.at(0).toBool() == false); | |||
|
728 | ||||
|
729 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
730 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
731 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
732 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
733 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
734 | ||||
|
735 | // should enter set2, bar0 | |||
|
736 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
737 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
738 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
739 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
740 | ||||
|
741 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
742 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
743 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
744 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
745 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
746 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
747 | ||||
|
748 | setSpyArg = setSpy2.takeFirst(); | |||
|
749 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
750 | QVERIFY(setSpyArg.at(0).toBool() == true); | |||
|
751 | ||||
|
752 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
753 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
754 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
755 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
756 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
757 | ||||
|
758 | //======================================================================= | |||
|
759 | // move mouse on top of set1, bar1 to check the index (hover out set 2, | |||
|
760 | // hover in set1) | |||
|
761 | QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint()); | |||
|
762 | ||||
|
763 | TRY_COMPARE(seriesSpy.count(), 2); | |||
|
764 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
765 | TRY_COMPARE(setSpy1.count(), 1); | |||
|
766 | TRY_COMPARE(setSpy2.count(), 1); | |||
|
767 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
768 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
769 | ||||
|
770 | // should leave set2, bar0 | |||
|
771 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
772 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
773 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
774 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
775 | ||||
|
776 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
777 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
778 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
779 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
780 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
781 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
782 | ||||
611 | setSpyArg = setSpy2.takeFirst(); |
|
783 | setSpyArg = setSpy2.takeFirst(); | |
612 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); |
|
784 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |
613 | QVERIFY(setSpyArg.at(0).toBool() == false); |
|
785 | QVERIFY(setSpyArg.at(0).toBool() == false); | |
|
786 | ||||
|
787 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
788 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
789 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
790 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
791 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
792 | ||||
|
793 | // should enter set1, bar1 | |||
|
794 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
795 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
796 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
797 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
798 | ||||
|
799 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
800 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
801 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
802 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
803 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
804 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
805 | ||||
|
806 | setSpyArg = setSpy1.takeFirst(); | |||
|
807 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
808 | QVERIFY(setSpyArg.at(0).toBool() == true); | |||
|
809 | ||||
|
810 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
811 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
812 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
813 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
814 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
815 | ||||
|
816 | //======================================================================= | |||
|
817 | // move mouse on top of view between set1 and set2 to check the index | |||
|
818 | // (hover out set1) | |||
|
819 | QTest::mouseMove(view.viewport(), QPoint(0, (layout.at(2).top() + layout.at(3).bottom()) / 2)); | |||
|
820 | ||||
|
821 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
822 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
823 | TRY_COMPARE(setSpy1.count(), 1); | |||
|
824 | TRY_COMPARE(setSpy2.count(), 0); | |||
|
825 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
826 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
|
827 | ||||
|
828 | // should leave set1, bar1 | |||
|
829 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
830 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
831 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
832 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
833 | ||||
|
834 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
835 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
836 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
837 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
838 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
839 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
840 | ||||
|
841 | setSpyArg = setSpy1.takeFirst(); | |||
|
842 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
843 | QVERIFY(setSpyArg.at(0).toBool() == false); | |||
|
844 | ||||
|
845 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
846 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
847 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
848 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
849 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
850 | ||||
|
851 | //======================================================================= | |||
|
852 | // move mouse on top of set2, bar1 to check the index (hover in set2) | |||
|
853 | QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint()); | |||
|
854 | ||||
|
855 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
856 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
857 | TRY_COMPARE(setSpy1.count(), 0); | |||
|
858 | TRY_COMPARE(setSpy2.count(), 1); | |||
|
859 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
860 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
861 | ||||
|
862 | // should enter set2, bar1 | |||
|
863 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
864 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
865 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
866 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
867 | ||||
|
868 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
869 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
870 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
871 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
872 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
873 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
874 | ||||
|
875 | setSpyArg = setSpy2.takeFirst(); | |||
|
876 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
877 | QVERIFY(setSpyArg.at(0).toBool() == true); | |||
|
878 | ||||
|
879 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
880 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
881 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
882 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
883 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
884 | ||||
|
885 | //======================================================================= | |||
|
886 | // move mouse on top of the view between bar1 and bar2 to check the index | |||
|
887 | //(hover out set2) | |||
|
888 | QTest::mouseMove(view.viewport(), QPoint(0, (layout.at(3).top() + layout.at(3).bottom()) / 2)); | |||
|
889 | ||||
|
890 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
891 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
892 | TRY_COMPARE(setSpy1.count(), 0); | |||
|
893 | TRY_COMPARE(setSpy2.count(), 1); | |||
|
894 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
895 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
896 | ||||
|
897 | // should leave set2, bar1 | |||
|
898 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
899 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
900 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
901 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
902 | ||||
|
903 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
904 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
905 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
906 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
907 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
908 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
909 | ||||
|
910 | setSpyArg = setSpy2.takeFirst(); | |||
|
911 | QVERIFY(setSpyArg.at(0).type() == QVariant::Bool); | |||
|
912 | QVERIFY(setSpyArg.at(0).toBool() == false); | |||
|
913 | ||||
|
914 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
915 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
916 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
917 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
918 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
614 | } |
|
919 | } | |
615 |
|
920 | |||
616 | void tst_QHorizontalBarSeries::clearWithAnimations() |
|
921 | void tst_QHorizontalBarSeries::clearWithAnimations() |
@@ -248,6 +248,9 void tst_QHorizontalPercentBarSeries::mousehovered() | |||||
248 | QList<QBarSet*> barSets = series->barSets(); |
|
248 | QList<QBarSet*> barSets = series->barSets(); | |
249 |
|
249 | |||
250 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*))); |
|
250 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*))); | |
|
251 | QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*))); | |||
|
252 | QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int))); | |||
|
253 | QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int))); | |||
251 |
|
254 | |||
252 | QChartView view(new QChart()); |
|
255 | QChartView view(new QChart()); | |
253 | view.resize(400,300); |
|
256 | view.resize(400,300); | |
@@ -294,21 +297,37 void tst_QHorizontalPercentBarSeries::mousehovered() | |||||
294 | QTest::mouseMove(view.viewport(), QPoint(0, layout.at(4).center().y())); |
|
297 | QTest::mouseMove(view.viewport(), QPoint(0, layout.at(4).center().y())); | |
295 | QCoreApplication::processEvents(QEventLoop::AllEvents, 10000); |
|
298 | QCoreApplication::processEvents(QEventLoop::AllEvents, 10000); | |
296 | TRY_COMPARE(seriesSpy.count(), 0); |
|
299 | TRY_COMPARE(seriesSpy.count(), 0); | |
|
300 | TRY_COMPARE(seriesIndexSpy.count(), 0); | |||
297 |
|
301 | |||
298 | //======================================================================= |
|
302 | //======================================================================= | |
299 | // move mouse on top of set1 |
|
303 | // move mouse on top of set1 | |
300 | QTest::mouseMove(view.viewport(), layout.at(4).center().toPoint()); |
|
304 | QTest::mouseMove(view.viewport(), layout.at(4).center().toPoint()); | |
301 | TRY_COMPARE(seriesSpy.count(), 1); |
|
305 | TRY_COMPARE(seriesSpy.count(), 1); | |
|
306 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
307 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
308 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
302 |
|
309 | |||
303 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); |
|
310 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); | |
304 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); |
|
311 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
305 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
312 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
306 | QVERIFY(seriesSpyArg.at(0).toBool() == true); |
|
313 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
307 |
|
314 | |||
|
315 | QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
316 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
317 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
318 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
319 | ||||
|
320 | QList<QVariant> setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
321 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
322 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
323 | ||||
308 | //======================================================================= |
|
324 | //======================================================================= | |
309 | // move mouse from top of set1 to top of set2 |
|
325 | // move mouse from top of set1 to top of set2 | |
310 | QTest::mouseMove(view.viewport(), layout.at(5).center().toPoint()); |
|
326 | QTest::mouseMove(view.viewport(), layout.at(5).center().toPoint()); | |
311 | TRY_COMPARE(seriesSpy.count(), 2); |
|
327 | TRY_COMPARE(seriesSpy.count(), 2); | |
|
328 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
329 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
330 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
312 |
|
331 | |||
313 | // should leave set1 |
|
332 | // should leave set1 | |
314 | seriesSpyArg = seriesSpy.takeFirst(); |
|
333 | seriesSpyArg = seriesSpy.takeFirst(); | |
@@ -316,22 +335,264 void tst_QHorizontalPercentBarSeries::mousehovered() | |||||
316 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
335 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
317 | QVERIFY(seriesSpyArg.at(0).toBool() == false); |
|
336 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
318 |
|
337 | |||
|
338 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
339 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
340 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
341 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
342 | ||||
|
343 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
344 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
345 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
346 | ||||
319 | // should enter set2 |
|
347 | // should enter set2 | |
320 | seriesSpyArg = seriesSpy.takeFirst(); |
|
348 | seriesSpyArg = seriesSpy.takeFirst(); | |
321 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); |
|
349 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
322 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
350 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
323 | QVERIFY(seriesSpyArg.at(0).toBool() == true); |
|
351 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
324 |
|
352 | |||
|
353 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
354 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
355 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
356 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
357 | ||||
|
358 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
359 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
360 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
361 | ||||
325 | //======================================================================= |
|
362 | //======================================================================= | |
326 | // move mouse from top of set2 to background |
|
363 | // move mouse from top of set2 to background | |
327 | QTest::mouseMove(view.viewport(), QPoint(layout.at(5).center().x(), 0)); |
|
364 | QTest::mouseMove(view.viewport(), QPoint(layout.at(5).center().x(), 0)); | |
328 | TRY_COMPARE(seriesSpy.count(), 1); |
|
365 | TRY_COMPARE(seriesSpy.count(), 1); | |
|
366 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
367 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
368 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
329 |
|
369 | |||
330 | // should leave set2 |
|
370 | // should leave set2 | |
331 | seriesSpyArg = seriesSpy.takeFirst(); |
|
371 | seriesSpyArg = seriesSpy.takeFirst(); | |
332 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); |
|
372 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
333 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
373 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
334 | QVERIFY(seriesSpyArg.at(0).toBool() == false); |
|
374 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
|
375 | ||||
|
376 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
377 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
378 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
379 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
380 | ||||
|
381 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
382 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
383 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
384 | ||||
|
385 | //======================================================================= | |||
|
386 | // move mouse on top of set1, bar0 to check the index (hover into set1) | |||
|
387 | QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint()); | |||
|
388 | ||||
|
389 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
390 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
391 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
392 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
|
393 | ||||
|
394 | //should enter set1, bar0 | |||
|
395 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
396 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
397 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
398 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
399 | ||||
|
400 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
401 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
402 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
403 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
404 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
405 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
406 | ||||
|
407 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
408 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
409 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
410 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
411 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
412 | ||||
|
413 | //======================================================================= | |||
|
414 | // move mouse on top of set2, bar0 to check the index (hover out set1, | |||
|
415 | // hover in set2) | |||
|
416 | QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint()); | |||
|
417 | QCoreApplication::processEvents(QEventLoop::AllEvents, 10000); | |||
|
418 | ||||
|
419 | TRY_COMPARE(seriesSpy.count(), 2); | |||
|
420 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
421 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
422 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
423 | ||||
|
424 | //should leave set1, bar0 | |||
|
425 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
426 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
427 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
428 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
429 | ||||
|
430 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
431 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
432 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
433 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
434 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
435 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
436 | ||||
|
437 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
438 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
439 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
440 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
441 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
442 | ||||
|
443 | //should enter set2, bar0 | |||
|
444 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
445 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
446 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
447 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
448 | ||||
|
449 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
450 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
451 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
452 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
453 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
454 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
455 | ||||
|
456 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
457 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
458 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
459 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
460 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
461 | ||||
|
462 | //======================================================================= | |||
|
463 | // move mouse on top of set1, bar1 to check the index (hover out set2, | |||
|
464 | // hover in set1) | |||
|
465 | QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint()); | |||
|
466 | ||||
|
467 | TRY_COMPARE(seriesSpy.count(), 2); | |||
|
468 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
469 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
470 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
471 | ||||
|
472 | //should leave set2, bar0 | |||
|
473 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
474 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
475 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
476 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
477 | ||||
|
478 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
479 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
480 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
481 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
482 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
483 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
484 | ||||
|
485 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
486 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
487 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
488 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
489 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
490 | ||||
|
491 | //should enter set1, bar1 | |||
|
492 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
493 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
494 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
495 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
496 | ||||
|
497 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
498 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
499 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
500 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
501 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
502 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
503 | ||||
|
504 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
505 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
506 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
507 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
508 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
509 | ||||
|
510 | //======================================================================= | |||
|
511 | // move mouse between set1 and set2 (hover out set1) | |||
|
512 | QTest::mouseMove(view.viewport(), QPoint(layout.at(3).left(), | |||
|
513 | (layout.at(3).top() + layout.at(4).bottom()) / 2)); | |||
|
514 | ||||
|
515 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
516 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
517 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
518 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
|
519 | ||||
|
520 | //should leave set1, bar1 | |||
|
521 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
522 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
523 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
524 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
525 | ||||
|
526 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
527 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
528 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
529 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
530 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
531 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
532 | ||||
|
533 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
534 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
535 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
536 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
537 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
538 | ||||
|
539 | //======================================================================= | |||
|
540 | // move mouse on top of set2, bar1 to check the index (hover in set2) | |||
|
541 | QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint()); | |||
|
542 | ||||
|
543 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
544 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
545 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
546 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
547 | ||||
|
548 | //should enter set2, bar1 | |||
|
549 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
550 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
551 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
552 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
553 | ||||
|
554 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
555 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
556 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
557 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
558 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
559 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
560 | ||||
|
561 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
562 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
563 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
564 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
565 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
566 | ||||
|
567 | //======================================================================= | |||
|
568 | // move mouse between set1 and set2 (hover out set2) | |||
|
569 | QTest::mouseMove(view.viewport(), QPoint(layout.at(3).left(), | |||
|
570 | (layout.at(3).top() + layout.at(4).bottom()) / 2)); | |||
|
571 | ||||
|
572 | QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); | |||
|
573 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
574 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
575 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
576 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
577 | ||||
|
578 | //should leave set1, bar1 | |||
|
579 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
580 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
581 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
582 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
583 | ||||
|
584 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
585 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
586 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
587 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
588 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
589 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
590 | ||||
|
591 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
592 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
593 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
594 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
595 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
335 | } |
|
596 | } | |
336 |
|
597 | |||
337 | QTEST_MAIN(tst_QHorizontalPercentBarSeries) |
|
598 | QTEST_MAIN(tst_QHorizontalPercentBarSeries) |
@@ -253,6 +253,9 void tst_QHorizontalStackedBarSeries::mousehovered() | |||||
253 | QList<QBarSet*> barSets = series->barSets(); |
|
253 | QList<QBarSet*> barSets = series->barSets(); | |
254 |
|
254 | |||
255 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*))); |
|
255 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*))); | |
|
256 | QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*))); | |||
|
257 | QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int))); | |||
|
258 | QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int))); | |||
256 |
|
259 | |||
257 | QChartView view(new QChart()); |
|
260 | QChartView view(new QChart()); | |
258 | view.resize(400,300); |
|
261 | view.resize(400,300); | |
@@ -304,21 +307,37 void tst_QHorizontalStackedBarSeries::mousehovered() | |||||
304 | QTest::mouseMove(view.viewport(), QPoint(0, layout.at(4).center().y())); |
|
307 | QTest::mouseMove(view.viewport(), QPoint(0, layout.at(4).center().y())); | |
305 | QCoreApplication::processEvents(QEventLoop::AllEvents, 10000); |
|
308 | QCoreApplication::processEvents(QEventLoop::AllEvents, 10000); | |
306 | TRY_COMPARE(seriesSpy.count(), 0); |
|
309 | TRY_COMPARE(seriesSpy.count(), 0); | |
|
310 | TRY_COMPARE(seriesIndexSpy.count(), 0); | |||
307 |
|
311 | |||
308 | //======================================================================= |
|
312 | //======================================================================= | |
309 | // move mouse on top of set1 |
|
313 | // move mouse on top of set1 | |
310 | QTest::mouseMove(view.viewport(), layout.at(4).center().toPoint()); |
|
314 | QTest::mouseMove(view.viewport(), layout.at(4).center().toPoint()); | |
311 | TRY_COMPARE(seriesSpy.count(), 1); |
|
315 | TRY_COMPARE(seriesSpy.count(), 1); | |
|
316 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
317 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
318 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
312 |
|
319 | |||
313 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); |
|
320 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); | |
314 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); |
|
321 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
315 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
322 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
316 | QVERIFY(seriesSpyArg.at(0).toBool() == true); |
|
323 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
317 |
|
324 | |||
|
325 | QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
326 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
327 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
328 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
329 | ||||
|
330 | QList<QVariant> setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
331 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
332 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
333 | ||||
318 | //======================================================================= |
|
334 | //======================================================================= | |
319 | // move mouse from top of set1 to top of set2 |
|
335 | // move mouse from top of set1 to top of set2 | |
320 | QTest::mouseMove(view.viewport(), layout.at(5).center().toPoint()); |
|
336 | QTest::mouseMove(view.viewport(), layout.at(5).center().toPoint()); | |
321 | TRY_COMPARE(seriesSpy.count(), 2); |
|
337 | TRY_COMPARE(seriesSpy.count(), 2); | |
|
338 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
339 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
340 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
322 |
|
341 | |||
323 | // should leave set1 |
|
342 | // should leave set1 | |
324 | seriesSpyArg = seriesSpy.takeFirst(); |
|
343 | seriesSpyArg = seriesSpy.takeFirst(); | |
@@ -326,22 +345,264 void tst_QHorizontalStackedBarSeries::mousehovered() | |||||
326 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
345 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
327 | QVERIFY(seriesSpyArg.at(0).toBool() == false); |
|
346 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
328 |
|
347 | |||
|
348 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
349 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
350 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
351 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
352 | ||||
|
353 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
354 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
355 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
356 | ||||
329 | // should enter set2 |
|
357 | // should enter set2 | |
330 | seriesSpyArg = seriesSpy.takeFirst(); |
|
358 | seriesSpyArg = seriesSpy.takeFirst(); | |
331 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); |
|
359 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
332 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
360 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
333 | QVERIFY(seriesSpyArg.at(0).toBool() == true); |
|
361 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
334 |
|
362 | |||
|
363 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
364 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
365 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
366 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
367 | ||||
|
368 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
369 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
370 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
371 | ||||
335 | //======================================================================= |
|
372 | //======================================================================= | |
336 | // move mouse from top of set2 to background |
|
373 | // move mouse from top of set2 to background | |
337 | QTest::mouseMove(view.viewport(), QPoint(layout.at(5).center().y(), 0)); |
|
374 | QTest::mouseMove(view.viewport(), QPoint(layout.at(5).center().y(), 0)); | |
338 | TRY_COMPARE(seriesSpy.count(), 1); |
|
375 | TRY_COMPARE(seriesSpy.count(), 1); | |
|
376 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
377 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
378 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
339 |
|
379 | |||
340 | // should leave set2 |
|
380 | // should leave set2 | |
341 | seriesSpyArg = seriesSpy.takeFirst(); |
|
381 | seriesSpyArg = seriesSpy.takeFirst(); | |
342 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); |
|
382 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
343 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
383 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
344 | QVERIFY(seriesSpyArg.at(0).toBool() == false); |
|
384 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
|
385 | ||||
|
386 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
387 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
388 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
389 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
390 | ||||
|
391 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
392 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
393 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
394 | ||||
|
395 | //======================================================================= | |||
|
396 | // move mouse on top of set1, bar0 to check the index (hover into set1) | |||
|
397 | QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint()); | |||
|
398 | ||||
|
399 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
400 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
401 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
402 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
|
403 | ||||
|
404 | //should enter set1, bar0 | |||
|
405 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
406 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
407 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
408 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
409 | ||||
|
410 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
411 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
412 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
413 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
414 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
415 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
416 | ||||
|
417 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
418 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
419 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
420 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
421 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
422 | ||||
|
423 | //======================================================================= | |||
|
424 | // move mouse on top of set2, bar0 to check the index (hover out set1, | |||
|
425 | // hover in set2) | |||
|
426 | QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint()); | |||
|
427 | QCoreApplication::processEvents(QEventLoop::AllEvents, 10000); | |||
|
428 | ||||
|
429 | TRY_COMPARE(seriesSpy.count(), 2); | |||
|
430 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
431 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
432 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
433 | ||||
|
434 | //should leave set1, bar0 | |||
|
435 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
436 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
437 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
438 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
439 | ||||
|
440 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
441 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
442 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
443 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
444 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
445 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
446 | ||||
|
447 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
448 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
449 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
450 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
451 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
452 | ||||
|
453 | //should enter set2, bar0 | |||
|
454 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
455 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
456 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
457 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
458 | ||||
|
459 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
460 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
461 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
462 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
463 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
464 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
465 | ||||
|
466 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
467 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
468 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
469 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
470 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
471 | ||||
|
472 | //======================================================================= | |||
|
473 | // move mouse on top of set1, bar1 to check the index (hover out set2, | |||
|
474 | // hover in set1) | |||
|
475 | QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint()); | |||
|
476 | ||||
|
477 | TRY_COMPARE(seriesSpy.count(), 2); | |||
|
478 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
479 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
480 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
481 | ||||
|
482 | //should leave set2, bar0 | |||
|
483 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
484 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
485 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
486 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
487 | ||||
|
488 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
489 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
490 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
491 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
492 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
493 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
494 | ||||
|
495 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
496 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
497 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
498 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
499 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
500 | ||||
|
501 | //should enter set1, bar1 | |||
|
502 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
503 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
504 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
505 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
506 | ||||
|
507 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
508 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
509 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
510 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
511 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
512 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
513 | ||||
|
514 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
515 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
516 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
517 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
518 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
519 | ||||
|
520 | //======================================================================= | |||
|
521 | // move mouse between set1 and set2 (hover out set1) | |||
|
522 | QTest::mouseMove(view.viewport(), QPoint(layout.at(3).left(), | |||
|
523 | (layout.at(3).top() + layout.at(4).bottom()) / 2)); | |||
|
524 | ||||
|
525 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
526 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
527 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
528 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
|
529 | ||||
|
530 | //should leave set1, bar1 | |||
|
531 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
532 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
533 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
534 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
535 | ||||
|
536 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
537 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
538 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
539 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
540 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
541 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
542 | ||||
|
543 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
544 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
545 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
546 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
547 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
548 | ||||
|
549 | //======================================================================= | |||
|
550 | // move mouse on top of set2, bar1 to check the index (hover in set2) | |||
|
551 | QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint()); | |||
|
552 | ||||
|
553 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
554 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
555 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
556 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
557 | ||||
|
558 | //should enter set2, bar1 | |||
|
559 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
560 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
561 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
562 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
563 | ||||
|
564 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
565 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
566 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
567 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
568 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
569 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
570 | ||||
|
571 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
572 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
573 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
574 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
575 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
576 | ||||
|
577 | //======================================================================= | |||
|
578 | // move mouse between set1 and set2 (hover out set2) | |||
|
579 | QTest::mouseMove(view.viewport(), QPoint(layout.at(3).left(), | |||
|
580 | (layout.at(3).top() + layout.at(4).bottom()) / 2)); | |||
|
581 | ||||
|
582 | QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); | |||
|
583 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
584 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
585 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
586 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
587 | ||||
|
588 | //should leave set1, bar1 | |||
|
589 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
590 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
591 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
592 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
593 | ||||
|
594 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
595 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
596 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
597 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
598 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
599 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
600 | ||||
|
601 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
602 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
603 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
604 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
605 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
345 | } |
|
606 | } | |
346 |
|
607 | |||
347 | QTEST_MAIN(tst_QHorizontalStackedBarSeries) |
|
608 | QTEST_MAIN(tst_QHorizontalStackedBarSeries) |
@@ -250,6 +250,9 void tst_QPercentBarSeries::mousehovered() | |||||
250 | QList<QBarSet*> barSets = series->barSets(); |
|
250 | QList<QBarSet*> barSets = series->barSets(); | |
251 |
|
251 | |||
252 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*))); |
|
252 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*))); | |
|
253 | QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*))); | |||
|
254 | QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int))); | |||
|
255 | QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int))); | |||
253 |
|
256 | |||
254 | QChartView view(new QChart()); |
|
257 | QChartView view(new QChart()); | |
255 | view.resize(400,300); |
|
258 | view.resize(400,300); | |
@@ -298,21 +301,37 void tst_QPercentBarSeries::mousehovered() | |||||
298 | QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y())); |
|
301 | QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y())); | |
299 | QCoreApplication::processEvents(QEventLoop::AllEvents, 10000); |
|
302 | QCoreApplication::processEvents(QEventLoop::AllEvents, 10000); | |
300 | TRY_COMPARE(seriesSpy.count(), 0); |
|
303 | TRY_COMPARE(seriesSpy.count(), 0); | |
|
304 | TRY_COMPARE(seriesIndexSpy.count(), 0); | |||
301 |
|
305 | |||
302 | //======================================================================= |
|
306 | //======================================================================= | |
303 | // move mouse on top of set1 |
|
307 | // move mouse on top of set1 | |
304 | QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint()); |
|
308 | QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint()); | |
305 | TRY_COMPARE(seriesSpy.count(), 1); |
|
309 | TRY_COMPARE(seriesSpy.count(), 1); | |
|
310 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
311 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
312 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
306 |
|
313 | |||
307 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); |
|
314 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); | |
308 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); |
|
315 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
309 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
316 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
310 | QVERIFY(seriesSpyArg.at(0).toBool() == true); |
|
317 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
311 |
|
318 | |||
|
319 | QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
320 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
321 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
322 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
323 | ||||
|
324 | QList<QVariant> setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
325 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
326 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
327 | ||||
312 | //======================================================================= |
|
328 | //======================================================================= | |
313 | // move mouse from top of set1 to top of set2 |
|
329 | // move mouse from top of set1 to top of set2 | |
314 | QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint()); |
|
330 | QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint()); | |
315 | TRY_COMPARE(seriesSpy.count(), 2); |
|
331 | TRY_COMPARE(seriesSpy.count(), 2); | |
|
332 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
333 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
334 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
316 |
|
335 | |||
317 | // should leave set1 |
|
336 | // should leave set1 | |
318 | seriesSpyArg = seriesSpy.takeFirst(); |
|
337 | seriesSpyArg = seriesSpy.takeFirst(); | |
@@ -320,22 +339,264 void tst_QPercentBarSeries::mousehovered() | |||||
320 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
339 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
321 | QVERIFY(seriesSpyArg.at(0).toBool() == false); |
|
340 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
322 |
|
341 | |||
|
342 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
343 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
344 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
345 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
346 | ||||
|
347 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
348 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
349 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
350 | ||||
323 | // should enter set2 |
|
351 | // should enter set2 | |
324 | seriesSpyArg = seriesSpy.takeFirst(); |
|
352 | seriesSpyArg = seriesSpy.takeFirst(); | |
325 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); |
|
353 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
326 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
354 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
327 | QVERIFY(seriesSpyArg.at(0).toBool() == true); |
|
355 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
328 |
|
356 | |||
|
357 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
358 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
359 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
360 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
361 | ||||
|
362 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
363 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
364 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
365 | ||||
329 | //======================================================================= |
|
366 | //======================================================================= | |
330 | // move mouse from top of set2 to background |
|
367 | // move mouse from top of set2 to background | |
331 | QTest::mouseMove(view.viewport(), QPoint(layout.at(1).center().x(), 0)); |
|
368 | QTest::mouseMove(view.viewport(), QPoint(layout.at(1).center().x(), 0)); | |
332 | TRY_COMPARE(seriesSpy.count(), 1); |
|
369 | TRY_COMPARE(seriesSpy.count(), 1); | |
|
370 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
371 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
372 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
333 |
|
373 | |||
334 | // should leave set2 |
|
374 | // should leave set2 | |
335 | seriesSpyArg = seriesSpy.takeFirst(); |
|
375 | seriesSpyArg = seriesSpy.takeFirst(); | |
336 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); |
|
376 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
337 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
377 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
338 | QVERIFY(seriesSpyArg.at(0).toBool() == false); |
|
378 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
|
379 | ||||
|
380 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
381 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
382 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
383 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
384 | ||||
|
385 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
386 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
387 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
388 | ||||
|
389 | //======================================================================= | |||
|
390 | // move mouse on top of set1, bar0 to check the index (hover into set1) | |||
|
391 | QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint()); | |||
|
392 | ||||
|
393 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
394 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
395 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
396 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
|
397 | ||||
|
398 | //should enter set1, bar0 | |||
|
399 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
400 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
401 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
402 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
403 | ||||
|
404 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
405 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
406 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
407 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
408 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
409 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
410 | ||||
|
411 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
412 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
413 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
414 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
415 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
416 | ||||
|
417 | //======================================================================= | |||
|
418 | // move mouse on top of set2, bar0 to check the index (hover out set1, | |||
|
419 | // hover in set2) | |||
|
420 | QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint()); | |||
|
421 | ||||
|
422 | TRY_COMPARE(seriesSpy.count(), 2); | |||
|
423 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
424 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
425 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
426 | ||||
|
427 | //should leave set1, bar0 | |||
|
428 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
429 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
430 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
431 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
432 | ||||
|
433 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
434 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
435 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
436 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
437 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
438 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
439 | ||||
|
440 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
441 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
442 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
443 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
444 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
445 | ||||
|
446 | //should enter set2, bar0 | |||
|
447 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
448 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
449 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
450 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
451 | ||||
|
452 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
453 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
454 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
455 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
456 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
457 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
458 | ||||
|
459 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
460 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
461 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
462 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
463 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
464 | ||||
|
465 | //======================================================================= | |||
|
466 | // move mouse on top of set1, bar1 to check the index (hover out set2, | |||
|
467 | // hover in set1) | |||
|
468 | QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint()); | |||
|
469 | ||||
|
470 | TRY_COMPARE(seriesSpy.count(), 2); | |||
|
471 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
472 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
473 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
474 | ||||
|
475 | //should leave set2, bar0 | |||
|
476 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
477 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
478 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
479 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
480 | ||||
|
481 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
482 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
483 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
484 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
485 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
486 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
487 | ||||
|
488 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
489 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
490 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
491 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
492 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
493 | ||||
|
494 | //should enter set1, bar1 | |||
|
495 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
496 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
497 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
498 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
499 | ||||
|
500 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
501 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
502 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
503 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
504 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
505 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
506 | ||||
|
507 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
508 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
509 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
510 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
511 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
512 | ||||
|
513 | //======================================================================= | |||
|
514 | // move mouse between set1 and set2 (hover out set1) | |||
|
515 | QTest::mouseMove(view.viewport(), QPoint((layout.at(3).right() + layout.at(4).left()) /2, | |||
|
516 | layout.at(2).top())); | |||
|
517 | ||||
|
518 | QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); | |||
|
519 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
520 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
521 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
522 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
|
523 | ||||
|
524 | //should leave set1, bar1 | |||
|
525 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
526 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
527 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
528 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
529 | ||||
|
530 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
531 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
532 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
533 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
534 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
535 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
536 | ||||
|
537 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
538 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
539 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
540 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
541 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
542 | ||||
|
543 | //======================================================================= | |||
|
544 | // move mouse on top of set2, bar1 to check the index (hover in set2) | |||
|
545 | QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint()); | |||
|
546 | ||||
|
547 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
548 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
549 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
550 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
551 | ||||
|
552 | //should enter set2, bar1 | |||
|
553 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
554 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
555 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
556 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
557 | ||||
|
558 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
559 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
560 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
561 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
562 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
563 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
564 | ||||
|
565 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
566 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
567 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
568 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
569 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
570 | ||||
|
571 | //======================================================================= | |||
|
572 | // move mouse between set1 and set2 (hover out set2) | |||
|
573 | QTest::mouseMove(view.viewport(), QPoint((layout.at(3).right() + layout.at(4).left()) /2, | |||
|
574 | layout.at(2).top())); | |||
|
575 | ||||
|
576 | QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); | |||
|
577 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
578 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
579 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
580 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
581 | ||||
|
582 | //should leave set1, bar1 | |||
|
583 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
584 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
585 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
586 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
587 | ||||
|
588 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
589 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
590 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
591 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
592 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
593 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
594 | ||||
|
595 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
596 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
597 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
598 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
599 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
339 | } |
|
600 | } | |
340 |
|
601 | |||
341 | QTEST_MAIN(tst_QPercentBarSeries) |
|
602 | QTEST_MAIN(tst_QPercentBarSeries) |
@@ -253,6 +253,9 void tst_QStackedBarSeries::mousehovered() | |||||
253 | QList<QBarSet*> barSets = series->barSets(); |
|
253 | QList<QBarSet*> barSets = series->barSets(); | |
254 |
|
254 | |||
255 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*))); |
|
255 | QSignalSpy seriesSpy(series,SIGNAL(hovered(bool,QBarSet*))); | |
|
256 | QSignalSpy seriesIndexSpy(series, SIGNAL(hovered(bool, int, QBarSet*))); | |||
|
257 | QSignalSpy setIndexSpy1(set1, SIGNAL(hovered(bool, int))); | |||
|
258 | QSignalSpy setIndexSpy2(set2, SIGNAL(hovered(bool, int))); | |||
256 |
|
259 | |||
257 | QChartView view(new QChart()); |
|
260 | QChartView view(new QChart()); | |
258 | view.resize(400,300); |
|
261 | view.resize(400,300); | |
@@ -305,21 +308,37 void tst_QStackedBarSeries::mousehovered() | |||||
305 | QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y())); |
|
308 | QTest::mouseMove(view.viewport(), QPoint(0, layout.at(0).center().y())); | |
306 | QCoreApplication::processEvents(QEventLoop::AllEvents, 10000); |
|
309 | QCoreApplication::processEvents(QEventLoop::AllEvents, 10000); | |
307 | TRY_COMPARE(seriesSpy.count(), 0); |
|
310 | TRY_COMPARE(seriesSpy.count(), 0); | |
|
311 | TRY_COMPARE(seriesIndexSpy.count(), 0); | |||
308 |
|
312 | |||
309 | //======================================================================= |
|
313 | //======================================================================= | |
310 | // move mouse on top of set1 |
|
314 | // move mouse on top of set1 | |
311 | QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint()); |
|
315 | QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint()); | |
312 | TRY_COMPARE(seriesSpy.count(), 1); |
|
316 | TRY_COMPARE(seriesSpy.count(), 1); | |
|
317 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
318 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
319 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
313 |
|
320 | |||
314 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); |
|
321 | QList<QVariant> seriesSpyArg = seriesSpy.takeFirst(); | |
315 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); |
|
322 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |
316 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
323 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
317 | QVERIFY(seriesSpyArg.at(0).toBool() == true); |
|
324 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
318 |
|
325 | |||
|
326 | QList<QVariant> seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
327 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
328 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
329 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
330 | ||||
|
331 | QList<QVariant> setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
332 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
333 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
334 | ||||
319 | //======================================================================= |
|
335 | //======================================================================= | |
320 | // move mouse from top of set1 to top of set2 |
|
336 | // move mouse from top of set1 to top of set2 | |
321 | QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint()); |
|
337 | QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint()); | |
322 | TRY_COMPARE(seriesSpy.count(), 2); |
|
338 | TRY_COMPARE(seriesSpy.count(), 2); | |
|
339 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
340 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
341 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
323 |
|
342 | |||
324 | // should leave set1 |
|
343 | // should leave set1 | |
325 | seriesSpyArg = seriesSpy.takeFirst(); |
|
344 | seriesSpyArg = seriesSpy.takeFirst(); | |
@@ -327,22 +346,264 void tst_QStackedBarSeries::mousehovered() | |||||
327 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
346 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
328 | QVERIFY(seriesSpyArg.at(0).toBool() == false); |
|
347 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
329 |
|
348 | |||
|
349 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
350 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
351 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
352 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
353 | ||||
|
354 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
355 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
356 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
357 | ||||
330 | // should enter set2 |
|
358 | // should enter set2 | |
331 | seriesSpyArg = seriesSpy.takeFirst(); |
|
359 | seriesSpyArg = seriesSpy.takeFirst(); | |
332 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); |
|
360 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
333 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
361 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
334 | QVERIFY(seriesSpyArg.at(0).toBool() == true); |
|
362 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |
335 |
|
363 | |||
|
364 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
365 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
366 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
367 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
368 | ||||
|
369 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
370 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
371 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
372 | ||||
336 | //======================================================================= |
|
373 | //======================================================================= | |
337 | // move mouse from top of set2 to background |
|
374 | // move mouse from top of set2 to background | |
338 | QTest::mouseMove(view.viewport(), QPoint(layout.at(1).center().x(), 0)); |
|
375 | QTest::mouseMove(view.viewport(), QPoint(layout.at(1).center().x(), 0)); | |
339 | TRY_COMPARE(seriesSpy.count(), 1); |
|
376 | TRY_COMPARE(seriesSpy.count(), 1); | |
|
377 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
378 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
379 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
340 |
|
380 | |||
341 | // should leave set2 |
|
381 | // should leave set2 | |
342 | seriesSpyArg = seriesSpy.takeFirst(); |
|
382 | seriesSpyArg = seriesSpy.takeFirst(); | |
343 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); |
|
383 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |
344 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); |
|
384 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |
345 | QVERIFY(seriesSpyArg.at(0).toBool() == false); |
|
385 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |
|
386 | ||||
|
387 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
388 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
389 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
390 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
391 | ||||
|
392 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
393 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
394 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
395 | ||||
|
396 | //======================================================================= | |||
|
397 | // move mouse on top of set1, bar0 to check the index (hover into set1) | |||
|
398 | QTest::mouseMove(view.viewport(), layout.at(0).center().toPoint()); | |||
|
399 | ||||
|
400 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
401 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
402 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
403 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
|
404 | ||||
|
405 | //should enter set1, bar0 | |||
|
406 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
407 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
408 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
409 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
410 | ||||
|
411 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
412 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
413 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
414 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
415 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
416 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
417 | ||||
|
418 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
419 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
420 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
421 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
422 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
423 | ||||
|
424 | //======================================================================= | |||
|
425 | // move mouse on top of set2, bar0 to check the index (hover out set1, | |||
|
426 | // hover in set2) | |||
|
427 | QTest::mouseMove(view.viewport(), layout.at(1).center().toPoint()); | |||
|
428 | ||||
|
429 | TRY_COMPARE(seriesSpy.count(), 2); | |||
|
430 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
431 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
432 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
433 | ||||
|
434 | //should leave set1, bar0 | |||
|
435 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
436 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
437 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
438 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
439 | ||||
|
440 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
441 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
442 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
443 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
444 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
445 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
446 | ||||
|
447 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
448 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
449 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
450 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
451 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
452 | ||||
|
453 | //should enter set2, bar0 | |||
|
454 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
455 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
456 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
457 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
458 | ||||
|
459 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
460 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
461 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
462 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
463 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
464 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
465 | ||||
|
466 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
467 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
468 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
469 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
470 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
471 | ||||
|
472 | //======================================================================= | |||
|
473 | // move mouse on top of set1, bar1 to check the index (hover out set2, | |||
|
474 | // hover in set1) | |||
|
475 | QTest::mouseMove(view.viewport(), layout.at(2).center().toPoint()); | |||
|
476 | ||||
|
477 | TRY_COMPARE(seriesSpy.count(), 2); | |||
|
478 | TRY_COMPARE(seriesIndexSpy.count(), 2); | |||
|
479 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
480 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
481 | ||||
|
482 | //should leave set2, bar0 | |||
|
483 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
484 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
485 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
486 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
487 | ||||
|
488 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
489 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
490 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
491 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
492 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
493 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 0); | |||
|
494 | ||||
|
495 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
496 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
497 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
498 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
499 | QVERIFY(setIndexSpyArg.at(1).toInt() == 0); | |||
|
500 | ||||
|
501 | //should enter set1, bar1 | |||
|
502 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
503 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
504 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
505 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
506 | ||||
|
507 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
508 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
509 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
510 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
511 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
512 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
513 | ||||
|
514 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
515 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
516 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
517 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
518 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
519 | ||||
|
520 | //======================================================================= | |||
|
521 | // move mouse between set1 and set2 (hover out set1) | |||
|
522 | QTest::mouseMove(view.viewport(), QPoint((layout.at(3).right() + layout.at(4).left()) /2, | |||
|
523 | layout.at(2).top())); | |||
|
524 | ||||
|
525 | QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); | |||
|
526 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
527 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
528 | TRY_COMPARE(setIndexSpy1.count(), 1); | |||
|
529 | TRY_COMPARE(setIndexSpy2.count(), 0); | |||
|
530 | ||||
|
531 | //should leave set1, bar1 | |||
|
532 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
533 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set1); | |||
|
534 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
535 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
536 | ||||
|
537 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
538 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set1); | |||
|
539 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
540 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
541 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
542 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
543 | ||||
|
544 | setIndexSpyArg = setIndexSpy1.takeFirst(); | |||
|
545 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
546 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
547 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
548 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
549 | ||||
|
550 | //======================================================================= | |||
|
551 | // move mouse on top of set2, bar1 to check the index (hover in set2) | |||
|
552 | QTest::mouseMove(view.viewport(), layout.at(3).center().toPoint()); | |||
|
553 | ||||
|
554 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
555 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
556 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
557 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
558 | ||||
|
559 | //should enter set2, bar1 | |||
|
560 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
561 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
562 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
563 | QVERIFY(seriesSpyArg.at(0).toBool() == true); | |||
|
564 | ||||
|
565 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
566 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
567 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
568 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == true); | |||
|
569 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
570 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
571 | ||||
|
572 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
573 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
574 | QVERIFY(setIndexSpyArg.at(0).toBool() == true); | |||
|
575 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
576 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
|
577 | ||||
|
578 | //======================================================================= | |||
|
579 | // move mouse between set1 and set2 (hover out set2) | |||
|
580 | QTest::mouseMove(view.viewport(), QPoint((layout.at(3).right() + layout.at(4).left()) /2, | |||
|
581 | layout.at(2).top())); | |||
|
582 | ||||
|
583 | QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); | |||
|
584 | TRY_COMPARE(seriesSpy.count(), 1); | |||
|
585 | TRY_COMPARE(seriesIndexSpy.count(), 1); | |||
|
586 | TRY_COMPARE(setIndexSpy1.count(), 0); | |||
|
587 | TRY_COMPARE(setIndexSpy2.count(), 1); | |||
|
588 | ||||
|
589 | //should leave set1, bar1 | |||
|
590 | seriesSpyArg = seriesSpy.takeFirst(); | |||
|
591 | QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(1)), set2); | |||
|
592 | QVERIFY(seriesSpyArg.at(0).type() == QVariant::Bool); | |||
|
593 | QVERIFY(seriesSpyArg.at(0).toBool() == false); | |||
|
594 | ||||
|
595 | seriesIndexSpyArg = seriesIndexSpy.takeFirst(); | |||
|
596 | QCOMPARE(qvariant_cast<QBarSet*>(seriesIndexSpyArg.at(2)), set2); | |||
|
597 | QVERIFY(seriesIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
598 | QVERIFY(seriesIndexSpyArg.at(0).toBool() == false); | |||
|
599 | QVERIFY(seriesIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
600 | QVERIFY(seriesIndexSpyArg.at(1).toInt() == 1); | |||
|
601 | ||||
|
602 | setIndexSpyArg = setIndexSpy2.takeFirst(); | |||
|
603 | QVERIFY(setIndexSpyArg.at(0).type() == QVariant::Bool); | |||
|
604 | QVERIFY(setIndexSpyArg.at(0).toBool() == false); | |||
|
605 | QVERIFY(setIndexSpyArg.at(1).type() == QVariant::Int); | |||
|
606 | QVERIFY(setIndexSpyArg.at(1).toInt() == 1); | |||
346 | } |
|
607 | } | |
347 |
|
608 | |||
348 | QTEST_MAIN(tst_QStackedBarSeries) |
|
609 | QTEST_MAIN(tst_QStackedBarSeries) |
@@ -37,7 +37,7 ChartView { | |||||
37 | axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
37 | axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } | |
38 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
38 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
39 | onClicked: console.log("barset.onClicked: " + index); |
|
39 | onClicked: console.log("barset.onClicked: " + index); | |
40 | onHovered: console.log("barset.onHovered: " + status); |
|
40 | onHovered: console.log("barset.onHovered: " + status + " " + index); | |
41 | onPenChanged: console.log("barset.onPenChanged: " + pen); |
|
41 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
42 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); |
|
42 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
43 | onLabelChanged: console.log("barset.onLabelChanged: " + label); |
|
43 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
@@ -58,7 +58,8 ChartView { | |||||
58 | onVisibleChanged: console.log("barSeries.onVisibleChanged: " + series.visible); |
|
58 | onVisibleChanged: console.log("barSeries.onVisibleChanged: " + series.visible); | |
59 | onOpacityChanged: console.log("barSeries.onOpacityChanged: " + opacity); |
|
59 | onOpacityChanged: console.log("barSeries.onOpacityChanged: " + opacity); | |
60 | onClicked: console.log("barSeries.onClicked: " + barset + " " + index); |
|
60 | onClicked: console.log("barSeries.onClicked: " + barset + " " + index); | |
61 |
onHovered: console.log("barSeries.onHovered: " + barset + " " + status |
|
61 | onHovered: console.log("barSeries.onHovered: " + barset + " " + status | |
|
62 | + " " + index); | |||
62 | onLabelsVisibleChanged: console.log("barSeries.onLabelsVisibleChanged: " + series.labelsVisible); |
|
63 | onLabelsVisibleChanged: console.log("barSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
63 | onCountChanged: console.log("barSeries.onCountChanged: " + count); |
|
64 | onCountChanged: console.log("barSeries.onCountChanged: " + count); | |
64 | } |
|
65 | } |
@@ -36,7 +36,7 ChartView { | |||||
36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } | |
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
38 | onClicked: console.log("barset.onClicked: " + index); |
|
38 | onClicked: console.log("barset.onClicked: " + index); | |
39 | onHovered: console.log("barset.onHovered: " + status); |
|
39 | onHovered: console.log("barset.onHovered: " + status + " " + index); | |
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); |
|
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); |
|
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); |
|
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
@@ -57,7 +57,8 ChartView { | |||||
57 | onVisibleChanged: console.log("horizontalBarSeries.onVisibleChanged: " + series.visible); |
|
57 | onVisibleChanged: console.log("horizontalBarSeries.onVisibleChanged: " + series.visible); | |
58 | onOpacityChanged: console.log("horizontalBarSeries.onOpacityChanged: " + opacity); |
|
58 | onOpacityChanged: console.log("horizontalBarSeries.onOpacityChanged: " + opacity); | |
59 | onClicked: console.log("horizontalBarSeries.onClicked: " + barset + " " + index); |
|
59 | onClicked: console.log("horizontalBarSeries.onClicked: " + barset + " " + index); | |
60 |
onHovered: console.log("horizontalBarSeries.onHovered: " + barset + " " |
|
60 | onHovered: console.log("horizontalBarSeries.onHovered: " + barset + " " | |
|
61 | + status + " " + index); | |||
61 | onLabelsVisibleChanged: console.log("horizontalBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); |
|
62 | onLabelsVisibleChanged: console.log("horizontalBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
62 | onCountChanged: console.log("horizontalBarSeries.onCountChanged: " + count); |
|
63 | onCountChanged: console.log("horizontalBarSeries.onCountChanged: " + count); | |
63 | } |
|
64 | } |
@@ -36,7 +36,7 ChartView { | |||||
36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } | |
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
38 | onClicked: console.log("barset.onClicked: " + index); |
|
38 | onClicked: console.log("barset.onClicked: " + index); | |
39 | onHovered: console.log("barset.onHovered: " + status); |
|
39 | onHovered: console.log("barset.onHovered: " + status + " " + index); | |
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); |
|
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); |
|
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); |
|
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
@@ -57,7 +57,8 ChartView { | |||||
57 | onVisibleChanged: console.log("horizontalPercentBarSeries.onVisibleChanged: " + series.visible); |
|
57 | onVisibleChanged: console.log("horizontalPercentBarSeries.onVisibleChanged: " + series.visible); | |
58 | onOpacityChanged: console.log("horizontalPercentBarSeries.onOpacityChanged: " + opacity); |
|
58 | onOpacityChanged: console.log("horizontalPercentBarSeries.onOpacityChanged: " + opacity); | |
59 | onClicked: console.log("horizontalPercentBarSeries.onClicked: " + barset + " " + index); |
|
59 | onClicked: console.log("horizontalPercentBarSeries.onClicked: " + barset + " " + index); | |
60 |
onHovered: console.log("horizontalPercentBarSeries.onHovered: " + barset |
|
60 | onHovered: console.log("horizontalPercentBarSeries.onHovered: " + barset | |
|
61 | + " " + status + " " + index); | |||
61 | onLabelsVisibleChanged: console.log("horizontalPercentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); |
|
62 | onLabelsVisibleChanged: console.log("horizontalPercentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
62 | onCountChanged: console.log("horizontalPercentBarSeries.onCountChanged: " + count); |
|
63 | onCountChanged: console.log("horizontalPercentBarSeries.onCountChanged: " + count); | |
63 | } |
|
64 | } |
@@ -36,7 +36,7 ChartView { | |||||
36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } | |
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
38 | onClicked: console.log("barset.onClicked: " + index); |
|
38 | onClicked: console.log("barset.onClicked: " + index); | |
39 | onHovered: console.log("barset.onHovered: " + status); |
|
39 | onHovered: console.log("barset.onHovered: " + status + " " + index); | |
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); |
|
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); |
|
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); |
|
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
@@ -57,7 +57,8 ChartView { | |||||
57 | onVisibleChanged: console.log("horizontalStackedBarSeries.onVisibleChanged: " + series.visible); |
|
57 | onVisibleChanged: console.log("horizontalStackedBarSeries.onVisibleChanged: " + series.visible); | |
58 | onOpacityChanged: console.log("horizontalStackedBarSeries.onOpacityChanged: " + opacity); |
|
58 | onOpacityChanged: console.log("horizontalStackedBarSeries.onOpacityChanged: " + opacity); | |
59 | onClicked: console.log("horizontalStackedBarSeries.onClicked: " + barset + " " + index); |
|
59 | onClicked: console.log("horizontalStackedBarSeries.onClicked: " + barset + " " + index); | |
60 |
onHovered: console.log("horizontalStackedBarSeries.onHovered: " + barset |
|
60 | onHovered: console.log("horizontalStackedBarSeries.onHovered: " + barset | |
|
61 | + " " + status + " " + index); | |||
61 | onLabelsVisibleChanged: console.log("horizontalStackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); |
|
62 | onLabelsVisibleChanged: console.log("horizontalStackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
62 | onCountChanged: console.log("horizontalStackedBarSeries.onCountChanged: " + count); |
|
63 | onCountChanged: console.log("horizontalStackedBarSeries.onCountChanged: " + count); | |
63 | } |
|
64 | } |
@@ -37,7 +37,7 ChartView { | |||||
37 |
|
37 | |||
38 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
38 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
39 | onClicked: console.log("barset.onClicked: " + index); |
|
39 | onClicked: console.log("barset.onClicked: " + index); | |
40 | onHovered: console.log("barset.onHovered: " + status); |
|
40 | onHovered: console.log("barset.onHovered: " + status + " " + index); | |
41 | onPenChanged: console.log("barset.onPenChanged: " + pen); |
|
41 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
42 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); |
|
42 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
43 | onLabelChanged: console.log("barset.onLabelChanged: " + label); |
|
43 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
@@ -58,7 +58,8 ChartView { | |||||
58 | onVisibleChanged: console.log("percentBarSeries.onVisibleChanged: " + series.visible); |
|
58 | onVisibleChanged: console.log("percentBarSeries.onVisibleChanged: " + series.visible); | |
59 | onOpacityChanged: console.log("percentBarSeries.onOpacityChanged: " + opacity); |
|
59 | onOpacityChanged: console.log("percentBarSeries.onOpacityChanged: " + opacity); | |
60 | onClicked: console.log("percentBarSeries.onClicked: " + barset + " " + index); |
|
60 | onClicked: console.log("percentBarSeries.onClicked: " + barset + " " + index); | |
61 |
onHovered: console.log("percentBarSeries.onHovered: " + barset |
|
61 | onHovered: console.log("percentBarSeries.onHovered: " + barset | |
|
62 | + " " + status + " " + index); | |||
62 | onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); |
|
63 | onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
63 | onCountChanged: console.log("percentBarSeries.onCountChanged: " + count); |
|
64 | onCountChanged: console.log("percentBarSeries.onCountChanged: " + count); | |
64 | } |
|
65 | } |
@@ -36,7 +36,7 ChartView { | |||||
36 | axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
36 | axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } | |
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
38 | onClicked: console.log("barset.onClicked: " + index); |
|
38 | onClicked: console.log("barset.onClicked: " + index); | |
39 | onHovered: console.log("barset.onHovered: " + status); |
|
39 | onHovered: console.log("barset.onHovered: " + status + " " + index); | |
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); |
|
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); |
|
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); |
|
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
@@ -57,7 +57,8 ChartView { | |||||
57 | onVisibleChanged: console.log("stackedBarSeries.onVisibleChanged: " + series.visible); |
|
57 | onVisibleChanged: console.log("stackedBarSeries.onVisibleChanged: " + series.visible); | |
58 | onOpacityChanged: console.log("stackedBarSeries.onOpacityChanged: " + opacity); |
|
58 | onOpacityChanged: console.log("stackedBarSeries.onOpacityChanged: " + opacity); | |
59 | onClicked: console.log("stackedBarSeries.onClicked: " + barset + " " + index); |
|
59 | onClicked: console.log("stackedBarSeries.onClicked: " + barset + " " + index); | |
60 |
onHovered: console.log("stackedBarSeries.onHovered: " + barset |
|
60 | onHovered: console.log("stackedBarSeries.onHovered: " + barset | |
|
61 | + " " + status + " " + index); | |||
61 | onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); |
|
62 | onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
62 | onCountChanged: console.log("stackedBarSeries.onCountChanged: " + count); |
|
63 | onCountChanged: console.log("stackedBarSeries.onCountChanged: " + count); | |
63 | } |
|
64 | } |
@@ -37,7 +37,7 ChartView { | |||||
37 | axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
37 | axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } | |
38 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
38 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
39 | onClicked: console.log("barset.onClicked: " + index); |
|
39 | onClicked: console.log("barset.onClicked: " + index); | |
40 | onHovered: console.log("barset.onHovered: " + status); |
|
40 | onHovered: console.log("barset.onHovered: " + status + " " + index); | |
41 | onPenChanged: console.log("barset.onPenChanged: " + pen); |
|
41 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
42 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); |
|
42 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
43 | onLabelChanged: console.log("barset.onLabelChanged: " + label); |
|
43 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
@@ -58,7 +58,8 ChartView { | |||||
58 | onVisibleChanged: console.log("barSeries.onVisibleChanged: " + series.visible); |
|
58 | onVisibleChanged: console.log("barSeries.onVisibleChanged: " + series.visible); | |
59 | onOpacityChanged: console.log("barSeries.onOpacityChanged: " + opacity); |
|
59 | onOpacityChanged: console.log("barSeries.onOpacityChanged: " + opacity); | |
60 | onClicked: console.log("barSeries.onClicked: " + barset + " " + index); |
|
60 | onClicked: console.log("barSeries.onClicked: " + barset + " " + index); | |
61 |
onHovered: console.log("barSeries.onHovered: " + barset + " " + status |
|
61 | onHovered: console.log("barSeries.onHovered: " + barset + " " + status | |
|
62 | + " " + index); | |||
62 | onLabelsVisibleChanged: console.log("barSeries.onLabelsVisibleChanged: " + series.labelsVisible); |
|
63 | onLabelsVisibleChanged: console.log("barSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
63 | onCountChanged: console.log("barSeries.onCountChanged: " + count); |
|
64 | onCountChanged: console.log("barSeries.onCountChanged: " + count); | |
64 | } |
|
65 | } |
@@ -36,7 +36,7 ChartView { | |||||
36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } | |
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
38 | onClicked: console.log("barset.onClicked: " + index); |
|
38 | onClicked: console.log("barset.onClicked: " + index); | |
39 | onHovered: console.log("barset.onHovered: " + status); |
|
39 | onHovered: console.log("barset.onHovered: " + status + " " + index); | |
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); |
|
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); |
|
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); |
|
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
@@ -57,7 +57,8 ChartView { | |||||
57 | onVisibleChanged: console.log("horizontalBarSeries.onVisibleChanged: " + series.visible); |
|
57 | onVisibleChanged: console.log("horizontalBarSeries.onVisibleChanged: " + series.visible); | |
58 | onOpacityChanged: console.log("horizontalBarSeries.onOpacityChanged: " + opacity); |
|
58 | onOpacityChanged: console.log("horizontalBarSeries.onOpacityChanged: " + opacity); | |
59 | onClicked: console.log("horizontalBarSeries.onClicked: " + barset + " " + index); |
|
59 | onClicked: console.log("horizontalBarSeries.onClicked: " + barset + " " + index); | |
60 |
onHovered: console.log("horizontalBarSeries.onHovered: " + barset + " " |
|
60 | onHovered: console.log("horizontalBarSeries.onHovered: " + barset + " " | |
|
61 | + status + " " + index); | |||
61 | onLabelsVisibleChanged: console.log("horizontalBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); |
|
62 | onLabelsVisibleChanged: console.log("horizontalBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
62 | onCountChanged: console.log("horizontalBarSeries.onCountChanged: " + count); |
|
63 | onCountChanged: console.log("horizontalBarSeries.onCountChanged: " + count); | |
63 | } |
|
64 | } |
@@ -36,7 +36,7 ChartView { | |||||
36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } | |
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
38 | onClicked: console.log("barset.onClicked: " + index); |
|
38 | onClicked: console.log("barset.onClicked: " + index); | |
39 | onHovered: console.log("barset.onHovered: " + status); |
|
39 | onHovered: console.log("barset.onHovered: " + status + " " + index); | |
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); |
|
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); |
|
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); |
|
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
@@ -57,7 +57,8 ChartView { | |||||
57 | onVisibleChanged: console.log("horizontalPercentBarSeries.onVisibleChanged: " + series.visible); |
|
57 | onVisibleChanged: console.log("horizontalPercentBarSeries.onVisibleChanged: " + series.visible); | |
58 | onOpacityChanged: console.log("horizontalPercentBarSeries.onOpacityChanged: " + opacity); |
|
58 | onOpacityChanged: console.log("horizontalPercentBarSeries.onOpacityChanged: " + opacity); | |
59 | onClicked: console.log("horizontalPercentBarSeries.onClicked: " + barset + " " + index); |
|
59 | onClicked: console.log("horizontalPercentBarSeries.onClicked: " + barset + " " + index); | |
60 |
onHovered: console.log("horizontalPercentBarSeries.onHovered: " + barset |
|
60 | onHovered: console.log("horizontalPercentBarSeries.onHovered: " + barset | |
|
61 | + " " + status + " " + index); | |||
61 | onLabelsVisibleChanged: console.log("horizontalPercentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); |
|
62 | onLabelsVisibleChanged: console.log("horizontalPercentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
62 | onCountChanged: console.log("horizontalPercentBarSeries.onCountChanged: " + count); |
|
63 | onCountChanged: console.log("horizontalPercentBarSeries.onCountChanged: " + count); | |
63 | } |
|
64 | } |
@@ -36,7 +36,7 ChartView { | |||||
36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } | |
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
38 | onClicked: console.log("barset.onClicked: " + index); |
|
38 | onClicked: console.log("barset.onClicked: " + index); | |
39 | onHovered: console.log("barset.onHovered: " + status); |
|
39 | onHovered: console.log("barset.onHovered: " + status + " " + index); | |
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); |
|
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); |
|
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); |
|
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
@@ -57,7 +57,8 ChartView { | |||||
57 | onVisibleChanged: console.log("horizontalStackedBarSeries.onVisibleChanged: " + series.visible); |
|
57 | onVisibleChanged: console.log("horizontalStackedBarSeries.onVisibleChanged: " + series.visible); | |
58 | onOpacityChanged: console.log("horizontalStackedBarSeries.onOpacityChanged: " + opacity); |
|
58 | onOpacityChanged: console.log("horizontalStackedBarSeries.onOpacityChanged: " + opacity); | |
59 | onClicked: console.log("horizontalStackedBarSeries.onClicked: " + barset + " " + index); |
|
59 | onClicked: console.log("horizontalStackedBarSeries.onClicked: " + barset + " " + index); | |
60 |
onHovered: console.log("horizontalStackedBarSeries.onHovered: " + barset |
|
60 | onHovered: console.log("horizontalStackedBarSeries.onHovered: " + barset | |
|
61 | + " " + status + " " + index); | |||
61 | onLabelsVisibleChanged: console.log("horizontalStackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); |
|
62 | onLabelsVisibleChanged: console.log("horizontalStackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
62 | onCountChanged: console.log("horizontalStackedBarSeries.onCountChanged: " + count); |
|
63 | onCountChanged: console.log("horizontalStackedBarSeries.onCountChanged: " + count); | |
63 | } |
|
64 | } |
@@ -37,7 +37,7 ChartView { | |||||
37 |
|
37 | |||
38 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
38 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
39 | onClicked: console.log("barset.onClicked: " + index); |
|
39 | onClicked: console.log("barset.onClicked: " + index); | |
40 | onHovered: console.log("barset.onHovered: " + status); |
|
40 | onHovered: console.log("barset.onHovered: " + status + " " + index); | |
41 | onPenChanged: console.log("barset.onPenChanged: " + pen); |
|
41 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
42 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); |
|
42 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
43 | onLabelChanged: console.log("barset.onLabelChanged: " + label); |
|
43 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
@@ -58,7 +58,8 ChartView { | |||||
58 | onVisibleChanged: console.log("percentBarSeries.onVisibleChanged: " + series.visible); |
|
58 | onVisibleChanged: console.log("percentBarSeries.onVisibleChanged: " + series.visible); | |
59 | onOpacityChanged: console.log("percentBarSeries.onOpacityChanged: " + opacity); |
|
59 | onOpacityChanged: console.log("percentBarSeries.onOpacityChanged: " + opacity); | |
60 | onClicked: console.log("percentBarSeries.onClicked: " + barset + " " + index); |
|
60 | onClicked: console.log("percentBarSeries.onClicked: " + barset + " " + index); | |
61 |
onHovered: console.log("percentBarSeries.onHovered: " + barset |
|
61 | onHovered: console.log("percentBarSeries.onHovered: " + barset | |
|
62 | + " " + status + " " + index); | |||
62 | onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); |
|
63 | onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
63 | onCountChanged: console.log("percentBarSeries.onCountChanged: " + count); |
|
64 | onCountChanged: console.log("percentBarSeries.onCountChanged: " + count); | |
64 | } |
|
65 | } |
@@ -36,7 +36,7 ChartView { | |||||
36 | axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
36 | axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } | |
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] |
|
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
38 | onClicked: console.log("barset.onClicked: " + index); |
|
38 | onClicked: console.log("barset.onClicked: " + index); | |
39 | onHovered: console.log("barset.onHovered: " + status); |
|
39 | onHovered: console.log("barset.onHovered: " + status + " " + index); | |
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); |
|
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); |
|
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); |
|
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
@@ -57,7 +57,8 ChartView { | |||||
57 | onVisibleChanged: console.log("stackedBarSeries.onVisibleChanged: " + series.visible); |
|
57 | onVisibleChanged: console.log("stackedBarSeries.onVisibleChanged: " + series.visible); | |
58 | onOpacityChanged: console.log("stackedBarSeries.onOpacityChanged: " + opacity); |
|
58 | onOpacityChanged: console.log("stackedBarSeries.onOpacityChanged: " + opacity); | |
59 | onClicked: console.log("stackedBarSeries.onClicked: " + barset + " " + index); |
|
59 | onClicked: console.log("stackedBarSeries.onClicked: " + barset + " " + index); | |
60 |
onHovered: console.log("stackedBarSeries.onHovered: " + barset |
|
60 | onHovered: console.log("stackedBarSeries.onHovered: " + barset | |
|
61 | + " " + status + " " + index); | |||
61 | onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); |
|
62 | onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
62 | onCountChanged: console.log("stackedBarSeries.onCountChanged: " + count); |
|
63 | onCountChanged: console.log("stackedBarSeries.onCountChanged: " + count); | |
63 | } |
|
64 | } |
General Comments 0
You need to be logged in to leave comments.
Login now