Skip to content

Commit

Permalink
Unit test always use resource based meta data
Browse files Browse the repository at this point in the history
  • Loading branch information
DonLakeFlyer committed Jul 22, 2015
1 parent 0183ea1 commit 1ee424a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/AutoPilotPlugins/PX4/PX4ParameterLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,16 @@ void PX4ParameterLoader::loadParameterFactMetaData(void)

Q_ASSERT(_mapParameterName2FactMetaData.count() == 0);

// First look for meta data that comes from a firmware download. Fall back to resource if not there.
QSettings settings;
QDir parameterDir = QFileInfo(settings.fileName()).dir();
QString parameterFilename = parameterDir.filePath("PX4ParameterFactMetaData.xml");
if (!QFile(parameterFilename).exists()) {
QString parameterFilename;

// We want unit test builds to always use the resource based meta data to provide repeatable results
if (!qgcApp()->runningUnitTests()) {
// First look for meta data that comes from a firmware download. Fall back to resource if not there.
QSettings settings;
QDir parameterDir = QFileInfo(settings.fileName()).dir();
parameterFilename = parameterDir.filePath("PX4ParameterFactMetaData.xml");
}
if (parameterFilename.isEmpty() || !QFile(parameterFilename).exists()) {
parameterFilename = ":/AutoPilotPlugins/PX4/ParameterFactMetaData.xml";
}

Expand Down

0 comments on commit 1ee424a

Please sign in to comment.