我正在为我的 QT 应用程序编写单元测试用例,其中包含QWizard
. 我正在使用QtTest
框架。但是我无法在我的向导页面上单击“下一步”按钮。
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();
第二initializePage
页没有被调用,所以我认为没有点击下一步按钮。单元测试时如何进入下一页?