Browse Source

Updated unit test support

QGC4.4
Don Gagne 9 years ago
parent
commit
9507d24cf9
  1. 9
      src/qgcunittest/UnitTest.cc
  2. 3
      src/qgcunittest/UnitTest.h

9
src/qgcunittest/UnitTest.cc

@ -198,6 +198,13 @@ void UnitTest::checkExpectedMessageBox(int expectFailFlags)
QCOMPARE(messageBoxRespondedTo, true); QCOMPARE(messageBoxRespondedTo, true);
} }
void UnitTest::checkMultipleExpectedMessageBox(int messageCount)
{
int missedMessageBoxCount = _missedMessageBoxCount;
_missedMessageBoxCount = 0;
QCOMPARE(missedMessageBoxCount, messageCount);
}
void UnitTest::checkExpectedFileDialog(int expectFailFlags) void UnitTest::checkExpectedFileDialog(int expectFailFlags)
{ {
// Internal testing // Internal testing
@ -377,7 +384,7 @@ void UnitTest::_connectMockLink(MAV_AUTOPILOT autopilot)
// Wait for the Vehicle to get created // Wait for the Vehicle to get created
QSignalSpy spyVehicle(qgcApp()->toolbox()->multiVehicleManager(), SIGNAL(parameterReadyVehicleAvailableChanged(bool))); QSignalSpy spyVehicle(qgcApp()->toolbox()->multiVehicleManager(), SIGNAL(parameterReadyVehicleAvailableChanged(bool)));
QCOMPARE(spyVehicle.wait(5000), true); QCOMPARE(spyVehicle.wait(10000), true);
QVERIFY(qgcApp()->toolbox()->multiVehicleManager()->parameterReadyVehicleAvailable()); QVERIFY(qgcApp()->toolbox()->multiVehicleManager()->parameterReadyVehicleAvailable());
_vehicle = qgcApp()->toolbox()->multiVehicleManager()->activeVehicle(); _vehicle = qgcApp()->toolbox()->multiVehicleManager()->activeVehicle();
QVERIFY(_vehicle); QVERIFY(_vehicle);

3
src/qgcunittest/UnitTest.h

@ -74,6 +74,9 @@ public:
// @param Expected failure response flags // @param Expected failure response flags
void checkExpectedMessageBox(int expectFailFlags = expectFailNoFailure); void checkExpectedMessageBox(int expectFailFlags = expectFailNoFailure);
/// Checks that the specified number of message boxes where shown. Do not call setExpectedMessageBox when using this method.
void checkMultipleExpectedMessageBox(int messageCount);
/// @brief Check whether a message box was displayed and correctly responded to /// @brief Check whether a message box was displayed and correctly responded to
// @param Expected failure response flags // @param Expected failure response flags
void checkExpectedFileDialog(int expectFailFlags = expectFailNoFailure); void checkExpectedFileDialog(int expectFailFlags = expectFailNoFailure);

Loading…
Cancel
Save