diff options
author | Dominik Holland <dominik.holland@nokia.com> | 2010-07-28 11:18:50 (GMT) |
---|---|---|
committer | Harald Fernengel <harald.fernengel@nokia.com> | 2010-11-02 14:29:51 (GMT) |
commit | 07dfb4618fca86314334f331fe788f9a480ef6db (patch) | |
tree | 033822a9bb7288c64fa156422ee20a8fd7ce71e7 /tests/auto/qmenu | |
parent | 09800d84d99c51941df8b15c2979af79ac750ee3 (diff) | |
download | Qt-07dfb4618fca86314334f331fe788f9a480ef6db.zip Qt-07dfb4618fca86314334f331fe788f9a480ef6db.tar.gz Qt-07dfb4618fca86314334f331fe788f9a480ef6db.tar.bz2 |
Fixed QMenu autotest to use a dummy toplevel widget
Added some waits
Diffstat (limited to 'tests/auto/qmenu')
-rw-r--r-- | tests/auto/qmenu/tst_qmenu.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 7065b13..84f1b94 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -298,15 +298,17 @@ void tst_QMenu::mouseActivation() #ifdef Q_OS_WINCE_WM QSKIP("We have a separate mouseActivation test for Windows mobile.", SkipAll); #endif - QMenu menu; + QWidget topLevel; + QMenu menu(&topLevel); + topLevel.show(); menu.addAction("Menu Action"); menu.show(); - QTest::mouseClick(&menu, Qt::LeftButton, 0, QPoint(5, 5), 300); + QTest::mouseClick(&menu, Qt::LeftButton, 0, menu.rect().center(), 300); QVERIFY(!menu.isVisible()); //context menus can allways be accessed with right click except on windows menu.show(); - QTest::mouseClick(&menu, Qt::RightButton, 0, QPoint(5, 5), 300); + QTest::mouseClick(&menu, Qt::RightButton, 0, menu.rect().center(), 300); QVERIFY(!menu.isVisible()); #ifdef Q_OS_WIN @@ -466,9 +468,9 @@ void tst_QMenu::overrideMenuAction() m->addAction(aQuit); w.show(); + QTest::qWaitForWindowShown(&w); QApplication::setActiveWindow(&w); w.setFocus(); - QTest::qWaitForWindowShown(&w); QTRY_VERIFY(w.hasFocus()); //test of the action inside the menu @@ -504,6 +506,7 @@ void tst_QMenu::statusTip() w.addToolBar(&tb); w.show(); + QTest::qWaitForWindowShown(&w); QRect rect1 = tb.actionGeometry(&a); QToolButton *btn = qobject_cast<QToolButton*>(tb.childAt(rect1.center())); @@ -589,6 +592,8 @@ void tst_QMenu::tearOff() QVERIFY(menu->isTearOffEnabled()); widget.show(); + QTest::qWaitForWindowShown(&widget); + widget.activateWindow(); menu->popup(QPoint(0,0)); QTest::qWait(50); QVERIFY(!menu->isTearOffMenuVisible()); |