##// END OF EJS Templates
Remove unnecessary package creation scripts...
Remove unnecessary package creation scripts The package creation scripts are no longer needed as the structure of the module has changed and the packages are now created with general Qt scripts. Change-Id: I83744a2dcc98e7d53f297e27560d365a7b4a1f41 Task-number: QTRD-3219 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>

File last commit:

r2740:377e4516d036
r2741:c0570bb33acb
Show More
tst_qlineseries.cpp
202 lines | 5.9 KiB | text/x-c | CppLexer
Michal Klocek
Update of tst_qlineseries.cpp
r1064 /****************************************************************************
**
Titta Heikkala
Update copyright year...
r2688 ** Copyright (C) 2014 Digia Plc
Michal Klocek
Update of tst_qlineseries.cpp
r1064 ** All rights reserved.
Titta Heikkala
Updated license headers...
r2740 ** For any questions to Digia, please use contact form at http://qt.io
Michal Klocek
Update of tst_qlineseries.cpp
r1064 **
Titta Heikkala
Updated license headers...
r2740 ** This file is part of the Qt Charts module.
Michal Klocek
Update of tst_qlineseries.cpp
r1064 **
Titta Heikkala
Updated license headers...
r2740 ** Licensees holding valid commercial license for Qt may use this file in
** accordance with the Qt License Agreement provided with the Software
** or, alternatively, in accordance with the terms contained in a written
** agreement between you and Digia.
Michal Klocek
Update of tst_qlineseries.cpp
r1064 **
** If you have questions regarding the use of this file, please use
Titta Heikkala
Updated license headers...
r2740 ** contact form at http://qt.io
Michal Klocek
Update of tst_qlineseries.cpp
r1064 **
****************************************************************************/
Michal Klocek
Adds spline scatter unit tests
r1266 #include "../qxyseries/tst_qxyseries.h"
Titta Heikkala
Fix include syntax...
r2714 #include <QtCharts/QLineSeries>
Michal Klocek
Update of tst_qlineseries.cpp
r1064
Michal Klocek
Add tst_qlineseries stub
r1058
Michal Klocek
Adds spline scatter unit tests
r1266 Q_DECLARE_METATYPE(QList<QPointF>)
Michal Klocek
Add tst_qlineseries stub
r1058
Michal Klocek
Adds spline scatter unit tests
r1266 class tst_QLineSeries : public tst_QXYSeries
Michal Klocek
Add tst_qlineseries stub
r1058 {
Q_OBJECT
Michal Klocek
Adds spline scatter unit tests
r1266 public slots:
Michal Klocek
Add tst_qlineseries stub
r1058 void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
Michal Klocek
Adds spline scatter unit tests
r1266 private slots:
Michal Klocek
Update of tst_qlineseries.cpp
r1064 void qlineseries_data();
void qlineseries();
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 void pressedSignal();
void releasedSignal();
void doubleClickedSignal();
Michal Klocek
Adds spline scatter unit tests
r1266 protected:
Michal Klocek
Adds default 0,1 domain for emmpty series, update tst_qlineseries
r1070 void pointsVisible_data();
Michal Klocek
Add tst_qlineseries stub
r1058 };
void tst_QLineSeries::initTestCase()
{
}
void tst_QLineSeries::cleanupTestCase()
{
Miikka Heikkinen
Plugged some memory leaks....
r2733 QTest::qWait(1); // Allow final deleteLaters to run
Michal Klocek
Add tst_qlineseries stub
r1058 }
void tst_QLineSeries::init()
{
Michal Klocek
Adds spline scatter unit tests
r1266 tst_QXYSeries::init();
Marek Rosa
Spline series now recalcutes control points on adding/removing data to/from model
r1072 m_series = new QLineSeries();
Michal Klocek
Add tst_qlineseries stub
r1058 }
void tst_QLineSeries::cleanup()
{
Michal Klocek
Adds default 0,1 domain for emmpty series, update tst_qlineseries
r1070 delete m_series;
Michal Klocek
Adds tst_qvaluesaxis stub implementation
r1699 m_series=0;
Michal Klocek
Adds spline scatter unit tests
r1266 tst_QXYSeries::cleanup();
Michal Klocek
Add tst_qlineseries stub
r1058 }
Michal Klocek
Update of tst_qlineseries.cpp
r1064 void tst_QLineSeries::qlineseries_data()
Michal Klocek
Add tst_qlineseries stub
r1058 {
Michal Klocek
Adds default 0,1 domain for emmpty series, update tst_qlineseries
r1070
Michal Klocek
Add tst_qlineseries stub
r1058 }
Michal Klocek
Update of tst_qlineseries.cpp
r1064 void tst_QLineSeries::qlineseries()
Michal Klocek
Add tst_qlineseries stub
r1058 {
Marek Rosa
Fixed some of the tests after Model mapping refactoring
r1178 QLineSeries series;
Michal Klocek
Update of tst_qlineseries.cpp
r1064
Marek Rosa
Fixed some of the tests after Model mapping refactoring
r1178 QCOMPARE(series.count(),0);
QCOMPARE(series.brush(), QBrush());
QCOMPARE(series.points(), QList<QPointF>());
QCOMPARE(series.pen(), QPen());
QCOMPARE(series.pointsVisible(), false);
Titta Heikkala
Added possibility to show series value...
r2689 QCOMPARE(series.pointLabelsVisible(), false);
QCOMPARE(series.pointLabelsFormat(), QLatin1String("@xPoint, @yPoint"));
Michal Klocek
Update of tst_qlineseries.cpp
r1064
Marek Rosa
Fixed some of the tests after Model mapping refactoring
r1178 series.append(QList<QPointF>());
series.append(0.0,0.0);
series.append(QPointF());
Michal Klocek
Update of tst_qlineseries.cpp
r1064
Marek Rosa
Fixed some of the tests after Model mapping refactoring
r1178 series.remove(0.0,0.0);
series.remove(QPointF());
Jani Honkonen
xyseries: removeAll() was duplicate of clear()
r1374 series.clear();
Michal Klocek
Update of tst_qlineseries.cpp
r1064
Marek Rosa
Fixed some of the tests after Model mapping refactoring
r1178 series.replace(QPointF(),QPointF());
series.replace(0,0,0,0);
series.setBrush(QBrush());
Michal Klocek
Update of tst_qlineseries.cpp
r1064
Marek Rosa
Fixed some of the tests after Model mapping refactoring
r1178 series.setPen(QPen());
series.setPointsVisible(false);
Michal Klocek
Adds default 0,1 domain for emmpty series, update tst_qlineseries
r1070
Titta Heikkala
Added possibility to show series value...
r2689 series.setPointLabelsVisible(false);
series.setPointLabelsFormat(QString());
Marek Rosa
Fixed some of the tests after Model mapping refactoring
r1178 m_chart->addSeries(&series);
m_view->show();
QTest::qWaitForWindowShown(m_view);
Michal Klocek
Add tst_qlineseries stub
r1058 }
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 void tst_QLineSeries::pressedSignal()
{
SKIP_IF_CANNOT_TEST_MOUSE_EVENTS();
QPointF linePoint(4, 12);
QLineSeries *lineSeries = new QLineSeries();
lineSeries->append(QPointF(2, 1));
lineSeries->append(linePoint);
lineSeries->append(QPointF(6, 12));
QChartView view;
view.chart()->legend()->setVisible(false);
view.chart()->addSeries(lineSeries);
view.show();
QTest::qWaitForWindowShown(&view);
QSignalSpy seriesSpy(lineSeries, SIGNAL(pressed(QPointF)));
QPointF checkPoint = view.chart()->mapToPosition(linePoint);
QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, checkPoint.toPoint());
QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
QCOMPARE(seriesSpy.count(), 1);
QList<QVariant> seriesSpyArg = seriesSpy.takeFirst();
// checkPoint is QPointF and for the mouseClick it it's changed to QPoint
// this causes small distinction in decimals so we round it before comparing
QPointF signalPoint = qvariant_cast<QPointF>(seriesSpyArg.at(0));
QCOMPARE(qRound(signalPoint.x()), qRound(linePoint.x()));
QCOMPARE(qRound(signalPoint.y()), qRound(linePoint.y()));
}
void tst_QLineSeries::releasedSignal()
{
SKIP_IF_CANNOT_TEST_MOUSE_EVENTS();
QPointF linePoint(4, 12);
QLineSeries *lineSeries = new QLineSeries();
lineSeries->append(QPointF(2, 20));
lineSeries->append(linePoint);
lineSeries->append(QPointF(6, 12));
QChartView view;
view.chart()->legend()->setVisible(false);
view.chart()->addSeries(lineSeries);
view.show();
QTest::qWaitForWindowShown(&view);
QSignalSpy seriesSpy(lineSeries, SIGNAL(released(QPointF)));
QPointF checkPoint = view.chart()->mapToPosition(linePoint);
QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, checkPoint.toPoint());
QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
QCOMPARE(seriesSpy.count(), 1);
QList<QVariant> seriesSpyArg = seriesSpy.takeFirst();
// checkPoint is QPointF and for the mouseClick it it's changed to QPoint
// this causes small distinction in decimals so we round it before comparing
QPointF signalPoint = qvariant_cast<QPointF>(seriesSpyArg.at(0));
QCOMPARE(qRound(signalPoint.x()), qRound(linePoint.x()));
QCOMPARE(qRound(signalPoint.y()), qRound(linePoint.y()));
}
void tst_QLineSeries::doubleClickedSignal()
{
SKIP_IF_CANNOT_TEST_MOUSE_EVENTS();
QPointF linePoint(4, 12);
QLineSeries *lineSeries = new QLineSeries();
lineSeries->append(QPointF(2, 20));
lineSeries->append(linePoint);
lineSeries->append(QPointF(6, 12));
QChartView view;
view.chart()->legend()->setVisible(false);
view.chart()->addSeries(lineSeries);
view.show();
QTest::qWaitForWindowShown(&view);
QSignalSpy seriesSpy(lineSeries, SIGNAL(doubleClicked(QPointF)));
QPointF checkPoint = view.chart()->mapToPosition(linePoint);
QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, checkPoint.toPoint());
QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
QCOMPARE(seriesSpy.count(), 1);
QList<QVariant> seriesSpyArg = seriesSpy.takeFirst();
// checkPoint is QPointF and for the mouseClick it it's changed to QPoint
// this causes small distinction in decimals so we round it before comparing
QPointF signalPoint = qvariant_cast<QPointF>(seriesSpyArg.at(0));
QCOMPARE(qRound(signalPoint.x()), qRound(linePoint.x()));
QCOMPARE(qRound(signalPoint.y()), qRound(linePoint.y()));
}
Michal Klocek
Add tst_qlineseries stub
r1058 QTEST_MAIN(tst_QLineSeries)
#include "tst_qlineseries.moc"