aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/testlib
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-12-20 08:32:22 +0100
committerLiang Qi <liang.qi@qt.io>2017-12-20 08:50:58 +0100
commit9a38fdcf8f9b734808bb54422e306872f3bfa944 (patch)
tree20fd361db6c505d99a40ab7a695511b97dcdcbd3 /src/imports/testlib
parent1db9405128972d5ba77e33181bee40356f718cea (diff)
parent4fff2bb14e55484eacec0a1b49a2b02958f75eca (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: tests/auto/quick/pointerhandlers/flickableinterop/data/FlashAnimation.qml tests/auto/quick/pointerhandlers/flickableinterop/data/Slider.qml tests/auto/quick/pointerhandlers/flickableinterop/data/TapHandlerButton.qml tests/auto/quick/pointerhandlers/flickableinterop/data/flickableWithHandlers.qml tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/pinchDragMPTA.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/DragAnywhereSlider.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/FlashAnimation.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/Slider.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/draggables.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/multipleSliders.qml tests/auto/quick/pointerhandlers/qquicktaphandler/data/Button.qml tests/auto/quick/pointerhandlers/qquicktaphandler/data/FlashAnimation.qml tests/auto/quick/pointerhandlers/qquicktaphandler/data/buttons.qml tests/manual/pointer/content/FakeFlickable.qml tests/manual/pointer/content/FlashAnimation.qml tests/manual/pointer/content/MomentumAnimation.qml tests/manual/pointer/content/MouseAreaButton.qml tests/manual/pointer/content/MouseAreaSlider.qml tests/manual/pointer/content/MptaButton.qml tests/manual/pointer/content/MultiButton.qml tests/manual/pointer/content/ScrollBar.qml tests/manual/pointer/content/Slider.qml tests/manual/pointer/content/TapHandlerButton.qml tests/manual/pointer/fakeFlickable.qml tests/manual/pointer/flickableWithHandlers.qml tests/manual/pointer/flingAnimation.qml tests/manual/pointer/joystick.qml tests/manual/pointer/main.cpp tests/manual/pointer/main.qml tests/manual/pointer/map.qml tests/manual/pointer/map2.qml tests/manual/pointer/mixer.qml tests/manual/pointer/multibuttons.qml tests/manual/pointer/photosurface.qml tests/manual/pointer/pinchDragFlingMPTA.qml tests/manual/pointer/pinchHandler.qml tests/manual/pointer/singlePointHandlerProperties.qml tests/manual/pointer/tapHandler.qml tests/manual/pointer/tapWithModifiers.qml tests/manual/shapestest/main.cpp Change-Id: I4f233a521305fab1ebfecbac801da192434ed524
Diffstat (limited to 'src/imports/testlib')
-rw-r--r--src/imports/testlib/TestCase.qml26
-rw-r--r--src/imports/testlib/main.cpp1
-rw-r--r--src/imports/testlib/plugins.qmltypes12
3 files changed, 33 insertions, 6 deletions
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 0e7e09c65c..4bcc95df89 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -39,7 +39,7 @@
import QtQuick 2.0
import QtQuick.Window 2.0 // used for qtest_verifyItem
-import QtTest 1.1
+import QtTest 1.2
import "testlogger.js" as TestLogger
import Qt.test.qtestroot 1.0
@@ -57,7 +57,7 @@ import Qt.test.qtestroot 1.0
\code
import QtQuick 2.0
- import QtTest 1.0
+ import QtTest 1.2
TestCase {
name: "MathTests"
@@ -108,7 +108,7 @@ import Qt.test.qtestroot 1.0
\code
import QtQuick 2.0
- import QtTest 1.1
+ import QtTest 1.2
TestCase {
name: "DataTests"
@@ -1212,6 +1212,26 @@ Item {
}
/*!
+ \since 5.10
+ \qmlmethod TestCase::keySequence(keySequence)
+
+ Simulates typing of \a keySequence. The key sequence can be set
+ to one of the \l{QKeySequence::StandardKey}{standard keyboard shortcuts}, or
+ it can be described with a string containing a sequence of up to four key
+ presses.
+
+ Each event shall be sent to the TestCase window or, in case of multiple windows,
+ to the current active window. See \l QGuiApplication::focusWindow() for more details.
+
+ \sa keyPress(), keyRelease(), {GNU Emacs Style Key Sequences},
+ {QtQuick::Shortcut::sequence}{Shortcut.sequence}
+ */
+ function keySequence(keySequence) {
+ if (!qtest_events.keySequence(keySequence))
+ qtest_fail("window not shown", 2)
+ }
+
+ /*!
\qmlmethod TestCase::mousePress(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
Simulates pressing a mouse \a button with an optional \a modifier
diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp
index 2dbe8e08dc..00e9592557 100644
--- a/src/imports/testlib/main.cpp
+++ b/src/imports/testlib/main.cpp
@@ -157,6 +157,7 @@ public:
qmlRegisterType<QuickTestResult, 0>(uri,1,0,"TestResult");
qmlRegisterType<QuickTestResult, 1>(uri,1,1,"TestResult");
qmlRegisterType<QuickTestEvent>(uri,1,0,"TestEvent");
+ qmlRegisterType<QuickTestEvent>(uri,1,2,"TestEvent");
qmlRegisterType<QuickTestUtil>(uri,1,0,"TestUtil");
qmlRegisterType<QQuickTouchEventSequence>();
}
diff --git a/src/imports/testlib/plugins.qmltypes b/src/imports/testlib/plugins.qmltypes
index 5d7ca51adc..7f3140d86b 100644
--- a/src/imports/testlib/plugins.qmltypes
+++ b/src/imports/testlib/plugins.qmltypes
@@ -7,7 +7,7 @@ import QtQuick.tooling 1.2
// 'qmlplugindump -nonrelocatable -noforceqtquick QtTest 1.2'
Module {
- dependencies: ["QtQuick 2.0"]
+ dependencies: ["QtQuick 2.0", "QtQuick.Window 2.0"]
Component {
name: "QQuickTouchEventSequence"
prototype: "QObject"
@@ -45,8 +45,8 @@ Module {
Component {
name: "QuickTestEvent"
prototype: "QObject"
- exports: ["QtTest/TestEvent 1.0"]
- exportMetaObjectRevisions: [0]
+ exports: ["QtTest/TestEvent 1.0", "QtTest/TestEvent 1.2"]
+ exportMetaObjectRevisions: [0, 0]
Property { name: "defaultMouseDelay"; type: "int"; isReadonly: true }
Method {
name: "keyPress"
@@ -91,6 +91,12 @@ Module {
Parameter { name: "delay"; type: "int" }
}
Method {
+ name: "keySequence"
+ revision: 2
+ type: "bool"
+ Parameter { name: "keySequence"; type: "QVariant" }
+ }
+ Method {
name: "mousePress"
type: "bool"
Parameter { name: "item"; type: "QObject"; isPointer: true }