summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmenu/tst_qmenu.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-09-08 10:45:57 +0200
committerOlivier Goffart <ogoffart@trolltech.com>2009-09-08 10:49:39 +0200
commitfa889cf4b80868249c70715275069eb150b597cc (patch)
treeab98dc0979d7c2874902e7f2a9812843104e1c49 /tests/auto/qmenu/tst_qmenu.cpp
parentdeff8fcf0ed060b949c3ec0fa0ec4bd81c253825 (diff)
Try to make test more robust.
By using QTRY_{COMPARE,VERIFY} instead of waiting an arbitrary amount of time waiting for the window manager to do his job. Also use QApplication::setActiveWindow which seems to be more robust then QWidget::activateWindow
Diffstat (limited to 'tests/auto/qmenu/tst_qmenu.cpp')
-rw-r--r--tests/auto/qmenu/tst_qmenu.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp
index ab8dd48425..4a4231aef7 100644
--- a/tests/auto/qmenu/tst_qmenu.cpp
+++ b/tests/auto/qmenu/tst_qmenu.cpp
@@ -55,6 +55,9 @@
#include <qmenu.h>
#include <qstyle.h>
#include <qdebug.h>
+
+#include "../../shared/util.h"
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -437,15 +440,16 @@ void tst_QMenu::overrideMenuAction()
m->addAction(aQuit);
w.show();
- QTest::qWait(200);
+ w.setFocus();
+ QTRY_VERIFY(w.hasFocus());
//test of the action inside the menu
QTest::keyClick(&w, Qt::Key_X, Qt::ControlModifier);
- QCOMPARE(activated, aQuit);
+ QTRY_COMPARE(activated, aQuit);
//test if the menu still pops out
QTest::keyClick(&w, Qt::Key_F, Qt::AltModifier);
- QVERIFY(m->isVisible());
+ QTRY_VERIFY(m->isVisible());
delete aFileMenu;
@@ -703,12 +707,12 @@ void tst_QMenu::task250673_activeMultiColumnSubMenuPosition()
};
QMenu sub;
-
+
if (sub.style()->styleHint(QStyle::SH_Menu_Scrollable, 0, &sub)) {
//the style prevents the menus from getting columns
QSKIP("the style doesn't support multiple columns, it makes the menu scrollable", SkipSingle);
}
-
+
sub.addAction("Sub-Item1");
QAction *subAction = sub.addAction("Sub-Item2");