@@ -0,0 +1,5 | |||||
|
1 | !include( ../auto.pri ) { | |||
|
2 | error( "Couldn't find the auto.pri file!" ) | |||
|
3 | } | |||
|
4 | SOURCES += tst_qml.cpp | |||
|
5 | QT += declarative |
@@ -0,0 +1,120 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE$ | |||
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |||
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |||
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |||
|
13 | ** a written agreement between you and Digia. | |||
|
14 | ** | |||
|
15 | ** If you have questions regarding the use of this file, please use | |||
|
16 | ** contact form at http://qt.digia.com | |||
|
17 | ** $QT_END_LICENSE$ | |||
|
18 | ** | |||
|
19 | ****************************************************************************/ | |||
|
20 | #include <QtTest/QtTest> | |||
|
21 | #include <QDeclarativeEngine> | |||
|
22 | #include <QDeclarativeComponent> | |||
|
23 | #include "tst_definitions.h" | |||
|
24 | ||||
|
25 | class tst_QML : public QObject | |||
|
26 | { | |||
|
27 | Q_OBJECT | |||
|
28 | ||||
|
29 | public slots: | |||
|
30 | void initTestCase(); | |||
|
31 | void cleanupTestCase(); | |||
|
32 | void init(); | |||
|
33 | void cleanup(); | |||
|
34 | private slots: | |||
|
35 | void checkPlugin_data(); | |||
|
36 | void checkPlugin(); | |||
|
37 | private: | |||
|
38 | QString componentErrors(const QDeclarativeComponent* component) const; | |||
|
39 | QString imports(); | |||
|
40 | ||||
|
41 | }; | |||
|
42 | ||||
|
43 | QString tst_QML::componentErrors(const QDeclarativeComponent* component) const | |||
|
44 | { | |||
|
45 | Q_ASSERT(component); | |||
|
46 | ||||
|
47 | QStringList errors; | |||
|
48 | ||||
|
49 | foreach (QDeclarativeError const& error, component->errors()) { | |||
|
50 | errors << error.toString(); | |||
|
51 | } | |||
|
52 | ||||
|
53 | return errors.join("\n"); | |||
|
54 | } | |||
|
55 | ||||
|
56 | QString tst_QML::imports() | |||
|
57 | { | |||
|
58 | return "import QtQuick 1.0 \n" | |||
|
59 | "import QtCommercial.Chart 1.1 \n"; | |||
|
60 | } | |||
|
61 | ||||
|
62 | ||||
|
63 | void tst_QML::initTestCase() | |||
|
64 | { | |||
|
65 | } | |||
|
66 | ||||
|
67 | void tst_QML::cleanupTestCase() | |||
|
68 | { | |||
|
69 | } | |||
|
70 | ||||
|
71 | void tst_QML::init() | |||
|
72 | { | |||
|
73 | ||||
|
74 | } | |||
|
75 | ||||
|
76 | void tst_QML::cleanup() | |||
|
77 | { | |||
|
78 | ||||
|
79 | } | |||
|
80 | ||||
|
81 | void tst_QML::checkPlugin_data() | |||
|
82 | { | |||
|
83 | QTest::addColumn<QString>("source"); | |||
|
84 | QTest::newRow("createChartView") << imports() + "ChartView{}"; | |||
|
85 | QTest::newRow("lineSeries") << imports() + "LineSeries{}"; | |||
|
86 | QTest::newRow("splineSeries") << imports() + "SplineSeries{}"; | |||
|
87 | QTest::newRow("scatterSeries") << imports() + "ScatterSeries{}"; | |||
|
88 | QTest::newRow("areaSeries") << imports() + "AreaSeries{}"; | |||
|
89 | QTest::newRow("barSeries") << imports() + "BarSeries{}"; | |||
|
90 | QTest::newRow("stackedBarSeries") << imports() + "StackedBarSeries{}"; | |||
|
91 | QTest::newRow("precentBarSeries") << imports() + "PercentBarSeries{}"; | |||
|
92 | QTest::newRow("horizonatlBarSeries") << imports() + "HorizontalBarSeries{}"; | |||
|
93 | QTest::newRow("horizonatlStackedBarSeries") << imports() + "HorizontalStackedBarSeries{}"; | |||
|
94 | QTest::newRow("horizonatlstackedBarSeries") << imports() + "HorizontalPercentBarSeries{}"; | |||
|
95 | QTest::newRow("pieSeries") << imports() + "PieSeries{}"; | |||
|
96 | } | |||
|
97 | ||||
|
98 | ||||
|
99 | void tst_QML::checkPlugin() | |||
|
100 | { | |||
|
101 | QFETCH(QString, source); | |||
|
102 | QDeclarativeEngine engine; | |||
|
103 | QDeclarativeComponent component(&engine); | |||
|
104 | component.setData(source.toLatin1(), QUrl()); | |||
|
105 | QVERIFY2(!component.isError(), qPrintable(componentErrors(&component))); | |||
|
106 | TRY_COMPARE(component.status(), QDeclarativeComponent::Ready); | |||
|
107 | QObject *obj = component.create(); | |||
|
108 | QVERIFY(obj != 0); | |||
|
109 | ||||
|
110 | // | |||
|
111 | //TODO: | |||
|
112 | // QCOMPARE(obj->property("something").toInt(), 0); | |||
|
113 | ||||
|
114 | delete obj; | |||
|
115 | } | |||
|
116 | ||||
|
117 | QTEST_MAIN(tst_QML) | |||
|
118 | ||||
|
119 | #include "tst_qml.moc" | |||
|
120 |
@@ -1,35 +1,36 | |||||
1 | !include( ../tests.pri ) { |
|
1 | !include( ../tests.pri ) { | |
2 | error( "Couldn't find the tests.pri file!" ) |
|
2 | error( "Couldn't find the tests.pri file!" ) | |
3 | } |
|
3 | } | |
4 |
|
4 | |||
5 | TEMPLATE = subdirs |
|
5 | TEMPLATE = subdirs | |
6 | SUBDIRS += \ |
|
6 | SUBDIRS += \ | |
7 | qchartview \ |
|
7 | qchartview \ | |
8 | qchart \ |
|
8 | qchart \ | |
9 | qlineseries \ |
|
9 | qlineseries \ | |
10 | qbarset \ |
|
10 | qbarset \ | |
11 | qbarseries \ |
|
11 | qbarseries \ | |
12 | qstackedbarseries \ |
|
12 | qstackedbarseries \ | |
13 | qpercentbarseries \ |
|
13 | qpercentbarseries \ | |
14 | qpieslice qpieseries \ |
|
14 | qpieslice qpieseries \ | |
15 | qpiemodelmapper \ |
|
15 | qpiemodelmapper \ | |
16 | qsplineseries \ |
|
16 | qsplineseries \ | |
17 | qscatterseries \ |
|
17 | qscatterseries \ | |
18 | qxymodelmapper \ |
|
18 | qxymodelmapper \ | |
19 | qbarmodelmapper \ |
|
19 | qbarmodelmapper \ | |
20 | qhorizontalbarseries \ |
|
20 | qhorizontalbarseries \ | |
21 | qhorizontalstackedbarseries \ |
|
21 | qhorizontalstackedbarseries \ | |
22 | qhorizontalpercentbarseries \ |
|
22 | qhorizontalpercentbarseries \ | |
23 | qvalueaxis \ |
|
23 | qvalueaxis \ | |
24 | qcategoryaxis \ |
|
24 | qcategoryaxis \ | |
25 | qbarcategoryaxis \ |
|
25 | qbarcategoryaxis \ | |
26 | domain \ |
|
26 | domain \ | |
27 | chartdataset |
|
27 | chartdataset \ | |
|
28 | qml | |||
28 |
|
29 | |||
29 | !linux-arm*: { |
|
30 | !linux-arm*: { | |
30 | SUBDIRS += \ |
|
31 | SUBDIRS += \ | |
31 | qdatetimeaxis |
|
32 | qdatetimeaxis | |
32 | } |
|
33 | } | |
33 |
|
34 | |||
34 |
|
35 | |||
35 |
|
36 |
General Comments 0
You need to be logged in to leave comments.
Login now