//private: Ui::ConnectedForm ui;
C++ (Qt)#ifdef TESTpublic:#elseprivate:#endif
C++ (Qt)#define private public
void ConnectedFormTests::test_ConnectionFormConnect(){ QFETCH(QString, id); QFETCH(QString, hostName); QFETCH(QString, expecded); ConnectedForm* v = new ConnectedForm(NULL); v->show(); QTest::keyClick(v, Qt::Key_Tab); QTest::keyClick(v, Qt::Key_Tab); QTest::keyClicks(v, id); QTest::keyClick(v, Qt::Key_Tab); QTest::keyClicks(v, hostName); msgBoxProcessTimer.start(); QTest::keyClick(v, Qt::Key_Enter); if(expecded != "") QCOMPARE(msgBoxMessage, expecded); delete v;}
void ConnectedFormTests::test_ConnectionFormConnect(){ QFETCH(QString, id); QFETCH(QString, hostName); QFETCH(QString, expecded); ConnectedForm* v = new ConnectedForm(NULL); v->show(); QTest::keyClicks(v->ui.comboBox, id); //QTest::keyClick(v, Qt::Key_Tab); QTest::keyClicks(v->ui.comboBox_2, hostName); msgBoxProcessTimer.start(); QTest::keyClick(v->ui.btnConnect, Qt::LeftButton); if(expecded != "") QCOMPARE(msgBoxMessage, expecded); delete v;}
QFETCH(QString, id); QFETCH(QString, hostName); QFETCH(QString, expecded); ConnectedForm* v = new ConnectedForm(NULL); v->show(); QPushButton * btnConn = v->findChild<QPushButton*>(QStringLiteral("btnConnect")); QComboBox* cmb1 = v->findChild<QComboBox*>(QStringLiteral("comboBox")); QComboBox* cmb2 = v->findChild<QComboBox*>(QStringLiteral("comboBox_2")); QTest::keyClicks(cmb1, id); QTest::keyClicks(cmb2, hostName); msgBoxProcessTimer.start(); btnConn->click(); if(expecded != "") QCOMPARE(msgBoxMessage, expecded); delete cmb1; delete cmb2; delete btnConn; delete v;