##// END OF EJS Templates
In QML axisXTop didn't go top...
In QML axisXTop didn't go top It looked like the signal was connected to wrong slot. Probably copy&paste bug. Change-Id: Ie4887970891f3b902b71fb0b686c4adbbc1d48b1 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>

File last commit:

r2574:599370d0561c
r2576:dee90918a18a
Show More
tst_qml.cpp
153 lines | 4.9 KiB | text/x-c | CppLexer
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 /****************************************************************************
**
Miikka Heikkinen
More copyright year changes
r2433 ** Copyright (C) 2013 Digia Plc
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 ** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
Miikka Heikkinen
Qt Commercial -> Qt Enterprise...
r2574 ** This file is part of the Qt Enterprise Charts Add-on.
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 **
** $QT_BEGIN_LICENSE$
Miikka Heikkinen
Qt Commercial -> Qt Enterprise...
r2574 ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 ** 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 <QDeclarativeEngine>
#include <QDeclarativeComponent>
Heikkinen Miikka
Fix qml application deployment for android...
r2523 #include <QDir>
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 #include "tst_definitions.h"
class tst_QML : public QObject
{
Q_OBJECT
public slots:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
private slots:
void checkPlugin_data();
void checkPlugin();
private:
QString componentErrors(const QDeclarativeComponent* component) const;
Miikka Heikkinen
Add Polar chart support...
r2483 QString imports_1_1();
QString imports_1_3();
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997
};
QString tst_QML::componentErrors(const QDeclarativeComponent* component) const
{
Q_ASSERT(component);
QStringList errors;
foreach (QDeclarativeError const& error, component->errors()) {
errors << error.toString();
}
return errors.join("\n");
}
Miikka Heikkinen
Add Polar chart support...
r2483 QString tst_QML::imports_1_1()
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 {
return "import QtQuick 1.0 \n"
"import QtCommercial.Chart 1.1 \n";
}
Miikka Heikkinen
Add Polar chart support...
r2483 QString tst_QML::imports_1_3()
{
return "import QtQuick 1.0 \n"
"import QtCommercial.Chart 1.3 \n";
}
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997
void tst_QML::initTestCase()
{
}
void tst_QML::cleanupTestCase()
{
}
void tst_QML::init()
{
}
void tst_QML::cleanup()
{
}
void tst_QML::checkPlugin_data()
{
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{}";
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 }
void tst_QML::checkPlugin()
{
QFETCH(QString, source);
QDeclarativeEngine engine;
Heikkinen Miikka
Fix qml application deployment for android...
r2523 #ifdef Q_OS_ANDROID
engine.addImportPath(QString::fromLatin1("assets:/imports"));
engine.addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
#else
engine.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
#endif
Michal Klocek
Adds tst_qml basic stub for checking plugin loading qml
r1997 QDeclarativeComponent component(&engine);
component.setData(source.toLatin1(), QUrl());
QVERIFY2(!component.isError(), qPrintable(componentErrors(&component)));
TRY_COMPARE(component.status(), QDeclarativeComponent::Ready);
QObject *obj = component.create();
QVERIFY(obj != 0);
//
//TODO:
// QCOMPARE(obj->property("something").toInt(), 0);
delete obj;
}
QTEST_MAIN(tst_QML)
#include "tst_qml.moc"