tst_ma::pressedCanceledOnWindowDeactivate: don't pop up second window
I guess I must have thought it would be more realistic that way;
but sending an explicit WindowDeactivate as we had it in early Qt 5
seems to keep the test passing now, and is probably more reliable.
The original purpose of the test seems to be to verify the recursive
delivery to all items via virtual QQuickItem::windowDeactivateEvent(),
which MouseArea (and no other item!) overrides to ungrab the mouse.
This mostly reverts commit 1c451b40ae
.
Change-Id: I0c6f953514095a491120a0aac9944dc8b04ca17d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
c16132c066
commit
423a9124e7
|
@ -1,5 +1,4 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Window 2.0
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
@ -10,12 +9,6 @@ Rectangle {
|
||||||
property int clicked: 0
|
property int clicked: 0
|
||||||
property int doubleClicked: 0
|
property int doubleClicked: 0
|
||||||
property int released: 0
|
property int released: 0
|
||||||
property alias secondWindow: secondWindow
|
|
||||||
|
|
||||||
Window {
|
|
||||||
id: secondWindow
|
|
||||||
x: root.x + root.width
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouse
|
id: mouse
|
||||||
|
|
|
@ -937,7 +937,6 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate()
|
||||||
QCOMPARE(window.rootObject()->property("released").toInt(), expectedRelease);
|
QCOMPARE(window.rootObject()->property("released").toInt(), expectedRelease);
|
||||||
QCOMPARE(window.rootObject()->property("clicked").toInt(), expectedClicks);
|
QCOMPARE(window.rootObject()->property("clicked").toInt(), expectedClicks);
|
||||||
|
|
||||||
|
|
||||||
QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, {});
|
QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, {});
|
||||||
QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, {});
|
QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, {});
|
||||||
|
|
||||||
|
@ -966,11 +965,8 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate()
|
||||||
QCOMPARE(window.rootObject()->property("doubleClicked").toInt(), 1);
|
QCOMPARE(window.rootObject()->property("doubleClicked").toInt(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QEvent windowDeactivateEvent(QEvent::WindowDeactivate);
|
||||||
QWindow *secondWindow = qvariant_cast<QWindow*>(window.rootObject()->property("secondWindow"));
|
QGuiApplication::sendEvent(&window, &windowDeactivateEvent);
|
||||||
secondWindow->setProperty("visible", true);
|
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(secondWindow));
|
|
||||||
|
|
||||||
QTRY_VERIFY(!window.rootObject()->property("pressed").toBool());
|
QTRY_VERIFY(!window.rootObject()->property("pressed").toBool());
|
||||||
QVERIFY(window.rootObject()->property("canceled").toBool());
|
QVERIFY(window.rootObject()->property("canceled").toBool());
|
||||||
QCOMPARE(window.rootObject()->property("released").toInt(), expectedRelease);
|
QCOMPARE(window.rootObject()->property("released").toInt(), expectedRelease);
|
||||||
|
|
Loading…
Reference in New Issue