aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/testlib
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-03-10 15:09:37 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-03-12 15:03:03 +0100
commit26c5243491f495194f04b449128dae36118e28da (patch)
tree7fb14678a6fc9e44a10c9224d005e2cbdc6bcb63 /src/imports/testlib
parent1c7d264e3b2e9a2f0021786ea6967185f8282af0 (diff)
parentc24c5baeda4101b0058689adf9200b77a722c3a2 (diff)
Merge remote-tracking branch 'origin/dev' into wip/cmake
Conflicts: dependencies.yaml src/qml/qml/qqmlengine.cpp Change-Id: I6a73fd1064286f4a2232de85c2ce7f80452d4641
Diffstat (limited to 'src/imports/testlib')
-rw-r--r--src/imports/testlib/TestCase.qml17
-rw-r--r--src/imports/testlib/dependencies.json1
-rw-r--r--src/imports/testlib/main.cpp8
-rw-r--r--src/imports/testlib/quicktestevent_p.h4
-rw-r--r--src/imports/testlib/quicktestresultforeign_p.h1
-rw-r--r--src/imports/testlib/quicktestutil_p.h1
-rw-r--r--src/imports/testlib/testlib.pro2
7 files changed, 23 insertions, 11 deletions
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 20c5ce6418..380b7e38d7 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -198,7 +198,7 @@ import Qt.test.qtestroot 1.0
}
\endcode
- The mousePress(), mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence()
+ The mousePress(), mouseRelease(), mouseClick(), mouseDoubleClickSequence()
and mouseMove() methods can be used to simulate mouse events in a
similar fashion.
@@ -1331,7 +1331,7 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel()
+ \sa mouseRelease(), mouseClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel()
*/
function mousePress(item, x, y, button, modifiers, delay) {
if (!qtest_verifyItem(item, "mousePress"))
@@ -1365,7 +1365,7 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel()
+ \sa mousePress(), mouseClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel()
*/
function mouseRelease(item, x, y, button, modifiers, delay) {
if (!qtest_verifyItem(item, "mouseRelease"))
@@ -1398,7 +1398,7 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseWheel()
+ \sa mousePress(), mouseClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseWheel()
*/
function mouseDrag(item, x, y, dx, dy, button, modifiers, delay) {
if (!qtest_verifyItem(item, "mouseDrag"))
@@ -1453,7 +1453,7 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mousePress(), mouseRelease(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel()
+ \sa mousePress(), mouseRelease(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel()
*/
function mouseClick(item, x, y, button, modifiers, delay) {
if (!qtest_verifyItem(item, "mouseClick"))
@@ -1475,6 +1475,7 @@ Item {
/*!
\qmlmethod TestCase::mouseDoubleClick(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
+ \deprecated
Simulates double-clicking a mouse \a button with optional \a modifiers
on an \a item. The position of the click is defined by \a x and \a y.
@@ -1528,7 +1529,7 @@ Item {
This QML method was introduced in Qt 5.5.
- \sa mouseDoubleClick(), mousePress(), mouseRelease(), mouseClick(), mouseMove(), mouseDrag(), mouseWheel()
+ \sa mousePress(), mouseRelease(), mouseClick(), mouseMove(), mouseDrag(), mouseWheel()
*/
function mouseDoubleClickSequence(item, x, y, button, modifiers, delay) {
if (!qtest_verifyItem(item, "mouseDoubleClickSequence"))
@@ -1560,7 +1561,7 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mousePress(), mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseDrag(), mouseWheel()
+ \sa mousePress(), mouseRelease(), mouseClick(), mouseDoubleClickSequence(), mouseDrag(), mouseWheel()
*/
function mouseMove(item, x, y, delay, buttons) {
if (!qtest_verifyItem(item, "mouseMove"))
@@ -1588,7 +1589,7 @@ Item {
The \a xDelta and \a yDelta contain the wheel rotation distance in eighths of a degree. see \l QWheelEvent::angleDelta() for more details.
- \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseDrag(), QWheelEvent::angleDelta()
+ \sa mousePress(), mouseClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseDrag(), QWheelEvent::angleDelta()
*/
function mouseWheel(item, x, y, xDelta, yDelta, buttons, modifiers, delay) {
if (!qtest_verifyItem(item, "mouseWheel"))
diff --git a/src/imports/testlib/dependencies.json b/src/imports/testlib/dependencies.json
new file mode 100644
index 0000000000..b2c4125178
--- /dev/null
+++ b/src/imports/testlib/dependencies.json
@@ -0,0 +1 @@
+["QtQuick 2.0", "QtQuick.Window 2.0"]
diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp
index 1914c02dd0..83fc150e6c 100644
--- a/src/imports/testlib/main.cpp
+++ b/src/imports/testlib/main.cpp
@@ -50,6 +50,8 @@ QML_DECLARE_TYPE(QuickTestResult)
QML_DECLARE_TYPE(QuickTestEvent)
QML_DECLARE_TYPE(QuickTestUtil)
+extern void qml_register_types_QtTest();
+
QT_BEGIN_NAMESPACE
class QTestQmlModule : public QQmlEngineExtensionPlugin
@@ -58,7 +60,11 @@ class QTestQmlModule : public QQmlEngineExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QTestQmlModule(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { }
+ QTestQmlModule(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent)
+ {
+ volatile auto registration = &qml_register_types_QtTest;
+ Q_UNUSED(registration);
+ }
};
QT_END_NAMESPACE
diff --git a/src/imports/testlib/quicktestevent_p.h b/src/imports/testlib/quicktestevent_p.h
index f452e4ff82..0bbae8434f 100644
--- a/src/imports/testlib/quicktestevent_p.h
+++ b/src/imports/testlib/quicktestevent_p.h
@@ -63,6 +63,7 @@ class QQuickTouchEventSequence : public QObject
{
Q_OBJECT
QML_ANONYMOUS
+ QML_ADDED_IN_VERSION(1, 0)
public:
explicit QQuickTouchEventSequence(QuickTestEvent *testEvent, QObject *item = nullptr);
@@ -83,6 +84,7 @@ class QuickTestEvent : public QObject
Q_OBJECT
Q_PROPERTY(int defaultMouseDelay READ defaultMouseDelay FINAL)
QML_NAMED_ELEMENT(TestEvent)
+ QML_ADDED_IN_VERSION(1, 0)
public:
QuickTestEvent(QObject *parent = nullptr);
~QuickTestEvent() override;
@@ -97,7 +99,7 @@ public Q_SLOTS:
bool keyReleaseChar(const QString &character, int modifiers, int delay);
bool keyClickChar(const QString &character, int modifiers, int delay);
- Q_REVISION(2) bool keySequence(const QVariant &keySequence);
+ Q_REVISION(1, 2) bool keySequence(const QVariant &keySequence);
bool mousePress(QObject *item, qreal x, qreal y, int button,
int modifiers, int delay);
diff --git a/src/imports/testlib/quicktestresultforeign_p.h b/src/imports/testlib/quicktestresultforeign_p.h
index 92ff8e8a5a..e9dd12fa93 100644
--- a/src/imports/testlib/quicktestresultforeign_p.h
+++ b/src/imports/testlib/quicktestresultforeign_p.h
@@ -61,6 +61,7 @@ struct QuickTestResultForeign
Q_GADGET
QML_FOREIGN(QuickTestResult)
QML_NAMED_ELEMENT(TestResult)
+ QML_ADDED_IN_VERSION(1, 0)
};
QT_END_NAMESPACE
diff --git a/src/imports/testlib/quicktestutil_p.h b/src/imports/testlib/quicktestutil_p.h
index 2456bf88a7..7e90c1cd1d 100644
--- a/src/imports/testlib/quicktestutil_p.h
+++ b/src/imports/testlib/quicktestutil_p.h
@@ -63,6 +63,7 @@ class QuickTestUtil : public QObject
Q_PROPERTY(bool printAvailableFunctions READ printAvailableFunctions NOTIFY printAvailableFunctionsChanged)
Q_PROPERTY(int dragThreshold READ dragThreshold NOTIFY dragThresholdChanged)
QML_NAMED_ELEMENT(TestUtil)
+ QML_ADDED_IN_VERSION(1, 0)
public:
QuickTestUtil(QObject *parent = nullptr) :QObject(parent) {}
~QuickTestUtil() override {}
diff --git a/src/imports/testlib/testlib.pro b/src/imports/testlib/testlib.pro
index de6453eeab..2a97213e29 100644
--- a/src/imports/testlib/testlib.pro
+++ b/src/imports/testlib/testlib.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qmltestplugin
TARGETPATH = QtTest
-IMPORT_VERSION = 1.15
+QML_IMPORT_VERSION = $$QT_VERSION
QT += quick qmltest-private qml-private core-private testlib gui-private