From fd57e1449dc974417f3409a4da7338d7e8a6e7c8 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 17 Aug 2016 12:12:36 -0700 Subject: 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 Reviewed-by: Mitch Curtis --- tests/auto/qmltest/events/tst_events.qml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/auto/qmltest') 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) -- cgit v1.2.3