diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-11-18 23:11:37 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-11-18 23:13:48 +0100 |
commit | 423a9124e74f89bf91fd9f5a75491bd6f3a28897 (patch) | |
tree | 8d214ba77d3932bb125a3f57150d9d165a8b6633 /tests | |
parent | c16132c066f3f584e2a8cf86f6c24d0ce0e2874b (diff) |
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 1c451b40aee66a38ca3d61e5beec4ae8c986c8ed.
Change-Id: I0c6f953514095a491120a0aac9944dc8b04ca17d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquickmousearea/data/pressedCanceled.qml | 7 | ||||
-rw-r--r-- | tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp | 8 |
2 files changed, 2 insertions, 13 deletions
diff --git a/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml b/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml index 9079cbdfce..c1c4b039a6 100644 --- a/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml +++ b/tests/auto/quick/qquickmousearea/data/pressedCanceled.qml @@ -1,5 +1,4 @@ import QtQuick 2.0 -import QtQuick.Window 2.0 Rectangle { id: root @@ -10,12 +9,6 @@ Rectangle { property int clicked: 0 property int doubleClicked: 0 property int released: 0 - property alias secondWindow: secondWindow - - Window { - id: secondWindow - x: root.x + root.width - } MouseArea { id: mouse diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 9691e1fd80..569c68447e 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -937,7 +937,6 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate() QCOMPARE(window.rootObject()->property("released").toInt(), expectedRelease); QCOMPARE(window.rootObject()->property("clicked").toInt(), expectedClicks); - QMouseEvent pressEvent(QEvent::MouseButtonPress, 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); } - - QWindow *secondWindow = qvariant_cast<QWindow*>(window.rootObject()->property("secondWindow")); - secondWindow->setProperty("visible", true); - QVERIFY(QTest::qWaitForWindowExposed(secondWindow)); - + QEvent windowDeactivateEvent(QEvent::WindowDeactivate); + QGuiApplication::sendEvent(&window, &windowDeactivateEvent); QTRY_VERIFY(!window.rootObject()->property("pressed").toBool()); QVERIFY(window.rootObject()->property("canceled").toBool()); QCOMPARE(window.rootObject()->property("released").toInt(), expectedRelease); |