summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel/qapplication
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-28 11:51:35 +0200
committerLiang Qi <liang.qi@qt.io>2016-09-28 11:51:35 +0200
commite918334045612ec2c7c6203845ad05c4a1972e87 (patch)
treeb59bf3a173c6bfa58c3ba9b5bb80df4a093247dc /tests/auto/widgets/kernel/qapplication
parente3cbf0f1962958457f6e09fcfdc92d8cac4b6511 (diff)
parentcf0119bb69592d58ca7e6a75753799ebae61e4b5 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/widgets/dialogs/qcolordialog.cpp src/widgets/dialogs/qfiledialog.cpp tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Change-Id: I34bc8a990f8f526889a95a5c7099ef557b9681ad
Diffstat (limited to 'tests/auto/widgets/kernel/qapplication')
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp25
1 files changed, 3 insertions, 22 deletions
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index b7e8cded7a..ab9729342c 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -1755,25 +1755,6 @@ void tst_QApplication::focusOut()
QTest::qWait(2000);
}
-class SpontaneousEvent
-{
- Q_GADGET
- QDOC_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
- Q_ENUMS(Type)
-public:
- enum Type {
- Void
- };
-
- virtual ~SpontaneousEvent() {}
-
- QEventPrivate *d;
- ushort t;
-
- ushort posted : 1;
- ushort spont : 1;
-};
-
void tst_QApplication::focusMouseClick()
{
int argc = 1;
@@ -1791,14 +1772,14 @@ void tst_QApplication::focusMouseClick()
// now send a mouse button press event and check what happens with the focus
// it should be given to the parent widget
QMouseEvent ev(QEvent::MouseButtonPress, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
- reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
+ QSpontaneKeyEvent::setSpontaneous(&ev);
QVERIFY(ev.spontaneous());
qApp->notify(&w2, &ev);
QCOMPARE(QApplication::focusWidget(), &w);
// then we give the inner widget strong focus -> it should get focus
w2.setFocusPolicy(Qt::StrongFocus);
- reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
+ QSpontaneKeyEvent::setSpontaneous(&ev);
QVERIFY(ev.spontaneous());
qApp->notify(&w2, &ev);
QTRY_COMPARE(QApplication::focusWidget(), &w2);
@@ -1806,7 +1787,7 @@ void tst_QApplication::focusMouseClick()
// now back to tab focus and click again (it already had focus) -> focus should stay
// (focus was revoked as of QTBUG-34042)
w2.setFocusPolicy(Qt::TabFocus);
- reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
+ QSpontaneKeyEvent::setSpontaneous(&ev);
QVERIFY(ev.spontaneous());
qApp->notify(&w2, &ev);
QCOMPARE(QApplication::focusWidget(), &w2);