aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativemoduleplugin
diff options
context:
space:
mode:
authorQt by Nokia <qt-info@nokia.com>2011-04-27 12:05:43 +0200
committeraxis <qt-info@nokia.com>2011-04-27 12:05:43 +0200
commit885735d011472bcfbb96e688d9e64553d7fe9d4b (patch)
tree734963625eba643bf11bc4870a4c407809a6400a /tests/auto/declarative/qdeclarativemoduleplugin
Initial import from the monolithic Qt.
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12
Diffstat (limited to 'tests/auto/declarative/qdeclarativemoduleplugin')
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.2.qml21
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.qml13
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/incorrectCase.qml4
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/pluginWithQmlFile.qml3
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.qml5
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.qml6
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/works.qml3
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/works2.qml3
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/works21.qml3
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestPluginWithQmlFile/MyQmlFile.qml3
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestPluginWithQmlFile/qmldir3
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/Foo.qml5
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/qmldir2
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType.2.1/qmldir1
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType.2/qmldir1
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType/qmldir1
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlVersionPluginType/qmldir1
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/ComponentA.qml3
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/ComponentB.qml4
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/qmldir3
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/WrongCase/qmldir1
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.2.1.pro9
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp84
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.2.pro9
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp84
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp83
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro9
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp73
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/pluginMixed.pro9
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp73
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/pluginVersion.pro9
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp58
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro9
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp83
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/pluginWrongCase.pro10
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro8
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp313
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro15
40 files changed, 1029 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.2.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.2.qml
new file mode 100644
index 0000000000..70b2bfd837
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.2.qml
@@ -0,0 +1,21 @@
+import com.nokia.AutoTestQmlMixedPluginType 1.5
+import QtQuick 1.0
+
+Item {
+ property bool test: false
+ property bool test2: false
+
+ Bar {
+ id: bar
+ }
+
+ Foo {
+ id: foo
+ }
+
+ Component.onCompleted: {
+ test = (bar.value == 16);
+ test2 = (foo.value == 89);
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.qml
new file mode 100644
index 0000000000..da6ff4656a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.qml
@@ -0,0 +1,13 @@
+import com.nokia.AutoTestQmlMixedPluginType 1.0
+import QtQuick 1.0
+
+Item {
+ property bool test: false
+ Bar {
+ id: bar
+ }
+
+ Component.onCompleted: {
+ test = (bar.value == 16);
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/incorrectCase.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/incorrectCase.qml
new file mode 100644
index 0000000000..a21ece7058
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/incorrectCase.qml
@@ -0,0 +1,4 @@
+import com.nokia.WrongCase 1.0
+
+MyPluginType { value: 123 }
+
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/pluginWithQmlFile.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/pluginWithQmlFile.qml
new file mode 100644
index 0000000000..a9e28e5d8b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/pluginWithQmlFile.qml
@@ -0,0 +1,3 @@
+import com.nokia.AutoTestPluginWithQmlFile 1.0
+
+MyQmlFile {}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.errors.txt b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.errors.txt
new file mode 100644
index 0000000000..a40c1c8211
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.errors.txt
@@ -0,0 +1 @@
+1:1:module "com.nokia.AutoTestQmlVersionPluginType" version 1.9 is not installed
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.qml
new file mode 100644
index 0000000000..59fd084a49
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.qml
@@ -0,0 +1,5 @@
+import com.nokia.AutoTestQmlVersionPluginType 1.9
+import QtQuick 1.0
+
+QtObject {
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.errors.txt b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.errors.txt
new file mode 100644
index 0000000000..2634223de7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.errors.txt
@@ -0,0 +1 @@
+1:1:module "com.nokia.AutoTestQmlVersionPluginType" version 1.1 is not installed
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.qml
new file mode 100644
index 0000000000..2065c0712f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.qml
@@ -0,0 +1,6 @@
+import com.nokia.AutoTestQmlVersionPluginType 1.1
+import QtQuick 1.0
+
+QtObject {
+}
+
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/works.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/works.qml
new file mode 100644
index 0000000000..f29ae24ea2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/works.qml
@@ -0,0 +1,3 @@
+import com.nokia.AutoTestQmlPluginType 1.0
+
+MyPluginType { value: 123 }
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/works2.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/works2.qml
new file mode 100644
index 0000000000..cc322bf26b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/works2.qml
@@ -0,0 +1,3 @@
+import com.nokia.AutoTestQmlPluginType 2.0
+
+MyPluginType { valueOnlyIn2: 123 }
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/works21.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/works21.qml
new file mode 100644
index 0000000000..c08160ac5a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/works21.qml
@@ -0,0 +1,3 @@
+import com.nokia.AutoTestQmlPluginType 2.1
+
+MyPluginType { valueOnlyIn2: 123 }
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestPluginWithQmlFile/MyQmlFile.qml b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestPluginWithQmlFile/MyQmlFile.qml
new file mode 100644
index 0000000000..18dcd26f60
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestPluginWithQmlFile/MyQmlFile.qml
@@ -0,0 +1,3 @@
+import QtQuick 1.0
+
+Item {} \ No newline at end of file
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestPluginWithQmlFile/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestPluginWithQmlFile/qmldir
new file mode 100644
index 0000000000..858ba1450e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestPluginWithQmlFile/qmldir
@@ -0,0 +1,3 @@
+MyQmlFile 1.0 MyQmlFile.qml
+plugin pluginWithQmlFile
+
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/Foo.qml b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/Foo.qml
new file mode 100644
index 0000000000..ce51cbd2ec
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/Foo.qml
@@ -0,0 +1,5 @@
+import QtQuick 1.0
+
+Item {
+ property int value: 89
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/qmldir
new file mode 100644
index 0000000000..065dc3b21f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/qmldir
@@ -0,0 +1,2 @@
+plugin pluginMixed
+Foo 1.5 Foo.qml
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType.2.1/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType.2.1/qmldir
new file mode 100644
index 0000000000..0a8b5d46eb
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType.2.1/qmldir
@@ -0,0 +1 @@
+plugin plugin
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType.2/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType.2/qmldir
new file mode 100644
index 0000000000..0a8b5d46eb
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType.2/qmldir
@@ -0,0 +1 @@
+plugin plugin
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType/qmldir
new file mode 100644
index 0000000000..0a8b5d46eb
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlPluginType/qmldir
@@ -0,0 +1 @@
+plugin plugin
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlVersionPluginType/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlVersionPluginType/qmldir
new file mode 100644
index 0000000000..640967fe40
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlVersionPluginType/qmldir
@@ -0,0 +1 @@
+plugin pluginVersion
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/ComponentA.qml b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/ComponentA.qml
new file mode 100644
index 0000000000..49613aab2d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/ComponentA.qml
@@ -0,0 +1,3 @@
+import QtQuick 1.0
+
+Item {}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/ComponentB.qml b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/ComponentB.qml
new file mode 100644
index 0000000000..f19a336d69
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/ComponentB.qml
@@ -0,0 +1,4 @@
+import QtQuick 1.0
+
+Item {}
+
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/qmldir
new file mode 100644
index 0000000000..167bb10c21
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/PureQmlModule/qmldir
@@ -0,0 +1,3 @@
+ComponentA 1.0 ComponentA.qml
+ComponentB 1.0 ComponentB.qml
+
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/WrongCase/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/WrongCase/qmldir
new file mode 100644
index 0000000000..6c8787498f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/WrongCase/qmldir
@@ -0,0 +1 @@
+plugin PluGin
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.2.1.pro b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.2.1.pro
new file mode 100644
index 0000000000..661675ae79
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.2.1.pro
@@ -0,0 +1,9 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core declarative
+DESTDIR = ../imports/com/nokia/AutoTestQmlPluginType.2.1
+
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp
new file mode 100644
index 0000000000..1ae2bd4fa7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2.1/plugin.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtDeclarative/qdeclarative.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue)
+ Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue)
+
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent)
+ {
+ qWarning("import2.1 worked");
+ }
+
+ int value() const { return v; }
+ void setValue(int i) { v = i; }
+
+private:
+ int v;
+};
+
+
+class MyPlugin : public QDeclarativeExtensionPlugin
+{
+ Q_OBJECT
+public:
+ MyPlugin()
+ {
+ qWarning("plugin2.1 created");
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlPluginType");
+ qmlRegisterType<MyPluginType>(uri, 2, 1, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
+
+Q_EXPORT_PLUGIN2(plugin, MyPlugin);
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.2.pro b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.2.pro
new file mode 100644
index 0000000000..d2546429db
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.2.pro
@@ -0,0 +1,9 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core declarative
+DESTDIR = ../imports/com/nokia/AutoTestQmlPluginType.2
+
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp
new file mode 100644
index 0000000000..6bd8542289
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.2/plugin.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtDeclarative/qdeclarative.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue)
+ Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue)
+
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent)
+ {
+ qWarning("import2 worked");
+ }
+
+ int value() const { return v; }
+ void setValue(int i) { v = i; }
+
+private:
+ int v;
+};
+
+
+class MyPlugin : public QDeclarativeExtensionPlugin
+{
+ Q_OBJECT
+public:
+ MyPlugin()
+ {
+ qWarning("plugin2 created");
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlPluginType");
+ qmlRegisterType<MyPluginType>(uri, 2, 0, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
+
+Q_EXPORT_PLUGIN2(plugin, MyPlugin);
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp
new file mode 100644
index 0000000000..1a306c91cc
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtDeclarative/qdeclarative.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue)
+
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent)
+ {
+ qWarning("import worked");
+ }
+
+ int value() const { return v; }
+ void setValue(int i) { v = i; }
+
+private:
+ int v;
+};
+
+
+class MyPlugin : public QDeclarativeExtensionPlugin
+{
+ Q_OBJECT
+public:
+ MyPlugin()
+ {
+ qWarning("plugin created");
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlPluginType");
+ qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
+
+Q_EXPORT_PLUGIN2(plugin, MyPlugin);
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro
new file mode 100644
index 0000000000..173a3026fb
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro
@@ -0,0 +1,9 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core declarative
+DESTDIR = ../imports/com/nokia/AutoTestQmlPluginType
+
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp
new file mode 100644
index 0000000000..c7796e22c3
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtDeclarative/qdeclarative.h>
+#include <QDebug>
+
+class BarPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value);
+
+public:
+ int value() const { return 16; }
+};
+
+
+class MyMixedPlugin : public QDeclarativeExtensionPlugin
+{
+ Q_OBJECT
+public:
+ MyMixedPlugin()
+ {
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlMixedPluginType");
+ qmlRegisterType<BarPluginType>(uri, 1, 0, "Bar");
+ }
+};
+
+#include "plugin.moc"
+
+Q_EXPORT_PLUGIN2(plugin, MyMixedPlugin);
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/pluginMixed.pro b/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/pluginMixed.pro
new file mode 100644
index 0000000000..9766003e74
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/pluginMixed.pro
@@ -0,0 +1,9 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core declarative
+DESTDIR = ../imports/com/nokia/AutoTestQmlMixedPluginType
+
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp
new file mode 100644
index 0000000000..27a63419b5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtDeclarative/qdeclarative.h>
+#include <QDebug>
+
+class FloorPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value);
+
+public:
+ int value() const { return 16; }
+};
+
+
+class MyMixedPlugin : public QDeclarativeExtensionPlugin
+{
+ Q_OBJECT
+public:
+ MyMixedPlugin()
+ {
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlVersionPluginType");
+ qmlRegisterType<FloorPluginType>(uri, 1, 4, "Floor");
+ }
+};
+
+#include "plugin.moc"
+
+Q_EXPORT_PLUGIN2(plugin, MyMixedPlugin);
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/pluginVersion.pro b/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/pluginVersion.pro
new file mode 100644
index 0000000000..70a38b9a7d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/pluginVersion.pro
@@ -0,0 +1,9 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core declarative
+DESTDIR = ../imports/com/nokia/AutoTestQmlVersionPluginType
+
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp
new file mode 100644
index 0000000000..20e2d80d53
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/plugin.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtDeclarative/qdeclarative.h>
+#include <QDebug>
+
+class MyPlugin : public QDeclarativeExtensionPlugin
+{
+ Q_OBJECT
+public:
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestPluginWithQmlFile");
+ }
+};
+
+#include "plugin.moc"
+
+Q_EXPORT_PLUGIN2(plugin, MyPlugin);
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro
new file mode 100644
index 0000000000..aa9c95c483
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWithQmlFile/pluginWithQmlFile.pro
@@ -0,0 +1,9 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core declarative
+DESTDIR = ../imports/com/nokia/AutoTestPluginWithQmlFile
+
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp
new file mode 100644
index 0000000000..56302111be
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtDeclarative/qdeclarative.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue)
+
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent)
+ {
+ qWarning("import worked");
+ }
+
+ int value() const { return v; }
+ void setValue(int i) { v = i; }
+
+private:
+ int v;
+};
+
+
+class MyPlugin : public QDeclarativeExtensionPlugin
+{
+ Q_OBJECT
+public:
+ MyPlugin()
+ {
+ qWarning("plugin created");
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.WrongCase");
+ qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
+ }
+};
+
+#include "plugin.moc"
+
+Q_EXPORT_PLUGIN2(plugin, MyPlugin);
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/pluginWrongCase.pro b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/pluginWrongCase.pro
new file mode 100644
index 0000000000..c7337ca07c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/pluginWrongCase.pro
@@ -0,0 +1,10 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core declarative
+TARGET = Plugin
+DESTDIR = ../imports/com/nokia/WrongCase
+
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro
new file mode 100644
index 0000000000..6e72d9833b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro
@@ -0,0 +1,8 @@
+QT = core
+TEMPLATE = subdirs
+SUBDIRS = plugin plugin.2 plugin.2.1 pluginWrongCase pluginWithQmlFile pluginMixed pluginVersion
+tst_qdeclarativemoduleplugin_pro.depends += plugin
+SUBDIRS += tst_qdeclarativemoduleplugin.pro
+
+CONFIG += parallel_test
+
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
new file mode 100644
index 0000000000..9d1c609616
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
@@ -0,0 +1,313 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <qdir.h>
+#include <QtDeclarative/qdeclarativeengine.h>
+#include <QtDeclarative/qdeclarativecomponent.h>
+#include <QDebug>
+
+#include "../shared/testhttpserver.h"
+#include "../../../shared/util.h"
+
+#define SERVER_ADDR "http://127.0.0.1:14450"
+#define SERVER_PORT 14450
+
+
+class tst_qdeclarativemoduleplugin : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qdeclarativemoduleplugin()
+ {
+ }
+
+private slots:
+ void importsPlugin();
+ void importsPlugin2();
+ void importsPlugin21();
+ void importsMixedQmlCppPlugin();
+ void incorrectPluginCase();
+ void importPluginWithQmlFile();
+ void remoteImportWithQuotedUrl();
+ void remoteImportWithUnquotedUri();
+ void versionNotInstalled();
+ void versionNotInstalled_data();
+};
+
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+#define SRCDIR "."
+#endif
+
+#define VERIFY_ERRORS(errorfile) \
+ if (!errorfile) { \
+ if (qgetenv("DEBUG") != "" && !component.errors().isEmpty()) \
+ qWarning() << "Unexpected Errors:" << component.errors(); \
+ QVERIFY(!component.isError()); \
+ QVERIFY(component.errors().isEmpty()); \
+ } else { \
+ QFile file(QLatin1String("data/") + QLatin1String(errorfile)); \
+ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); \
+ QByteArray data = file.readAll(); \
+ file.close(); \
+ QList<QByteArray> expected = data.split('\n'); \
+ expected.removeAll(QByteArray("")); \
+ QList<QDeclarativeError> errors = component.errors(); \
+ QList<QByteArray> actual; \
+ for (int ii = 0; ii < errors.count(); ++ii) { \
+ const QDeclarativeError &error = errors.at(ii); \
+ QByteArray errorStr = QByteArray::number(error.line()) + ":" + \
+ QByteArray::number(error.column()) + ":" + \
+ error.description().toUtf8(); \
+ actual << errorStr; \
+ } \
+ if (qgetenv("DEBUG") != "" && expected != actual) \
+ qWarning() << "Expected:" << expected << "Actual:" << actual; \
+ if (qgetenv("QDECLARATIVELANGUAGE_UPDATEERRORS") != "" && expected != actual) {\
+ QFile file(QLatin1String("data/") + QLatin1String(errorfile)); \
+ QVERIFY(file.open(QIODevice::WriteOnly)); \
+ for (int ii = 0; ii < actual.count(); ++ii) { \
+ file.write(actual.at(ii)); file.write("\n"); \
+ } \
+ file.close(); \
+ } else { \
+ QCOMPARE(expected, actual); \
+ } \
+ }
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ QFileInfo fileInfo(__FILE__);
+ return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename));
+}
+
+
+void tst_qdeclarativemoduleplugin::importsPlugin()
+{
+ QDeclarativeEngine engine;
+ engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports"));
+ QTest::ignoreMessage(QtWarningMsg, "plugin created");
+ QTest::ignoreMessage(QtWarningMsg, "import worked");
+ QDeclarativeComponent component(&engine, TEST_FILE("data/works.qml"));
+ foreach (QDeclarativeError err, component.errors())
+ qWarning() << err;
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("value").toInt(),123);
+ delete object;
+}
+
+void tst_qdeclarativemoduleplugin::importsPlugin2()
+{
+ QDeclarativeEngine engine;
+ engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports"));
+ QTest::ignoreMessage(QtWarningMsg, "plugin2 created");
+ QTest::ignoreMessage(QtWarningMsg, "import2 worked");
+ QDeclarativeComponent component(&engine, TEST_FILE("data/works2.qml"));
+ foreach (QDeclarativeError err, component.errors())
+ qWarning() << err;
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("value").toInt(),123);
+ delete object;
+}
+
+void tst_qdeclarativemoduleplugin::importsPlugin21()
+{
+ QDeclarativeEngine engine;
+ engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports"));
+ QTest::ignoreMessage(QtWarningMsg, "plugin2.1 created");
+ QTest::ignoreMessage(QtWarningMsg, "import2.1 worked");
+ QDeclarativeComponent component(&engine, TEST_FILE("data/works21.qml"));
+ foreach (QDeclarativeError err, component.errors())
+ qWarning() << err;
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("value").toInt(),123);
+ delete object;
+}
+
+void tst_qdeclarativemoduleplugin::incorrectPluginCase()
+{
+ QDeclarativeEngine engine;
+ engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports"));
+
+ QDeclarativeComponent component(&engine, TEST_FILE("data/incorrectCase.qml"));
+
+ QList<QDeclarativeError> errors = component.errors();
+ QCOMPARE(errors.count(), 1);
+
+#if defined(Q_OS_MAC) || defined(Q_OS_WIN32)
+#if defined(Q_OS_MAC)
+ QString libname = "libPluGin.dylib";
+#elif defined(Q_OS_WIN32)
+ QString libname = "PluGin.dll";
+#endif
+ QString expectedError = QLatin1String("plugin cannot be loaded for module \"com.nokia.WrongCase\": File name case mismatch for \"") + QFileInfo(__FILE__).absoluteDir().filePath("imports/com/nokia/WrongCase/" + libname) + QLatin1String("\"");
+#else
+ QString expectedError = QLatin1String("module \"com.nokia.WrongCase\" plugin \"PluGin\" not found");
+#endif
+
+ QCOMPARE(errors.at(0).description(), expectedError);
+}
+
+void tst_qdeclarativemoduleplugin::importPluginWithQmlFile()
+{
+ QString path = QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports");
+
+ // QTBUG-16885: adding an import path with a lower-case "c:" causes assert failure
+ // (this only happens if the plugin includes pure QML files)
+ #ifdef Q_OS_WIN
+ QVERIFY(path.at(0).isUpper() && path.at(1) == QLatin1Char(':'));
+ path = path.at(0).toLower() + path.mid(1);
+ #endif
+
+ QDeclarativeEngine engine;
+ engine.addImportPath(path);
+
+ QDeclarativeComponent component(&engine, TEST_FILE("data/pluginWithQmlFile.qml"));
+ foreach (QDeclarativeError err, component.errors())
+ qWarning() << err;
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qdeclarativemoduleplugin::remoteImportWithQuotedUrl()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(SRCDIR "/imports");
+
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine);
+ component.setData("import \"http://127.0.0.1:14450/com/nokia/PureQmlModule\" \nComponentA { width: 300; ComponentB{} }", QUrl());
+
+ QTRY_COMPARE(component.status(), QDeclarativeComponent::Ready);
+ QObject *object = component.create();
+ QCOMPARE(object->property("width").toInt(), 300);
+ QVERIFY(object != 0);
+ delete object;
+
+ foreach (QDeclarativeError err, component.errors())
+ qWarning() << err;
+ VERIFY_ERRORS(0);
+}
+
+void tst_qdeclarativemoduleplugin::remoteImportWithUnquotedUri()
+{
+ TestHTTPServer server(SERVER_PORT);
+ QVERIFY(server.isValid());
+ server.serveDirectory(SRCDIR "/imports");
+
+ QDeclarativeEngine engine;
+ engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports"));
+ QDeclarativeComponent component(&engine);
+ component.setData("import com.nokia.PureQmlModule 1.0 \nComponentA { width: 300; ComponentB{} }", QUrl());
+
+
+ QTRY_COMPARE(component.status(), QDeclarativeComponent::Ready);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("width").toInt(), 300);
+ delete object;
+
+ foreach (QDeclarativeError err, component.errors())
+ qWarning() << err;
+ VERIFY_ERRORS(0);
+}
+
+// QTBUG-17324
+void tst_qdeclarativemoduleplugin::importsMixedQmlCppPlugin()
+{
+ QDeclarativeEngine engine;
+ engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports"));
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("data/importsMixedQmlCppPlugin.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+ }
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("data/importsMixedQmlCppPlugin.2.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ delete o;
+ }
+
+
+}
+
+void tst_qdeclarativemoduleplugin::versionNotInstalled_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("errorFile");
+
+ QTest::newRow("versionNotInstalled") << "data/versionNotInstalled.qml" << "versionNotInstalled.errors.txt";
+ QTest::newRow("versionNotInstalled") << "data/versionNotInstalled.2.qml" << "versionNotInstalled.2.errors.txt";
+}
+
+void tst_qdeclarativemoduleplugin::versionNotInstalled()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, errorFile);
+
+ QDeclarativeEngine engine;
+ engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports"));
+
+ QDeclarativeComponent component(&engine, TEST_FILE(file));
+ VERIFY_ERRORS(errorFile.toLatin1().constData());
+}
+
+QTEST_MAIN(tst_qdeclarativemoduleplugin)
+
+#include "tst_qdeclarativemoduleplugin.moc"
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro
new file mode 100644
index 0000000000..98cd4729c7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro
@@ -0,0 +1,15 @@
+load(qttest_p4)
+
+HEADERS = ../shared/testhttpserver.h
+SOURCES = tst_qdeclarativemoduleplugin.cpp \
+ ../shared/testhttpserver.cpp
+QT += declarative network
+CONFIG -= app_bundle
+
+symbian: {
+ importFiles.files = data
+ importFiles.path = .
+ DEPLOYMENT += importFiles
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}