I am writing unit test cases for my QT application which contains a QWizard
. I am using QtTest
framework. But I am not able to get the Next button clicked on my wizard page.
welcomePage->m_installedVersion->lineEdit()->setText("1102");
welcomePage->m_upgradeVersion->lineEdit()->setText("12");
welcomePage->completeChanged(); //Only the above two text fields are mandatory so Next button should be enabled here, but it is not. So I have manually enabled it below.
myWizard.getNextButton()->setEnabled(true);
while( !myWizard.getNextButton()->isEnabled())
{
}
//Trying different ways to click on Next
QTest::mouseClick(myWizard.getNextButton(), Qt::RightButton, Qt::NoModifier, QPoint(), 5000);
QSignalSpy(myWizard.getNextButton(), &QPushButton::clicked);
myWizard.getNextButton()->click();
The initializePage
for the second page does not get called, so I don't think Next button has been clicked. How can I go to the Next page while unit testing?