aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJeremy Katz <jeremy@panix.com>2016-08-17 12:12:36 -0700
committerJeremy Katz <jeremy@panix.com>2016-08-22 22:53:39 +0000
commitfd57e1449dc974417f3409a4da7338d7e8a6e7c8 (patch)
tree11d8086d266f974e7d2908e3e7556ae6c2eafe96 /tests
parent457bb7a465fc51995fc5ffaa4a1d8a341528d0c4 (diff)
allow quick test events to directly target a Window
QuickTestEvent::eventWindow() is used to determine the window a QObject-based item cast to a QQuickItem is associated with. The window is then used to dispatch simulated events and calculate item positions. This change allows a quick Window or other QWindow-based object to be used directly. Change-Id: I85866ca4c79d5b6a48bac554608cad348aeb6e98 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qmltest/events/tst_events.qml16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qmltest/events/tst_events.qml b/tests/auto/qmltest/events/tst_events.qml
index e655c26c7d..d9868a316c 100644
--- a/tests/auto/qmltest/events/tst_events.qml
+++ b/tests/auto/qmltest/events/tst_events.qml
@@ -27,6 +27,7 @@
****************************************************************************/
import QtQuick 2.0
+import QtQuick.Window 2.0
import QtTest 1.1
Rectangle {
@@ -56,6 +57,16 @@ Rectangle {
signalName: "doubleClickSignalHelper"
}
+ Window {
+ id: sub
+ visible: true
+ property bool clicked: false
+ MouseArea {
+ anchors.fill: parent
+ onClicked: sub.clicked = true
+ }
+ }
+
MouseArea {
anchors.fill: parent
onClicked: {
@@ -89,6 +100,11 @@ Rectangle {
tryCompare(top, "mouseHasBeenClicked", true, 10000)
}
+ function test_mouse_click_subwindow() {
+ mouseClick(sub)
+ tryCompare(sub, "clicked", true, 10000)
+ }
+
function test_mouse_doubleclick() {
doubleClickSpy.clear()
mouseDoubleClickSequence(top, 25, 30)