PDA

View Full Version : How to simulate menu clicks?



oficjalne100
12th March 2012, 14:50
Hi

I successfully write my test cases for my application. And I have problem with mouse clicks on the main menu. How do I suppose to do that?
Normal clicks I do like that:

QTest::mouseClick(lParams->ui->mOk, Qt::LeftButton);
And menu clicks I do like that:

QVERIFY(lMain->ui->mActionDisconnect->associatedWidgets().length());
QTest::mouseClick(lMain->ui->mActionDisconnect->associatedWidgets()[0], Qt::LeftButton);
But it seems that it not always work as expected. I have two successfully clicks and one fail. The result is application hangs because application object is deleted in wrong state. Another problem is that menu is not raised and submenu is not visible during test. Please tell me how to simulate mouse clicks on application menu?

thank you