aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/qml.pro1
-rw-r--r--tests/auto/qml/qqmltypeloader/SlowImport/Slow.pro12
-rw-r--r--tests/auto/qml/qqmltypeloader/SlowImport/plugin.cpp51
-rw-r--r--tests/auto/qml/qqmltypeloader/SlowImport/plugin.h57
-rw-r--r--tests/auto/qml/qqmltypeloader/SlowImport/qmldir2
-rw-r--r--tests/auto/qml/qqmltypeloader/SlowImport/slow.cpp50
-rw-r--r--tests/auto/qml/qqmltypeloader/SlowImport/slow.h53
-rw-r--r--tests/auto/qml/qqmltypeloader/data/GenericView.qml54
-rw-r--r--tests/auto/qml/qqmltypeloader/data/NiceView.qml45
-rw-r--r--tests/auto/qml/qqmltypeloader/data/test_load_complete.qml66
-rw-r--r--tests/auto/qml/qqmltypeloader/qqmltypeloader.pro2
-rw-r--r--tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp74
-rw-r--r--tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro11
13 files changed, 478 insertions, 0 deletions
diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro
index 2036f1cd7a..eec6584472 100644
--- a/tests/auto/qml/qml.pro
+++ b/tests/auto/qml/qml.pro
@@ -50,6 +50,7 @@ PRIVATETESTS += \
qqmllistcompositor \
qqmllistmodel \
qqmllistmodelworkerscript \
+ qqmltypeloader \
qqmlparser \
qquickworkerscript \
qqmlbundle \
diff --git a/tests/auto/qml/qqmltypeloader/SlowImport/Slow.pro b/tests/auto/qml/qqmltypeloader/SlowImport/Slow.pro
new file mode 100644
index 0000000000..e76dbd1237
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/SlowImport/Slow.pro
@@ -0,0 +1,12 @@
+TEMPLATE = lib
+TARGET = Slow
+INCLUDEPATH += .
+QT += quick qml
+
+# Input
+HEADERS += plugin.h slow.h
+SOURCES += plugin.cpp slow.cpp
+
+DESTDIR = ../Slow
+IMPORT_FILES = qmldir
+include (../../../shared/imports.pri)
diff --git a/tests/auto/qml/qqmltypeloader/SlowImport/plugin.cpp b/tests/auto/qml/qqmltypeloader/SlowImport/plugin.cpp
new file mode 100644
index 0000000000..f184dff165
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/SlowImport/plugin.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "plugin.h"
+
+#include "slow.h"
+#include <qqml.h>
+
+void SlowPlugin::registerTypes(const char *uri)
+{
+ Q_ASSERT(uri == QLatin1String("Slow"));
+ qmlRegisterType<SlowStuff>(uri, 1, 0, "SlowStuff");
+}
diff --git a/tests/auto/qml/qqmltypeloader/SlowImport/plugin.h b/tests/auto/qml/qqmltypeloader/SlowImport/plugin.h
new file mode 100644
index 0000000000..ed467a848c
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/SlowImport/plugin.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SLOW_PLUGIN_H
+#define SLOW_PLUGIN_H
+
+#include <QtQml/QQmlEngine>
+#include <QtQml/QQmlExtensionPlugin>
+
+class SlowPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ void registerTypes(const char *uri);
+};
+
+#endif
diff --git a/tests/auto/qml/qqmltypeloader/SlowImport/qmldir b/tests/auto/qml/qqmltypeloader/SlowImport/qmldir
new file mode 100644
index 0000000000..f07f777b8f
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/SlowImport/qmldir
@@ -0,0 +1,2 @@
+module Slow
+plugin Slow
diff --git a/tests/auto/qml/qqmltypeloader/SlowImport/slow.cpp b/tests/auto/qml/qqmltypeloader/SlowImport/slow.cpp
new file mode 100644
index 0000000000..080293bbf1
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/SlowImport/slow.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "slow.h"
+
+#include <QThread>
+
+SlowStuff::SlowStuff()
+{
+ QThread::usleep(500000);
+}
+
diff --git a/tests/auto/qml/qqmltypeloader/SlowImport/slow.h b/tests/auto/qml/qqmltypeloader/SlowImport/slow.h
new file mode 100644
index 0000000000..6f7a64573d
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/SlowImport/slow.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SLOWSTUFF_H
+#define SLOWSTUFF_H
+
+#include <QObject>
+
+class SlowStuff : public QObject
+{
+public:
+ SlowStuff();
+};
+
+#endif \ No newline at end of file
diff --git a/tests/auto/qml/qqmltypeloader/data/GenericView.qml b/tests/auto/qml/qqmltypeloader/data/GenericView.qml
new file mode 100644
index 0000000000..487761275e
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/data/GenericView.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Slow 1.0
+
+Item {
+ Rectangle {
+ color: "red"
+ width: 100
+ height: 100
+ }
+ SlowStuff {
+
+ }
+}
diff --git a/tests/auto/qml/qqmltypeloader/data/NiceView.qml b/tests/auto/qml/qqmltypeloader/data/NiceView.qml
new file mode 100644
index 0000000000..ced623b685
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/data/NiceView.qml
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+GenericView {
+}
diff --git a/tests/auto/qml/qqmltypeloader/data/test_load_complete.qml b/tests/auto/qml/qqmltypeloader/data/test_load_complete.qml
new file mode 100644
index 0000000000..82b2278950
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/data/test_load_complete.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+ListView {
+ width: 400
+ height: 500
+ model: 2
+
+ id: test
+ property int created: 0
+ property int loaded: 0
+
+ delegate: Loader {
+ width: ListView.view.width
+ height: 100
+ asynchronous: true
+ source: index == 0 ? "NiceView.qml" : "GenericView.qml"
+
+ onLoaded: {
+ test.loaded++
+ }
+ Component.onCompleted: {
+ test.created++
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/qml/qqmltypeloader/qqmltypeloader.pro b/tests/auto/qml/qqmltypeloader/qqmltypeloader.pro
new file mode 100644
index 0000000000..6b9c117b8d
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/qqmltypeloader.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS += tst_qqmltypeloader.pro SlowImport/Slow.pro
diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
new file mode 100644
index 0000000000..e44d5aa8d5
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtQml/qqmlengine.h>
+#include <QtQuick/qquickview.h>
+#include <QtQuick/qquickitem.h>
+#include "../../shared/util.h"
+
+class tst_QQMLTypeLoader : public QQmlDataTest
+{
+ Q_OBJECT
+
+private slots:
+ void testLoadComplete();
+};
+
+void tst_QQMLTypeLoader::testLoadComplete()
+{
+ QQuickView *window = new QQuickView();
+ window->engine()->addImportPath(QT_TESTCASE_BUILDDIR);
+ qDebug() << window->engine()->importPathList();
+ window->setGeometry(0,0,240,320);
+ window->setSource(testFileUrl("test_load_complete.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QObject *rootObject = window->rootObject();
+ QTRY_VERIFY(rootObject != 0);
+ QTRY_COMPARE(rootObject->property("created").toInt(), 2);
+ QTRY_COMPARE(rootObject->property("loaded").toInt(), 2);
+}
+
+QTEST_MAIN(tst_QQMLTypeLoader)
+
+#include "tst_qqmltypeloader.moc"
diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro
new file mode 100644
index 0000000000..9e2261df8d
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro
@@ -0,0 +1,11 @@
+CONFIG += testcase
+TARGET = tst_qqmltypeloader
+QT += qml testlib qml-private quick
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qqmltypeloader.cpp
+
+include (../../shared/util.pri)
+
+CONFIG += parallel_test
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0