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>
This commit is contained in:
Shawn Rutledge 2013-03-04 12:52:11 +01:00 committed by The Qt Project
parent 3e0dc9ef38
commit 1c451b40ae
2 changed files with 11 additions and 6 deletions

View File

@ -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}
}
}
}

View File

@ -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());