##// END OF EJS Templates
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api

File last commit:

r1490:b134c8a9174e
r1490:b134c8a9174e
Show More
tst_qbarseries.cpp
571 lines | 16.5 KiB | text/x-c | CppLexer
sauimone
barseries unit testing
r1100 /****************************************************************************
**
** Copyright (C) 2012 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the Qt Commercial Charts Add-on.
**
** $QT_BEGIN_LICENSE$
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QtTest>
#include <qbarseries.h>
sauimone
include header fix
r1106 #include <qbarset.h>
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 #include <qchartview.h>
#include <qchart.h>
Jani Honkonen
autotests: try to fix bar hover failures in bamboo
r1466 #include "tst_definitions.h"
sauimone
barseries unit testing
r1100
QTCOMMERCIALCHART_USE_NAMESPACE
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 Q_DECLARE_METATYPE(QBarSet*)
sauimone
barseries unit testing
r1100 class tst_QBarSeries : public QObject
{
Q_OBJECT
public slots:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
private slots:
void qbarseries_data();
void qbarseries();
void type_data();
void type();
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 void append_data();
void append();
void remove_data();
void remove();
void appendList_data();
void appendList();
sauimone
barsetCount -> count in tests and examples too
r1463 void count_data();
void count();
sauimone
updated barseries unit test. fixed found errors.
r1101 void barSets_data();
void barSets();
void setLabelsVisible_data();
void setLabelsVisible();
sauimone
mouse hover test cases for barcharts
r1146 void mouseclicked_data();
void mouseclicked();
void mousehovered_data();
void mousehovered();
Marek Rosa
Added new test case to BarSeries tests: clear() with animations enabled
r1375 void clearWithAnimations();
sauimone
barseries unit testing
r1100
private:
QBarSeries* m_barseries;
sauimone
updated barseries unit test. fixed found errors.
r1101 QBarSeries* m_barseries_with_sets;
QList<QBarSet*> m_testSets;
sauimone
barseries unit testing
r1100 };
void tst_QBarSeries::initTestCase()
{
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 qRegisterMetaType<QBarSet*>("QBarSet*");
sauimone
barseries unit testing
r1100 }
void tst_QBarSeries::cleanupTestCase()
{
}
void tst_QBarSeries::init()
{
sauimone
separated categories from barseries constructor
r1112 m_barseries = new QBarSeries();
m_barseries_with_sets = new QBarSeries();
sauimone
updated barseries unit test. fixed found errors.
r1101
for (int i=0; i<5; i++) {
m_testSets.append(new QBarSet("testset"));
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 m_barseries_with_sets->append(m_testSets.at(i));
sauimone
updated barseries unit test. fixed found errors.
r1101 }
sauimone
barseries unit testing
r1100 }
void tst_QBarSeries::cleanup()
{
sauimone
updated barseries unit test. fixed found errors.
r1101 foreach(QBarSet* s, m_testSets) {
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 m_barseries_with_sets->remove(s);
sauimone
updated barseries unit test. fixed found errors.
r1101 delete s;
}
m_testSets.clear();
sauimone
barseries unit testing
r1100 delete m_barseries;
m_barseries = 0;
sauimone
updated barseries unit test. fixed found errors.
r1101 delete m_barseries_with_sets;
m_barseries_with_sets = 0;
sauimone
barseries unit testing
r1100 }
void tst_QBarSeries::qbarseries_data()
{
}
void tst_QBarSeries::qbarseries()
{
sauimone
separated categories from barseries constructor
r1112 QBarSeries *barseries = new QBarSeries();
sauimone
barseries unit testing
r1100 QVERIFY(barseries != 0);
}
void tst_QBarSeries::type_data()
{
}
void tst_QBarSeries::type()
{
QVERIFY(m_barseries->type() == QAbstractSeries::SeriesTypeBar);
}
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 void tst_QBarSeries::append_data()
sauimone
barseries unit testing
r1100 {
}
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 void tst_QBarSeries::append()
sauimone
barseries unit testing
r1100 {
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries->count() == 0);
sauimone
barseries unit testing
r1100
sauimone
improved set/remove barset test cases. fixed errors
r1122 bool ret = false;
// Try adding barset
sauimone
barseries unit testing
r1100 QBarSet *barset = new QBarSet("testset");
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret = m_barseries->append(barset);
sauimone
barseries unit testing
r1100
sauimone
improved set/remove barset test cases. fixed errors
r1122 QVERIFY(ret == true);
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries->count() == 1);
sauimone
updated barseries unit test. fixed found errors.
r1101
sauimone
improved set/remove barset test cases. fixed errors
r1122 // Try adding another set
sauimone
updated barseries unit test. fixed found errors.
r1101 QBarSet *barset2 = new QBarSet("testset2");
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret = m_barseries->append(barset2);
sauimone
improved set/remove barset test cases. fixed errors
r1122
QVERIFY(ret == true);
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries->count() == 2);
sauimone
updated barseries unit test. fixed found errors.
r1101
sauimone
improved set/remove barset test cases. fixed errors
r1122 // Try adding same set again
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret = m_barseries->append(barset2);
sauimone
improved set/remove barset test cases. fixed errors
r1122 QVERIFY(ret == false);
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries->count() == 2);
sauimone
improved set/remove barset test cases. fixed errors
r1122
// Try adding null set
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret = m_barseries->append(0);
sauimone
improved set/remove barset test cases. fixed errors
r1122 QVERIFY(ret == false);
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries->count() == 2);
sauimone
improved set/remove barset test cases. fixed errors
r1122
sauimone
updated barseries unit test. fixed found errors.
r1101 }
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 void tst_QBarSeries::remove_data()
sauimone
updated barseries unit test. fixed found errors.
r1101 {
}
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 void tst_QBarSeries::remove()
sauimone
updated barseries unit test. fixed found errors.
r1101 {
int count = m_testSets.count();
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries_with_sets->count() == count);
sauimone
updated barseries unit test. fixed found errors.
r1101
sauimone
improved set/remove barset test cases. fixed errors
r1122 // Try to remove null pointer (should not remove, should not crash)
bool ret = false;
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret = m_barseries_with_sets->remove(0);
sauimone
improved set/remove barset test cases. fixed errors
r1122 QVERIFY(ret == false);
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries_with_sets->count() == count);
sauimone
improved set/remove barset test cases. fixed errors
r1122
// Try to remove invalid pointer (should not remove, should not crash)
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret = m_barseries_with_sets->remove((QBarSet*) (m_testSets.at(0) + 1) );
sauimone
improved set/remove barset test cases. fixed errors
r1122 QVERIFY(ret == false);
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries_with_sets->count() == count);
sauimone
improved set/remove barset test cases. fixed errors
r1122
sauimone
updated barseries unit test. fixed found errors.
r1101 // remove some sets
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret = m_barseries_with_sets->remove(m_testSets.at(2));
sauimone
improved set/remove barset test cases. fixed errors
r1122 QVERIFY(ret == true);
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret = m_barseries_with_sets->remove(m_testSets.at(3));
sauimone
improved set/remove barset test cases. fixed errors
r1122 QVERIFY(ret == true);
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret = m_barseries_with_sets->remove(m_testSets.at(4));
sauimone
improved set/remove barset test cases. fixed errors
r1122 QVERIFY(ret == true);
sauimone
updated barseries unit test. fixed found errors.
r1101
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries_with_sets->count() == 2);
sauimone
updated barseries unit test. fixed found errors.
r1101
QList<QBarSet*> verifysets = m_barseries_with_sets->barSets();
QVERIFY(verifysets.at(0) == m_testSets.at(0));
QVERIFY(verifysets.at(1) == m_testSets.at(1));
sauimone
improved set/remove barset test cases. fixed errors
r1122 // Try removing all sets again (should be ok, even if some sets have already been removed)
ret = false;
sauimone
updated barseries unit test. fixed found errors.
r1101 for (int i=0; i<count; i++) {
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret |= m_barseries_with_sets->remove(m_testSets.at(i));
sauimone
updated barseries unit test. fixed found errors.
r1101 }
sauimone
improved set/remove barset test cases. fixed errors
r1122 QVERIFY(ret == true);
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries_with_sets->count() == 0);
sauimone
updated barseries unit test. fixed found errors.
r1101 }
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 void tst_QBarSeries::appendList_data()
sauimone
updated barseries unit test. fixed found errors.
r1101 {
}
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 void tst_QBarSeries::appendList()
sauimone
updated barseries unit test. fixed found errors.
r1101 {
int count = 5;
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries->count() == 0);
sauimone
updated barseries unit test. fixed found errors.
r1101
QList<QBarSet*> sets;
for (int i=0; i<count; i++) {
sets.append(new QBarSet("testset"));
}
sauimone
improved set/remove barset test cases. fixed errors
r1122 // Append new sets (should succeed, count should match the count of sets)
bool ret = false;
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret = m_barseries->append(sets);
sauimone
improved set/remove barset test cases. fixed errors
r1122 QVERIFY(ret == true);
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries->count() == count);
sauimone
improved set/remove barset test cases. fixed errors
r1122
// Append same sets again (should fail, count should remain same)
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret = m_barseries->append(sets);
sauimone
improved set/remove barset test cases. fixed errors
r1122 QVERIFY(ret == false);
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries->count() == count);
sauimone
improved set/remove barset test cases. fixed errors
r1122
// Try append empty list (should succeed, but count should remain same)
QList<QBarSet*> invalidList;
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret = m_barseries->append(invalidList);
sauimone
improved set/remove barset test cases. fixed errors
r1122 QVERIFY(ret == true);
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries->count() == count);
sauimone
improved set/remove barset test cases. fixed errors
r1122
// Try append list with one new and one existing set (should fail, count remains same)
invalidList.append(new QBarSet("ok set"));
invalidList.append(sets.at(0));
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret = m_barseries->append(invalidList);
sauimone
improved set/remove barset test cases. fixed errors
r1122 QVERIFY(ret == false);
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries->count() == count);
sauimone
improved set/remove barset test cases. fixed errors
r1122
// Try append list with null pointers (should fail, count remains same)
QList<QBarSet*> invalidList2;
invalidList2.append(0);
invalidList2.append(0);
invalidList2.append(0);
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 ret = m_barseries->append(invalidList2);
sauimone
improved set/remove barset test cases. fixed errors
r1122 QVERIFY(ret == false);
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries->count() == count);
sauimone
updated barseries unit test. fixed found errors.
r1101 }
sauimone
barsetCount -> count in tests and examples too
r1463 void tst_QBarSeries::count_data()
sauimone
updated barseries unit test. fixed found errors.
r1101 {
}
sauimone
barsetCount -> count in tests and examples too
r1463 void tst_QBarSeries::count()
sauimone
updated barseries unit test. fixed found errors.
r1101 {
sauimone
barsetCount -> count in tests and examples too
r1463 QVERIFY(m_barseries->count() == 0);
QVERIFY(m_barseries_with_sets->count() == m_testSets.count());
sauimone
updated barseries unit test. fixed found errors.
r1101 }
void tst_QBarSeries::barSets_data()
{
}
void tst_QBarSeries::barSets()
{
QVERIFY(m_barseries->barSets().count() == 0);
QList<QBarSet*> sets = m_barseries_with_sets->barSets();
QVERIFY(sets.count() == m_testSets.count());
for (int i=0; i<m_testSets.count(); i++) {
QVERIFY(sets.at(i) == m_testSets.at(i));
}
}
void tst_QBarSeries::setLabelsVisible_data()
{
}
void tst_QBarSeries::setLabelsVisible()
{
sauimone
label test tweak
r1123 // labels should be invisible by default
sauimone
removed barlabel. label visibility control is now per series instead of per set
r1246 QVERIFY(m_barseries->isLabelsVisible() == false);
QVERIFY(m_barseries_with_sets->isLabelsVisible() == false);
sauimone
updated barseries unit test. fixed found errors.
r1101
sauimone
label test tweak
r1123 // turn labels to visible
sauimone
updated barseries unit test. fixed found errors.
r1101 m_barseries_with_sets->setLabelsVisible(true);
sauimone
removed barlabel. label visibility control is now per series instead of per set
r1246 // TODO: test the signal
QVERIFY(m_barseries_with_sets->isLabelsVisible() == true);
sauimone
updated barseries unit test. fixed found errors.
r1101
sauimone
label test tweak
r1123 // turn labels to invisible
sauimone
updated barseries unit test. fixed found errors.
r1101 m_barseries_with_sets->setLabelsVisible(false);
sauimone
removed barlabel. label visibility control is now per series instead of per set
r1246 // TODO: test the signal
QVERIFY(m_barseries_with_sets->isLabelsVisible() == false);
sauimone
label test tweak
r1123
// without parameter, should turn labels to visible
m_barseries_with_sets->setLabelsVisible();
sauimone
removed barlabel. label visibility control is now per series instead of per set
r1246 // TODO: test the signal
QVERIFY(m_barseries_with_sets->isLabelsVisible() == true);
sauimone
barseries unit testing
r1100 }
sauimone
mouse hover test cases for barcharts
r1146 void tst_QBarSeries::mouseclicked_data()
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 {
}
sauimone
mouse hover test cases for barcharts
r1146 void tst_QBarSeries::mouseclicked()
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 {
QBarSeries* series = new QBarSeries();
QBarSet* set1 = new QBarSet(QString("set 1"));
sauimone
fixing barchart tests with new layout
r1177 *set1 << QPointF(0,10) << QPointF(1,10) << QPointF(2,10);
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 series->append(set1);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145
QBarSet* set2 = new QBarSet(QString("set 2"));
sauimone
barseries mouse test fix
r1235 *set2 << QPointF(0.3,10) << QPointF(1.3,10) << QPointF(2.3,10);
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 series->append(set2);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145
sauimone
removed categories from barseries. categories are now only on axis
r1321 QSignalSpy seriesSpy(series,SIGNAL(clicked(QBarSet*,int)));
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 QSignalSpy setSpy1(set1, SIGNAL(clicked(int)));
QSignalSpy setSpy2(set2, SIGNAL(clicked(int)));
sauimone
mouse click test cases for barcharts. Fixed found error
r1145
QChartView view(new QChart());
view.resize(400,300);
view.chart()->addSeries(series);
view.show();
QTest::qWaitForWindowShown(&view);
//====================================================================================
sauimone
enable axis layout changes again
r1386 // barset 1, bar 0
sauimone
barmargin replaced with barwidth
r1425 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(102,142));
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
QCOMPARE(seriesSpy.count(), 1);
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 QCOMPARE(setSpy1.count(), 1);
QCOMPARE(setSpy2.count(), 0);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145
QList<QVariant> seriesSpyArg = seriesSpy.takeFirst();
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(0)), set1);
sauimone
removed categories from barseries. categories are now only on axis
r1321 QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int);
QVERIFY(seriesSpyArg.at(1).toInt() == 0);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 QList<QVariant> setSpyArg = setSpy1.takeFirst();
QVERIFY(setSpyArg.at(0).type() == QVariant::Int);
QVERIFY(setSpyArg.at(0).toInt() == 0);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 //====================================================================================
sauimone
enable axis layout changes again
r1386 // barset 1, bar 1
sauimone
barmargin replaced with barwidth
r1425 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(186,142));
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
QCOMPARE(seriesSpy.count(), 1);
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 QCOMPARE(setSpy1.count(), 1);
QCOMPARE(setSpy2.count(), 0);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145
seriesSpyArg = seriesSpy.takeFirst();
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(0)), set1);
sauimone
removed categories from barseries. categories are now only on axis
r1321 QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int);
QVERIFY(seriesSpyArg.at(1).toInt() == 1);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 setSpyArg = setSpy1.takeFirst();
QVERIFY(setSpyArg.at(0).type() == QVariant::Int);
QVERIFY(setSpyArg.at(0).toInt() == 1);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 //====================================================================================
sauimone
enable axis layout changes again
r1386 // barset 1, bar 2
sauimone
barmargin replaced with barwidth
r1425 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(271,142));
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
QCOMPARE(seriesSpy.count(), 1);
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 QCOMPARE(setSpy1.count(), 1);
QCOMPARE(setSpy2.count(), 0);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145
seriesSpyArg = seriesSpy.takeFirst();
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(0)), set1);
sauimone
removed categories from barseries. categories are now only on axis
r1321 QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int);
QVERIFY(seriesSpyArg.at(1).toInt() == 2);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 setSpyArg = setSpy1.takeFirst();
QVERIFY(setSpyArg.at(0).type() == QVariant::Int);
QVERIFY(setSpyArg.at(0).toInt() == 2);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 //====================================================================================
sauimone
enable axis layout changes again
r1386 // barset 2, bar 0
sauimone
barmargin replaced with barwidth
r1425 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(127,142));
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
QCOMPARE(seriesSpy.count(), 1);
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 QCOMPARE(setSpy1.count(), 0);
QCOMPARE(setSpy2.count(), 1);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145
seriesSpyArg = seriesSpy.takeFirst();
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(0)), set2);
sauimone
removed categories from barseries. categories are now only on axis
r1321 QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int);
QVERIFY(seriesSpyArg.at(1).toInt() == 0);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 setSpyArg = setSpy2.takeFirst();
QVERIFY(setSpyArg.at(0).type() == QVariant::Int);
QVERIFY(setSpyArg.at(0).toInt() == 0);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 //====================================================================================
sauimone
enable axis layout changes again
r1386 // barset 2, bar 1
sauimone
barmargin replaced with barwidth
r1425 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(212,142));
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
QCOMPARE(seriesSpy.count(), 1);
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 QCOMPARE(setSpy1.count(), 0);
QCOMPARE(setSpy2.count(), 1);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145
seriesSpyArg = seriesSpy.takeFirst();
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(0)), set2);
sauimone
removed categories from barseries. categories are now only on axis
r1321 QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int);
QVERIFY(seriesSpyArg.at(1).toInt() == 1);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 setSpyArg = setSpy2.takeFirst();
QVERIFY(setSpyArg.at(0).type() == QVariant::Int);
QVERIFY(setSpyArg.at(0).toInt() == 1);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 //====================================================================================
sauimone
enable axis layout changes again
r1386 // barset 2, bar 2
sauimone
barmargin replaced with barwidth
r1425 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, QPoint(296,142));
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
QCOMPARE(seriesSpy.count(), 1);
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 QCOMPARE(setSpy1.count(), 0);
QCOMPARE(setSpy2.count(), 1);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145
seriesSpyArg = seriesSpy.takeFirst();
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(0)), set2);
sauimone
removed categories from barseries. categories are now only on axis
r1321 QVERIFY(seriesSpyArg.at(1).type() == QVariant::Int);
QVERIFY(seriesSpyArg.at(1).toInt() == 2);
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490
setSpyArg = setSpy2.takeFirst();
QVERIFY(setSpyArg.at(0).type() == QVariant::Int);
QVERIFY(setSpyArg.at(0).toInt() == 2);
sauimone
mouse click test cases for barcharts. Fixed found error
r1145 }
sauimone
mouse hover test cases for barcharts
r1146 void tst_QBarSeries::mousehovered_data()
{
}
void tst_QBarSeries::mousehovered()
{
QBarSeries* series = new QBarSeries();
QBarSet* set1 = new QBarSet(QString("set 1"));
sauimone
barmargin replaced with barwidth
r1425 *set1 << QPointF(0,10) << QPointF(1,10) << QPointF(2,10);
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 series->append(set1);
sauimone
mouse hover test cases for barcharts
r1146
QBarSet* set2 = new QBarSet(QString("set 2"));
sauimone
barseries mouse test fix
r1235 *set2 << QPointF(0.3,10) << QPointF(1.3,10) << QPointF(2.3,10);
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 series->append(set2);
sauimone
mouse hover test cases for barcharts
r1146
QSignalSpy seriesSpy(series,SIGNAL(hovered(QBarSet*,bool)));
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 QSignalSpy setSpy1(set1, SIGNAL(hovered(bool)));
QSignalSpy setSpy2(set2, SIGNAL(hovered(bool)));
sauimone
mouse hover test cases for barcharts
r1146
QChartView view(new QChart());
view.resize(400,300);
view.chart()->addSeries(series);
view.show();
QTest::qWaitForWindowShown(&view);
sauimone
barseries autotest update
r1287 //this is hack since view does not get events otherwise
view.setMouseTracking(true);
sauimone
mouse hover test cases for barcharts
r1146 //=======================================================================
// move mouse to left border
sauimone
barseries autotest update
r1287 QTest::mouseMove(view.viewport(), QPoint(0, 142));
Jani Honkonen
autotests: try to fix bar hover failures in bamboo
r1466 QCoreApplication::processEvents(QEventLoop::AllEvents, 10000);
TRY_COMPARE(seriesSpy.count(), 0);
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 TRY_COMPARE(setSpy1.count(), 0);
TRY_COMPARE(setSpy2.count(), 0);
sauimone
mouse hover test cases for barcharts
r1146
//=======================================================================
// move mouse on top of set1
sauimone
barmargin replaced with barwidth
r1425 QTest::mouseMove(view.viewport(), QPoint(102,142));
Jani Honkonen
autotests: try to fix bar hover failures in bamboo
r1466 TRY_COMPARE(seriesSpy.count(), 1);
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 TRY_COMPARE(setSpy1.count(), 1);
TRY_COMPARE(setSpy2.count(), 0);
sauimone
mouse hover test cases for barcharts
r1146
QList<QVariant> seriesSpyArg = seriesSpy.takeFirst();
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(0)), set1);
sauimone
barseries autotest update
r1287 QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool);
QVERIFY(seriesSpyArg.at(1).toBool() == true);
sauimone
mouse hover test cases for barcharts
r1146
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 QList<QVariant> setSpyArg = setSpy1.takeFirst();
QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
QVERIFY(setSpyArg.at(0).toBool() == true);
sauimone
mouse hover test cases for barcharts
r1146 //=======================================================================
// move mouse from top of set1 to top of set2
sauimone
barmargin replaced with barwidth
r1425 QTest::mouseMove(view.viewport(), QPoint(127,142));
Jani Honkonen
autotests: try to fix bar hover failures in bamboo
r1466 TRY_COMPARE(seriesSpy.count(), 2);
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 TRY_COMPARE(setSpy1.count(), 1);
TRY_COMPARE(setSpy2.count(), 1);
sauimone
mouse hover test cases for barcharts
r1146
// should leave set1
seriesSpyArg = seriesSpy.takeFirst();
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(0)), set1);
QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool);
QVERIFY(seriesSpyArg.at(1).toBool() == false);
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 setSpyArg = setSpy1.takeFirst();
QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
QVERIFY(setSpyArg.at(0).toBool() == false);
sauimone
mouse hover test cases for barcharts
r1146 // should enter set2
seriesSpyArg = seriesSpy.takeFirst();
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(0)), set2);
QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool);
QVERIFY(seriesSpyArg.at(1).toBool() == true);
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 setSpyArg = setSpy2.takeFirst();
QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
QVERIFY(setSpyArg.at(0).toBool() == true);
sauimone
mouse hover test cases for barcharts
r1146 //=======================================================================
// move mouse from top of set2 to background
sauimone
barmargin replaced with barwidth
r1425 QTest::mouseMove(view.viewport(), QPoint(127,0));
Jani Honkonen
autotests: try to fix bar hover failures in bamboo
r1466 TRY_COMPARE(seriesSpy.count(), 1);
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490 TRY_COMPARE(setSpy1.count(), 0);
TRY_COMPARE(setSpy2.count(), 1);
sauimone
mouse hover test cases for barcharts
r1146
sauimone
barseries autotest update
r1287 // should leave set2
sauimone
mouse hover test cases for barcharts
r1146 seriesSpyArg = seriesSpy.takeFirst();
QCOMPARE(qvariant_cast<QBarSet*>(seriesSpyArg.at(0)), set2);
QVERIFY(seriesSpyArg.at(1).type() == QVariant::Bool);
QVERIFY(seriesSpyArg.at(1).toBool() == false);
sauimone
reintroducing clicked and hovered signals to barset. Makes some things easier on QML api
r1490
setSpyArg = setSpy2.takeFirst();
QVERIFY(setSpyArg.at(0).type() == QVariant::Bool);
QVERIFY(setSpyArg.at(0).toBool() == false);
sauimone
mouse hover test cases for barcharts
r1146 }
Marek Rosa
Added new test case to BarSeries tests: clear() with animations enabled
r1375 void tst_QBarSeries::clearWithAnimations()
{
QBarSeries* series = new QBarSeries();
QBarSet* set1 = new QBarSet(QString("set 1"));
sauimone
barmargin replaced with barwidth
r1425 *set1 << QPointF(0,10) << QPointF(1,10) << QPointF(2,10);
Marek Rosa
Added new test case to BarSeries tests: clear() with animations enabled
r1375 series->append(set1);
QBarSet* set2 = new QBarSet(QString("set 2"));
*set2 << QPointF(0.3,10) << QPointF(1.3,10) << QPointF(2.3,10);
series->append(set2);
QChartView view(new QChart());
view.resize(400,300);
view.chart()->setAnimationOptions(QChart::SeriesAnimations);
view.chart()->addSeries(series);
view.show();
series->clear();
}
sauimone
barseries unit testing
r1100 QTEST_MAIN(tst_QBarSeries)
#include "tst_qbarseries.moc"