Browse Source

qgcunittest: Change from foreach to c++11 for

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
QGC4.4
Patrick José Pereira 7 years ago
parent
commit
65da5b3615
  1. 2
      src/qgcunittest/MavlinkLogTest.cc
  2. 4
      src/qgcunittest/RadioConfigTest.cc
  3. 2
      src/qgcunittest/UnitTest.cc

2
src/qgcunittest/MavlinkLogTest.cc

@ -38,7 +38,7 @@ void MavlinkLogTest::init(void) @@ -38,7 +38,7 @@ void MavlinkLogTest::init(void)
// Make sure temp directory is clear of mavlink logs
QDir tmpDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation));
QStringList logFiles(tmpDir.entryList(QStringList(QString("*.%1").arg(_logFileExtension)), QDir::Files));
foreach(const QString &logFile, logFiles) {
for(const QString &logFile: logFiles) {
bool success = tmpDir.remove(logFile);
Q_UNUSED(success);
Q_ASSERT(success);

4
src/qgcunittest/RadioConfigTest.cc

@ -207,7 +207,7 @@ void RadioConfigTest::_init(MAV_AUTOPILOT firmwareType) @@ -207,7 +207,7 @@ void RadioConfigTest::_init(MAV_AUTOPILOT firmwareType)
// Find the radio component
QObject* vehicleComponent = NULL;
foreach (const QVariant& varVehicleComponent, _autopilot->vehicleComponents()) {
for (const QVariant& varVehicleComponent: _autopilot->vehicleComponents()) {
if (firmwareType == MAV_AUTOPILOT_PX4) {
PX4RadioComponent* radioComponent = qobject_cast<PX4RadioComponent*>(varVehicleComponent.value<VehicleComponent*>());
if (radioComponent) {
@ -370,7 +370,7 @@ void RadioConfigTest::_fullCalibrationWorker(MAV_AUTOPILOT firmwareType) @@ -370,7 +370,7 @@ void RadioConfigTest::_fullCalibrationWorker(MAV_AUTOPILOT firmwareType)
QStringList switchList;
switchList << "RC_MAP_MODE_SW" << "RC_MAP_LOITER_SW" << "RC_MAP_RETURN_SW" << "RC_MAP_POSCTL_SW" << "RC_MAP_ACRO_SW";
foreach (const QString &switchParam, switchList) {
for (const QString &switchParam: switchList) {
Q_ASSERT(_vehicle->parameterManager()->getParameter(FactSystem::defaultComponentId, switchParam)->rawValue().toInt() != channel + 1);
}
}

2
src/qgcunittest/UnitTest.cc

@ -81,7 +81,7 @@ int UnitTest::run(QString& singleTest) @@ -81,7 +81,7 @@ int UnitTest::run(QString& singleTest)
{
int ret = 0;
foreach (QObject* test, _testList()) {
for (QObject* test: _testList()) {
if (singleTest.isEmpty() || singleTest == test->objectName()) {
QStringList args;
args << "*" << "-maxwarnings" << "0";

Loading…
Cancel
Save