aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-03-04 12:52:11 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-04 19:47:38 +0100
commit1c451b40aee66a38ca3d61e5beec4ae8c986c8ed (patch)
tree4487c7bf216e2a7b02385ed1ff21f8607424551b /tests
parent3e0dc9ef3894c39fc617c96eecbd419a7a2fefa4 (diff)
pressedCanceledOnWindowDeactivate pops up a second window
in order to cause the first one to be deactivated. Task-number: QTBUG-29953 Change-Id: I7fec66b07976b2afc78941d39c593f99ea484522 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquickmousearea/data/pressedCanceled.qml9
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp8
2 files changed, 11 insertions, 6 deletions
diff --git a/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml b/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml
index 231436d0f2..14630b8962 100644
--- a/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml
+++ b/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtQuick.Window 2.0
Rectangle {
id: root
@@ -7,6 +8,12 @@ Rectangle {
property bool pressed:mouse.pressed
property bool canceled: false
property bool released: false
+ property alias secondWindow: secondWindow
+
+ Window {
+ id: secondWindow
+ x: root.x + root.width
+ }
MouseArea {
id: mouse
@@ -15,4 +22,4 @@ Rectangle {
onCanceled: {root.canceled = true}
onReleased: {root.released = true; root.canceled = false}
}
-} \ No newline at end of file
+}
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index 327abbebd5..6ee79b06a2 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -583,16 +583,14 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate()
QVERIFY(!window->rootObject()->property("canceled").toBool());
QVERIFY(!window->rootObject()->property("released").toBool());
- QTest::qWait(200);
+ QWindow *secondWindow = qvariant_cast<QWindow*>(window->rootObject()->property("secondWindow"));
+ secondWindow->setProperty("visible", true);
+ QTest::qWaitForWindowActive(secondWindow);
- QEvent windowDeactivateEvent(QEvent::WindowDeactivate);
- QGuiApplication::sendEvent(window, &windowDeactivateEvent);
QVERIFY(!window->rootObject()->property("pressed").toBool());
QVERIFY(window->rootObject()->property("canceled").toBool());
QVERIFY(!window->rootObject()->property("released").toBool());
- QTest::qWait(200);
-
//press again
QGuiApplication::sendEvent(window, &pressEvent);
QVERIFY(window->rootObject()->property("pressed").toBool());