##// END OF EJS Templates
Updated README...
Updated README The README file is updated for Charts 2.0. Change-Id: I88685e258ebab0f4b48307e2ef63a581407aac31 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>

File last commit:

r2740:377e4516d036
r2744:d83c3ab5c084
Show More
tst_qml.cpp
190 lines | 7.1 KiB | text/x-c | CppLexer
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 /****************************************************************************
**
Titta Heikkala
Update copyright year...
r2688 ** Copyright (C) 2014 Digia Plc
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 ** All rights reserved.
Titta Heikkala
Updated license headers...
r2740 ** For any questions to Digia, please use contact form at http://qt.io
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 **
Titta Heikkala
Updated license headers...
r2740 ** This file is part of the Qt Charts module.
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 **
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
Adds tst_qml basic stub for checking plugin loading qml
r1997 **
** 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
Adds tst_qml basic stub for checking plugin loading qml
r1997 **
****************************************************************************/
#include <QtTest/QtTest>
Titta Heikkala
Qt Charts project file structure change...
r2712 #include <QtQml/QQmlEngine>
#include <QtQml/QQmlComponent>
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 #include "tst_definitions.h"
Titta Heikkala
Qt Charts project file structure change...
r2712 class tst_qml : public QObject
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 {
Q_OBJECT
public slots:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
private slots:
void checkPlugin_data();
void checkPlugin();
private:
Titta Heikkala
Qt Charts project file structure change...
r2712 QString componentErrors(const QQmlComponent* component) const;
Miikka Heikkinen
Add Polar chart support...
r2483 QString imports_1_1();
QString imports_1_3();
Titta Heikkala
Qt Charts project file structure change...
r2712 QString imports_1_4();
QString imports_2_0();
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997
};
Titta Heikkala
Qt Charts project file structure change...
r2712 QString tst_qml::componentErrors(const QQmlComponent* component) const
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 {
Q_ASSERT(component);
QStringList errors;
Titta Heikkala
Qt Charts project file structure change...
r2712 foreach (QQmlError const& error, component->errors()) {
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 errors << error.toString();
}
return errors.join("\n");
}
Titta Heikkala
Qt Charts project file structure change...
r2712 QString tst_qml::imports_1_1()
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 {
Titta Heikkala
Qt Charts project file structure change...
r2712 return "import QtQuick 2.0 \n"
"import QtCharts 1.1 \n";
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 }
Titta Heikkala
Qt Charts project file structure change...
r2712 QString tst_qml::imports_1_3()
Miikka Heikkinen
Add Polar chart support...
r2483 {
Titta Heikkala
Qt Charts project file structure change...
r2712 return "import QtQuick 2.0 \n"
"import QtCharts 1.3 \n";
Miikka Heikkinen
Add Polar chart support...
r2483 }
Titta Heikkala
Qt Charts project file structure change...
r2712 QString tst_qml::imports_1_4()
{
return "import QtQuick 2.0 \n"
"import QtCharts 1.4 \n";
}
QString tst_qml::imports_2_0()
{
return "import QtQuick 2.0 \n"
"import QtCharts 2.0 \n";
}
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997
Titta Heikkala
Qt Charts project file structure change...
r2712 void tst_qml::initTestCase()
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 {
}
Titta Heikkala
Qt Charts project file structure change...
r2712 void tst_qml::cleanupTestCase()
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 {
}
Titta Heikkala
Qt Charts project file structure change...
r2712 void tst_qml::init()
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 {
}
Titta Heikkala
Qt Charts project file structure change...
r2712 void tst_qml::cleanup()
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 {
}
Titta Heikkala
Qt Charts project file structure change...
r2712 void tst_qml::checkPlugin_data()
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 {
QTest::addColumn<QString>("source");
Tero Ahola
Added the rest of the QML elements into qml unit tests
r2032
Miikka Heikkinen
Add Polar chart support...
r2483 QTest::newRow("createChartView") << imports_1_1() + "ChartView{}";
QTest::newRow("XYPoint") << imports_1_1() + "XYPoint{}";
QTest::newRow("scatterSeries") << imports_1_1() + "ScatterSeries{}";
QTest::newRow("lineSeries") << imports_1_1() + "LineSeries{}";
QTest::newRow("splineSeries") << imports_1_1() + "SplineSeries{}";
QTest::newRow("areaSeries") << imports_1_1() + "AreaSeries{}";
QTest::newRow("barSeries") << imports_1_1() + "BarSeries{}";
QTest::newRow("stackedBarSeries") << imports_1_1() + "StackedBarSeries{}";
QTest::newRow("precentBarSeries") << imports_1_1() + "PercentBarSeries{}";
QTest::newRow("horizonatlBarSeries") << imports_1_1() + "HorizontalBarSeries{}";
QTest::newRow("horizonatlStackedBarSeries") << imports_1_1() + "HorizontalStackedBarSeries{}";
QTest::newRow("horizonatlstackedBarSeries") << imports_1_1() + "HorizontalPercentBarSeries{}";
QTest::newRow("pieSeries") << imports_1_1() + "PieSeries{}";
QTest::newRow("PieSlice") << imports_1_1() + "PieSlice{}";
QTest::newRow("BarSet") << imports_1_1() + "BarSet{}";
QTest::newRow("HXYModelMapper") << imports_1_1() + "HXYModelMapper{}";
QTest::newRow("VXYModelMapper") << imports_1_1() + "VXYModelMapper{}";
QTest::newRow("HPieModelMapper") << imports_1_1() + "HPieModelMapper{}";
QTest::newRow("HPieModelMapper") << imports_1_1() + "HPieModelMapper{}";
QTest::newRow("HBarModelMapper") << imports_1_1() + "HBarModelMapper{}";
QTest::newRow("VBarModelMapper") << imports_1_1() + "VBarModelMapper{}";
QTest::newRow("ValueAxis") << imports_1_1() + "ValueAxis{}";
Tero Ahola
Added the rest of the QML elements into qml unit tests
r2032 #ifndef QT_ON_ARM
Miikka Heikkinen
Add Polar chart support...
r2483 QTest::newRow("DateTimeAxis") << imports_1_1() + "DateTimeAxis{}";
Tero Ahola
Added the rest of the QML elements into qml unit tests
r2032 #endif
Miikka Heikkinen
Add Polar chart support...
r2483 QTest::newRow("CategoryAxis") << imports_1_1() + "CategoryAxis{}";
QTest::newRow("CategoryRange") << imports_1_1() + "CategoryRange{}";
QTest::newRow("BarCategoryAxis") << imports_1_1() + "BarCategoryAxis{}";
QTest::newRow("createPolarChartView") << imports_1_3() + "PolarChartView{}";
Miikka Heikkinen
Fix qml autotest after qtquick2 support was added...
r2499 QTest::newRow("LogValueAxis") << imports_1_3() + "LogValueAxis{}";
Titta Heikkala
Qt Charts project file structure change...
r2712 QTest::newRow("BoxPlotSeries") << imports_1_3() + "BoxPlotSeries{}";
QTest::newRow("BoxSet") << imports_1_3() + "BoxSet{}";
QTest::newRow("createChartView_2_0") << imports_2_0() + "ChartView{}";
QTest::newRow("XYPoint_2_0") << imports_2_0() + "XYPoint{}";
QTest::newRow("scatterSeries_2_0") << imports_2_0() + "ScatterSeries{}";
QTest::newRow("lineSeries_2_0") << imports_2_0() + "LineSeries{}";
QTest::newRow("splineSeries_2_0") << imports_2_0() + "SplineSeries{}";
QTest::newRow("areaSeries_2_0") << imports_2_0() + "AreaSeries{}";
QTest::newRow("barSeries_2_0") << imports_2_0() + "BarSeries{}";
QTest::newRow("stackedBarSeries_2_0") << imports_2_0() + "StackedBarSeries{}";
QTest::newRow("precentBarSeries_2_0") << imports_2_0() + "PercentBarSeries{}";
QTest::newRow("horizonatlBarSeries_2_0") << imports_2_0() + "HorizontalBarSeries{}";
QTest::newRow("horizonatlStackedBarSeries_2_0")
<< imports_2_0() + "HorizontalStackedBarSeries{}";
QTest::newRow("horizonatlstackedBarSeries_2_0")
<< imports_2_0() + "HorizontalPercentBarSeries{}";
QTest::newRow("pieSeries_2_0") << imports_2_0() + "PieSeries{}";
QTest::newRow("PieSlice_2_0") << imports_2_0() + "PieSlice{}";
QTest::newRow("BarSet_2_0") << imports_2_0() + "BarSet{}";
QTest::newRow("HXYModelMapper_2_0") << imports_2_0() + "HXYModelMapper{}";
QTest::newRow("VXYModelMapper_2_0") << imports_2_0() + "VXYModelMapper{}";
QTest::newRow("HPieModelMapper_2_0") << imports_2_0() + "HPieModelMapper{}";
QTest::newRow("HPieModelMapper_2_0") << imports_2_0() + "HPieModelMapper{}";
QTest::newRow("HBarModelMapper_2_0") << imports_2_0() + "HBarModelMapper{}";
QTest::newRow("VBarModelMapper_2_0") << imports_2_0() + "VBarModelMapper{}";
QTest::newRow("ValueAxis_2_0") << imports_2_0() + "ValueAxis{}";
#ifndef QT_ON_ARM
QTest::newRow("DateTimeAxis_2_0") << imports_2_0() + "DateTimeAxis{}";
#endif
QTest::newRow("CategoryAxis_2_0") << imports_2_0() + "CategoryAxis{}";
QTest::newRow("CategoryRange_2_0") << imports_2_0() + "CategoryRange{}";
QTest::newRow("BarCategoryAxis_2_0") << imports_2_0() + "BarCategoryAxis{}";
QTest::newRow("createPolarChartView_2_0") << imports_2_0() + "PolarChartView{}";
QTest::newRow("LogValueAxis_2_0") << imports_2_0() + "LogValueAxis{}";
QTest::newRow("BoxPlotSeries_2_0") << imports_2_0() + "BoxPlotSeries{}";
QTest::newRow("BoxSet_2_0") << imports_2_0() + "BoxSet{}";
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 }
Titta Heikkala
Qt Charts project file structure change...
r2712 void tst_qml::checkPlugin()
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 {
QFETCH(QString, source);
Titta Heikkala
Qt Charts project file structure change...
r2712 QQmlEngine engine;
engine.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("qml")));
QQmlComponent component(&engine);
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 component.setData(source.toLatin1(), QUrl());
QVERIFY2(!component.isError(), qPrintable(componentErrors(&component)));
Titta Heikkala
Qt Charts project file structure change...
r2712 TRY_COMPARE(component.status(), QQmlComponent::Ready);
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 QObject *obj = component.create();
QVERIFY(obj != 0);
delete obj;
}
Titta Heikkala
Qt Charts project file structure change...
r2712 QTEST_MAIN(tst_qml)
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997
#include "tst_qml.moc"