@@ -0,0 +1,5 | |||||
|
1 | !include( ../auto.pri ) { | |||
|
2 | error( "Couldn't find the auto.pri file!" ) | |||
|
3 | } | |||
|
4 | SOURCES += tst_quick2.cpp | |||
|
5 | QT += qml quick |
@@ -0,0 +1,142 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2013 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 <QtQml/QQmlEngine> | |||
|
22 | #include <QtQml/QQmlComponent> | |||
|
23 | #include "tst_definitions.h" | |||
|
24 | ||||
|
25 | class tst_quick2 : 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 QQmlComponent* component) const; | |||
|
39 | QString imports_1_1(); | |||
|
40 | QString imports_1_3(); | |||
|
41 | ||||
|
42 | }; | |||
|
43 | ||||
|
44 | QString tst_quick2::componentErrors(const QQmlComponent* component) const | |||
|
45 | { | |||
|
46 | Q_ASSERT(component); | |||
|
47 | ||||
|
48 | QStringList errors; | |||
|
49 | ||||
|
50 | foreach (QQmlError const& error, component->errors()) { | |||
|
51 | errors << error.toString(); | |||
|
52 | } | |||
|
53 | ||||
|
54 | return errors.join("\n"); | |||
|
55 | } | |||
|
56 | ||||
|
57 | QString tst_quick2::imports_1_1() | |||
|
58 | { | |||
|
59 | return "import QtQuick 2.0 \n" | |||
|
60 | "import QtCommercial.Chart 1.1 \n"; | |||
|
61 | } | |||
|
62 | ||||
|
63 | QString tst_quick2::imports_1_3() | |||
|
64 | { | |||
|
65 | return "import QtQuick 2.0 \n" | |||
|
66 | "import QtCommercial.Chart 1.3 \n"; | |||
|
67 | } | |||
|
68 | ||||
|
69 | ||||
|
70 | void tst_quick2::initTestCase() | |||
|
71 | { | |||
|
72 | } | |||
|
73 | ||||
|
74 | void tst_quick2::cleanupTestCase() | |||
|
75 | { | |||
|
76 | } | |||
|
77 | ||||
|
78 | void tst_quick2::init() | |||
|
79 | { | |||
|
80 | ||||
|
81 | } | |||
|
82 | ||||
|
83 | void tst_quick2::cleanup() | |||
|
84 | { | |||
|
85 | ||||
|
86 | } | |||
|
87 | ||||
|
88 | void tst_quick2::checkPlugin_data() | |||
|
89 | { | |||
|
90 | QTest::addColumn<QString>("source"); | |||
|
91 | ||||
|
92 | QTest::newRow("createChartView") << imports_1_1() + "ChartView{}"; | |||
|
93 | QTest::newRow("XYPoint") << imports_1_1() + "XYPoint{}"; | |||
|
94 | QTest::newRow("scatterSeries") << imports_1_1() + "ScatterSeries{}"; | |||
|
95 | QTest::newRow("lineSeries") << imports_1_1() + "LineSeries{}"; | |||
|
96 | QTest::newRow("splineSeries") << imports_1_1() + "SplineSeries{}"; | |||
|
97 | QTest::newRow("areaSeries") << imports_1_1() + "AreaSeries{}"; | |||
|
98 | QTest::newRow("barSeries") << imports_1_1() + "BarSeries{}"; | |||
|
99 | QTest::newRow("stackedBarSeries") << imports_1_1() + "StackedBarSeries{}"; | |||
|
100 | QTest::newRow("precentBarSeries") << imports_1_1() + "PercentBarSeries{}"; | |||
|
101 | QTest::newRow("horizonatlBarSeries") << imports_1_1() + "HorizontalBarSeries{}"; | |||
|
102 | QTest::newRow("horizonatlStackedBarSeries") << imports_1_1() + "HorizontalStackedBarSeries{}"; | |||
|
103 | QTest::newRow("horizonatlstackedBarSeries") << imports_1_1() + "HorizontalPercentBarSeries{}"; | |||
|
104 | QTest::newRow("pieSeries") << imports_1_1() + "PieSeries{}"; | |||
|
105 | QTest::newRow("PieSlice") << imports_1_1() + "PieSlice{}"; | |||
|
106 | QTest::newRow("BarSet") << imports_1_1() + "BarSet{}"; | |||
|
107 | QTest::newRow("HXYModelMapper") << imports_1_1() + "HXYModelMapper{}"; | |||
|
108 | QTest::newRow("VXYModelMapper") << imports_1_1() + "VXYModelMapper{}"; | |||
|
109 | QTest::newRow("HPieModelMapper") << imports_1_1() + "HPieModelMapper{}"; | |||
|
110 | QTest::newRow("HPieModelMapper") << imports_1_1() + "HPieModelMapper{}"; | |||
|
111 | QTest::newRow("HBarModelMapper") << imports_1_1() + "HBarModelMapper{}"; | |||
|
112 | QTest::newRow("VBarModelMapper") << imports_1_1() + "VBarModelMapper{}"; | |||
|
113 | QTest::newRow("ValueAxis") << imports_1_1() + "ValueAxis{}"; | |||
|
114 | #ifndef QT_ON_ARM | |||
|
115 | QTest::newRow("DateTimeAxis") << imports_1_1() + "DateTimeAxis{}"; | |||
|
116 | #endif | |||
|
117 | QTest::newRow("CategoryAxis") << imports_1_1() + "CategoryAxis{}"; | |||
|
118 | QTest::newRow("CategoryRange") << imports_1_1() + "CategoryRange{}"; | |||
|
119 | QTest::newRow("BarCategoryAxis") << imports_1_1() + "BarCategoryAxis{}"; | |||
|
120 | ||||
|
121 | QTest::newRow("createPolarChartView") << imports_1_3() + "PolarChartView{}"; | |||
|
122 | QTest::newRow("LogValueAxis") << imports_1_3() + "LogValueAxis{}"; | |||
|
123 | } | |||
|
124 | ||||
|
125 | void tst_quick2::checkPlugin() | |||
|
126 | { | |||
|
127 | QFETCH(QString, source); | |||
|
128 | QQmlEngine engine; | |||
|
129 | engine.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("qml"))); | |||
|
130 | QQmlComponent component(&engine); | |||
|
131 | component.setData(source.toLatin1(), QUrl()); | |||
|
132 | QVERIFY2(!component.isError(), qPrintable(componentErrors(&component))); | |||
|
133 | TRY_COMPARE(component.status(), QQmlComponent::Ready); | |||
|
134 | QObject *obj = component.create(); | |||
|
135 | QVERIFY(obj != 0); | |||
|
136 | delete obj; | |||
|
137 | } | |||
|
138 | ||||
|
139 | QTEST_MAIN(tst_quick2) | |||
|
140 | ||||
|
141 | #include "tst_quick2.moc" | |||
|
142 |
@@ -46,5 +46,9 contains(QT_VERSION, ^4\\.[0-7]\\.[0-3]\\s*$) | contains(QT_VERSION, ^4\\.[0-6]\ | |||||
46 | qdatetimeaxis |
|
46 | qdatetimeaxis | |
47 | } |
|
47 | } | |
48 |
|
48 | |||
|
49 | contains(QT_VERSION, ^5\\..*\\..*$):qtHaveModule(quick) { | |||
|
50 | SUBDIRS += quick2 | |||
|
51 | } | |||
|
52 | ||||
49 |
|
53 | |||
50 |
|
54 |
@@ -119,13 +119,14 void tst_QML::checkPlugin_data() | |||||
119 | QTest::newRow("BarCategoryAxis") << imports_1_1() + "BarCategoryAxis{}"; |
|
119 | QTest::newRow("BarCategoryAxis") << imports_1_1() + "BarCategoryAxis{}"; | |
120 |
|
120 | |||
121 | QTest::newRow("createPolarChartView") << imports_1_3() + "PolarChartView{}"; |
|
121 | QTest::newRow("createPolarChartView") << imports_1_3() + "PolarChartView{}"; | |
122 |
|
|
122 | QTest::newRow("LogValueAxis") << imports_1_3() + "LogValueAxis{}"; | |
123 | } |
|
123 | } | |
124 |
|
124 | |||
125 | void tst_QML::checkPlugin() |
|
125 | void tst_QML::checkPlugin() | |
126 | { |
|
126 | { | |
127 | QFETCH(QString, source); |
|
127 | QFETCH(QString, source); | |
128 | QDeclarativeEngine engine; |
|
128 | QDeclarativeEngine engine; | |
|
129 | engine.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports"))); | |||
129 | QDeclarativeComponent component(&engine); |
|
130 | QDeclarativeComponent component(&engine); | |
130 | component.setData(source.toLatin1(), QUrl()); |
|
131 | component.setData(source.toLatin1(), QUrl()); | |
131 | QVERIFY2(!component.isError(), qPrintable(componentErrors(&component))); |
|
132 | QVERIFY2(!component.isError(), qPrintable(componentErrors(&component))); |
General Comments 0
You need to be logged in to leave comments.
Login now