import QtQuick 2.0
+import QtQuick.Window 2.0
Rectangle {
id: root
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
onCanceled: {root.canceled = true}
onReleased: {root.released = true; root.canceled = false}
}
-}
\ No newline at end of file
+}
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());