summaryrefslogtreecommitdiff
path: root/tests/plugins
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@theqtcompany.com>2016-05-27 08:57:53 +0200
committerAlex Blasche <alexander.blasche@theqtcompany.com>2016-05-27 09:26:43 +0200
commit2fb16a044cea839dd2616e6cae45e434906f0379 (patch)
tree3d6a0eb35b361d1540fb1de21dd56e4a1d938875 /tests/plugins
parent4a5e6d6e8b816ac2dd8c673feb56a0af096a4a18 (diff)
parentf897775850dfbe0e668e9c8b428537e8bb096c01 (diff)
downloadqtlocation-2fb16a044cea839dd2616e6cae45e434906f0379.tar.gz
Merge remote-tracking branch 'gerrit/5.6' into 5.7
Change-Id: I066dc4f161f4bdfe182ba9fe00d273e5fbcedf5d
Diffstat (limited to 'tests/plugins')
-rw-r--r--tests/plugins/declarativetestplugin/declarativetestplugin.pro16
-rw-r--r--tests/plugins/declarativetestplugin/locationtest.cpp10
-rw-r--r--tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp4
-rw-r--r--tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel_p.h4
-rw-r--r--tests/plugins/declarativetestplugin/qdeclarativepinchgenerator.cpp4
-rw-r--r--tests/plugins/declarativetestplugin/qdeclarativepinchgenerator_p.h4
-rw-r--r--tests/plugins/declarativetestplugin/testhelper.h58
7 files changed, 93 insertions, 7 deletions
diff --git a/tests/plugins/declarativetestplugin/declarativetestplugin.pro b/tests/plugins/declarativetestplugin/declarativetestplugin.pro
index a27267d7..0a99e7a7 100644
--- a/tests/plugins/declarativetestplugin/declarativetestplugin.pro
+++ b/tests/plugins/declarativetestplugin/declarativetestplugin.pro
@@ -7,13 +7,15 @@ QT += gui-private qml quick location testlib
INCLUDEPATH += ../../../src/imports/location
INCLUDEPATH += ../../../src/location
-HEADERS += qdeclarativepinchgenerator_p.h \
- qdeclarativelocationtestmodel_p.h
-
-
-SOURCES += locationtest.cpp \
- qdeclarativepinchgenerator.cpp \
- qdeclarativelocationtestmodel.cpp
+HEADERS += \
+ qdeclarativepinchgenerator_p.h \
+ qdeclarativelocationtestmodel_p.h \
+ testhelper.h
+
+SOURCES += \
+ locationtest.cpp \
+ qdeclarativepinchgenerator.cpp \
+ qdeclarativelocationtestmodel.cpp
IMPORT_FILES = \
qmldir
diff --git a/tests/plugins/declarativetestplugin/locationtest.cpp b/tests/plugins/declarativetestplugin/locationtest.cpp
index 85812b39..f0389d90 100644
--- a/tests/plugins/declarativetestplugin/locationtest.cpp
+++ b/tests/plugins/declarativetestplugin/locationtest.cpp
@@ -28,6 +28,7 @@
#include "qdeclarativepinchgenerator_p.h"
#include "qdeclarativelocationtestmodel_p.h"
+#include "testhelper.h"
#include <QtQml/QQmlExtensionPlugin>
#include <QtQml/qqml.h>
@@ -36,6 +37,14 @@
QT_BEGIN_NAMESPACE
+static QObject *helper_factory(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine);
+ Q_UNUSED(scriptEngine);
+ TestHelper *helper = new TestHelper();
+ return helper;
+}
+
class QLocationDeclarativeTestModule: public QQmlExtensionPlugin
{
Q_OBJECT
@@ -46,6 +55,7 @@ public:
if (QLatin1String(uri) == QLatin1String("QtLocation.Test")) {
qmlRegisterType<QDeclarativePinchGenerator>(uri, 5, 5, "PinchGenerator");
qmlRegisterType<QDeclarativeLocationTestModel>(uri, 5, 5, "TestModel");
+ qmlRegisterSingletonType<TestHelper>(uri, 5, 6, "LocationTestHelper", helper_factory);
} else {
qWarning() << "Unsupported URI given to load location test QML plugin: " << QLatin1String(uri);
}
diff --git a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp
index eb8bd054..e0004596 100644
--- a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp
+++ b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp
@@ -31,6 +31,8 @@
#include <QtCore/QTime>
#include <QtCore>
+QT_BEGIN_NAMESPACE
+
QDeclarativeLocationTestModel::QDeclarativeLocationTestModel(QObject *parent):
QAbstractListModel(parent),
delay_(0),
@@ -242,3 +244,5 @@ QHash<int, QByteArray> QDeclarativeLocationTestModel::roleNames() const
roles.insert(TestDataRole, "modeldata");
return roles;
}
+
+QT_END_NAMESPACE
diff --git a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel_p.h b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel_p.h
index 5d6f2395..925125af 100644
--- a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel_p.h
+++ b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel_p.h
@@ -36,6 +36,8 @@
#include <QList>
#include <QtPositioning/QGeoCoordinate>
+QT_BEGIN_NAMESPACE
+
class DataObject: public QObject
{
Q_OBJECT
@@ -123,4 +125,6 @@ private:
bool crazyMode_;
};
+QT_END_NAMESPACE
+
#endif
diff --git a/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator.cpp b/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator.cpp
index 37f0583d..3026cd92 100644
--- a/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator.cpp
+++ b/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator.cpp
@@ -33,6 +33,8 @@
#include <QtGui/qpa/qwindowsysteminterface.h>
#include <QtGui/QStyleHints>
+QT_BEGIN_NAMESPACE
+
QDeclarativePinchGenerator::QDeclarativePinchGenerator():
target_(0),
state_(Invalid),
@@ -376,3 +378,5 @@ int QDeclarativePinchGenerator::startDragDistance()
{
return qApp->styleHints()->startDragDistance();
}
+
+QT_END_NAMESPACE
diff --git a/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator_p.h b/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator_p.h
index f3b06943..23d8b650 100644
--- a/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator_p.h
+++ b/tests/plugins/declarativetestplugin/qdeclarativepinchgenerator_p.h
@@ -41,6 +41,8 @@
#define SWIPES_REQUIRED 2
+QT_BEGIN_NAMESPACE
+
typedef struct {
QList<QPoint> touchPoints;
QList<int> durations;
@@ -132,4 +134,6 @@ private:
QTouchDevice* device_;
};
+QT_END_NAMESPACE
+
#endif
diff --git a/tests/plugins/declarativetestplugin/testhelper.h b/tests/plugins/declarativetestplugin/testhelper.h
new file mode 100644
index 00000000..c6d9f3b3
--- /dev/null
+++ b/tests/plugins/declarativetestplugin/testhelper.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHELPER_H
+#define TESTHELPER_H
+
+#include <QObject>
+#include <QSignalSpy>
+#include <QQuickItem>
+#include <QQuickWindow>
+
+QT_BEGIN_NAMESPACE
+
+class TestHelper: public QObject
+{
+ Q_OBJECT
+public:
+ TestHelper(QObject *parent = Q_NULLPTR):QObject(parent){}
+ Q_INVOKABLE bool waitForPolished(QQuickItem *item, int timeout = 10000) const
+ {
+ QSignalSpy spy(item->window(), &QQuickWindow::afterAnimating);
+ return spy.wait(timeout);
+ }
+};
+
+QT_END_NAMESPACE
+
+#endif // TESTHELPER_H