Commit 674a5b7f authored by Don Gagne's avatar Don Gagne

Update unit tests to new MultiVehicleManager signaling

parent 4d28975d
...@@ -51,20 +51,13 @@ void FactSystemTestBase::_init(MAV_AUTOPILOT autopilot) ...@@ -51,20 +51,13 @@ void FactSystemTestBase::_init(MAV_AUTOPILOT autopilot)
LinkManager::instance()->connectLink(link); LinkManager::instance()->connectLink(link);
// Wait for the Vehicle to get created // Wait for the Vehicle to get created
QSignalSpy spyUas(MultiVehicleManager::instance(), SIGNAL(activeVehicleAvailableChanged(bool))); QSignalSpy spyVehicle(MultiVehicleManager::instance(), SIGNAL(parameterReadyVehicleAvailableChanged(bool)));
QCOMPARE(spyUas.wait(5000), true); QCOMPARE(spyVehicle.wait(5000), true);
QVERIFY(MultiVehicleManager::instance()->activeVehicleAvailable()); QVERIFY(MultiVehicleManager::instance()->parameterReadyVehicleAvailable());
QVERIFY(MultiVehicleManager::instance()->activeVehicle());
_plugin = MultiVehicleManager::instance()->activeVehicle()->autopilotPlugin(); _plugin = MultiVehicleManager::instance()->activeVehicle()->autopilotPlugin();
Q_ASSERT(_plugin); Q_ASSERT(_plugin);
// Wait for the plugin to be ready
QSignalSpy spyPlugin(_plugin, SIGNAL(pluginReadyChanged(bool)));
if (!_plugin->pluginReady()) {
QCOMPARE(spyPlugin.wait(60000), true);
}
Q_ASSERT(_plugin->pluginReady());
} }
void FactSystemTestBase::_cleanup(void) void FactSystemTestBase::_cleanup(void)
......
...@@ -71,19 +71,14 @@ void SetupViewTest::_clickThrough_test(void) ...@@ -71,19 +71,14 @@ void SetupViewTest::_clickThrough_test(void)
linkMgr->connectLink(link); linkMgr->connectLink(link);
// Wait for the Vehicle to get created // Wait for the Vehicle to get created
QSignalSpy spyUas(MultiVehicleManager::instance(), SIGNAL(activeVehicleAvailableChanged(bool))); QSignalSpy spyVehicle(MultiVehicleManager::instance(), SIGNAL(parameterReadyVehicleAvailableChanged(bool)));
QCOMPARE(spyUas.wait(5000), true); QCOMPARE(spyVehicle.wait(5000), true);
QVERIFY(MultiVehicleManager::instance()->activeVehicleAvailable()); QVERIFY(MultiVehicleManager::instance()->parameterReadyVehicleAvailable());
QVERIFY(MultiVehicleManager::instance()->activeVehicle());
AutoPilotPlugin* autopilot = MultiVehicleManager::instance()->activeVehicle()->autopilotPlugin(); AutoPilotPlugin* autopilot = MultiVehicleManager::instance()->activeVehicle()->autopilotPlugin();
Q_ASSERT(autopilot); Q_ASSERT(autopilot);
QSignalSpy spyPlugin(autopilot, SIGNAL(pluginReadyChanged(bool)));
if (!autopilot->pluginReady()) {
QCOMPARE(spyPlugin.wait(60000), true);
}
Q_ASSERT(autopilot->pluginReady());
// Switch to the Setup view // Switch to the Setup view
_mainToolBar->onSetupView(); _mainToolBar->onSetupView();
QTest::qWait(1000); QTest::qWait(1000);
......
...@@ -153,17 +153,16 @@ void RadioConfigTest::init(void) ...@@ -153,17 +153,16 @@ void RadioConfigTest::init(void)
Q_CHECK_PTR(_mockLink); Q_CHECK_PTR(_mockLink);
LinkManager::instance()->_addLink(_mockLink); LinkManager::instance()->_addLink(_mockLink);
LinkManager::instance()->connectLink(_mockLink); LinkManager::instance()->connectLink(_mockLink);
QTest::qWait(5000); // Give enough time for UI to settle and heartbeats to go through
// Wait for the Vehicle to get created
QSignalSpy spyVehicle(MultiVehicleManager::instance(), SIGNAL(parameterReadyVehicleAvailableChanged(bool)));
QCOMPARE(spyVehicle.wait(5000), true);
QVERIFY(MultiVehicleManager::instance()->parameterReadyVehicleAvailable());
QVERIFY(MultiVehicleManager::instance()->activeVehicle());
_autopilot = MultiVehicleManager::instance()->activeVehicle()->autopilotPlugin(); _autopilot = MultiVehicleManager::instance()->activeVehicle()->autopilotPlugin();
Q_ASSERT(_autopilot); Q_ASSERT(_autopilot);
QSignalSpy spyPlugin(_autopilot, SIGNAL(pluginReadyChanged(bool)));
if (!_autopilot->pluginReady()) {
QCOMPARE(spyPlugin.wait(60000), true);
}
Q_ASSERT(_autopilot->pluginReady());
// This will instatiate the widget with an active uas with ready parameters // This will instatiate the widget with an active uas with ready parameters
_calWidget = new QGCQmlWidgetHolder(); _calWidget = new QGCQmlWidgetHolder();
_calWidget->resize(600, 600); _calWidget->resize(600, 600);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment